/** * @param $value * @param $route * * @return mixed */ public static function routeBinder($value, $route) : Collection { if (auth()->check()) { $ids = explode(',', $value); /** @var \Illuminate\Support\Collection $object */ $object = Category::whereIn('id', $ids)->where('user_id', auth()->user()->id)->get(); // add empty category if applicable. if (in_array('0', $ids)) { $object->push(new Category()); } if ($object->count() > 0) { return $object; } } throw new NotFoundHttpException(); }
// add empty budget if applicable. if (in_array('0', $ids)) { $object->push(new Budget()); } if ($object->count() > 0) { return $object; } } throw new NotFoundHttpException(); }); // category list Route::bind('categoryList', function ($value) { if (Auth::check()) { $ids = explode(',', $value); /** @var \Illuminate\Support\Collection $object */ $object = Category::whereIn('id', $ids)->where('user_id', Auth::user()->id)->get(); // add empty budget if applicable. if (in_array('0', $ids)) { $object->push(new Category()); } if ($object->count() > 0) { return $object; } } throw new NotFoundHttpException(); }); // Date Route::bind('start_date', function ($value) { if (Auth::check()) { try { $date = new Carbon($value);