Prep stuff for routes and actions.

This commit is contained in:
James Cole 2016-01-13 16:05:39 +01:00
parent 768508dd4b
commit 5ac88623ed
3 changed files with 28 additions and 1 deletions

View File

@ -11,6 +11,7 @@ namespace FireflyIII\Http\Controllers;
use Auth; use Auth;
use FireflyIII\Http\Requests; use FireflyIII\Http\Requests;
use FireflyIII\Models\Rule;
use View; use View;
/** /**
@ -40,4 +41,12 @@ class RuleController extends Controller
return view('rules.index', compact('ruleGroups')); return view('rules.index', compact('ruleGroups'));
} }
/**
* @param Rule $rule
*/
public function upRule(Rule $rule)
{
}
} }

View File

@ -9,8 +9,9 @@
namespace FireflyIII\Models; namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Builder; use Auth;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/** /**
* Class Rule * Class Rule
@ -66,4 +67,19 @@ class Rule extends Model
return $this->hasMany('FireflyIII\Models\RuleTrigger'); 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;
}
} }

View File

@ -158,6 +158,8 @@ return [
'piggyBank' => 'FireflyIII\Models\PiggyBank', 'piggyBank' => 'FireflyIII\Models\PiggyBank',
'tj' => 'FireflyIII\Models\TransactionJournal', 'tj' => 'FireflyIII\Models\TransactionJournal',
'tag' => 'FireflyIII\Models\Tag', 'tag' => 'FireflyIII\Models\Tag',
'rule' => 'FireflyIII\Models\Rule',
'ruleGroup' => 'FireflyIII\Models\RuleGroup',
// lists // lists
'accountList' => 'FireflyIII\Support\Binder\AccountList', 'accountList' => 'FireflyIII\Support\Binder\AccountList',
'budgetList' => 'FireflyIII\Support\Binder\BudgetList', 'budgetList' => 'FireflyIII\Support\Binder\BudgetList',