mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Prep stuff for routes and actions.
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Auth;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* Class Rule
|
||||
@@ -66,4 +67,19 @@ class Rule extends Model
|
||||
return $this->hasMany('FireflyIII\Models\RuleTrigger');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Rule $value
|
||||
*
|
||||
* @return Rule
|
||||
*/
|
||||
public static function routeBinder(Rule $value)
|
||||
{
|
||||
if (Auth::check()) {
|
||||
if ($value->user_id == Auth::user()->id) {
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
throw new NotFoundHttpException;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user