Domanda

I am looking to archive the the following

Userlogs in -> Assigned a privilege from the DB -> They can only see allowed routes only

So far i have been able to reach here:

$user = Usercredential::where('username','=',Auth::user()->username)->get();

foreach ($user as $u ) {

        $status = $u->userstatus;
        $userPriv = $u->userpriviledge;

        if ($status == 0){  
                           Session::put('user_priv',$userPriv);
            }
        else{
                    return Redirect::to_route('home')->with('message','Inactive users cannot login');
            }

Which checks the status of the user if active or inactive then stores the priviledge in my session. What next? How do i protect my routes?

Thanks

È stato utile?

Soluzione 2

For those in the future who are looking for this solution

http://net.tutsplus.com/tutorials/php/build-web-apps-from-scratch-with-laravel-filters-validations-and-files/

Will be very helpful, thanks Rodri for your pointer. I appreciate.

Altri suggerimenti

I recommend you the Laravel 4 Package called: ENTRUST who provide a way to add Role-based

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top