Support the ongoing development of Laravel.io →
Authentication Validation Packages
Last updated 2 years ago.
0

You'd want to use a Route Filter.

Last updated 2 years ago.
0

hi Garbee,

I have this folder to access the CRUD must be logged in


Route::group(array('before' => 'authSentry'), function()
{
	Route::resource('areas', 'AreasController');
});

I have this and another filter for access to shares

Route::filter('hasAccess', function($route, $request, $value)
{
	$user = Sentry::getUser();
	if (!$user->hasAccess($value)) return View::make('no-access');
});

Apparently it only works when it is declared in the constructor and I need it to work in all the methods (create, read, update, delete)

class AreasController extends BaseController {

    public function __construct()
    {
        $this->beforeFilter('hasAccess:areas');
    }

}
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

montes2012 montes2012 Joined 11 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.