Adem Kıvanç

PHP - Js Developer

Menü Kapat

Etiket: php

Cache Permissions and Roles with Entrust Laravel

Don’t forget for performance: ‘ttl’ => 60, is missing in config/cache.php

Entrust is a succinct and flexible way to add Role-based Permissions to Laravel 5.

Tips on Laravel 5 authentication views

As standard template folders views/auth/login.blade.php and register.blade.php set the auth.

Add loginView and registerView properties so you can switch between templates.

 

/app/Http/Auth/AuthController.php

class AuthController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Registration & Login Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users, as well as the
    | authentication of existing users. By default, this controller uses
    | a simple trait to add these behaviors. Why don't you explore it?
    |
    */

    use AuthenticatesAndRegistersUsers, ThrottlesLogins;

    /**
     * Where to redirect users after login / registration.
     *
     * @var string
     */
    protected $redirectTo = '/';

    /**
     * Show the application login / registration form.
     *
     * @var string
     */
    protected $loginView = 'template1.login';
    protected $registerView = 'template1.register';

    /**
     * Create a new authentication controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        //switch templates
        $this->loginView = config('template.name').".login";
        $this->registerView = config('template.name').".register";
        
        $this->middleware('guest', ['except' => 'logout']);
    }



© 2024 Adem Kıvanç. Tüm hakları saklıdır.

Tema yapımcısı Anders Norén.