Hmm, Let's try this here:
Route::filter('department', function($route, $request)
{
//remember, Auth::user() is used to call the current user (default) and give access to its data (kind of like calling data from your User model), not the methods within your user model
//might want to read this: http://laravel.com/docs/security#authenticating-users
$department_id = Auth::user()->id;
if(!Request::isMethod('post'){
//here I use 'User::' because this would be the correct way to access a model method from this file
if (!User::canAccessDepartment($department_id) && $request->segment(2) != "create")
{
return Redirect::to('/')->with('notice', 'Error!');
}
}
});
Written from thoughts so apologies if it's not sound syntax or logic, but it should work for your situation.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community