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

@@ -38,9 +38,9 @@ class BudgetList implements BinderInterface
*
* @return Collection
*/
public static function routeBinder(string $value, Route $route): Collection
public static function routeBinder($guard, string $value, Route $route): Collection
{
if (auth()->check()) {
if ($guard->check()) {
$list = [];
$incoming = explode(',', $value);
foreach ($incoming as $entry) {
@@ -52,7 +52,7 @@ class BudgetList implements BinderInterface
}
/** @var \Illuminate\Support\Collection $collection */
$collection = auth()->user()->budgets()
$collection = $guard->user()->budgets()
->where('active', 1)
->whereIn('id', $list)
->get();