make sure all route binders use guard.

This commit is contained in:
James Cole
2018-02-07 11:15:36 +01:00
parent eacc1da157
commit 909dc212fb
27 changed files with 86 additions and 84 deletions

View File

@@ -88,11 +88,11 @@ class Budget extends Model
*
* @return Budget
*/
public static function routeBinder(string $value): Budget
public static function routeBinder($guard, string $value): Budget
{
if (auth()->check()) {
if ($guard->check()) {
$budgetId = intval($value);
$budget = auth()->user()->budgets()->find($budgetId);
$budget = $guard->user()->budgets()->find($budgetId);
if (!is_null($budget)) {
return $budget;
}