mardi 2 janvier 2018

Laravel elfinder custom auth

My project is Laravel 5.4, I use Laravel-elfinder by Barryvdh, it works very nice but when I append my authenticate middleware, is not work as my expected.

Expected: Only authenticated user can use Elfinder

Right now: Login success but elfinder cannot recognize session, Auth::user() is null

I'm using custom auth class and here is my AuthVerification.php middleware.

<?php

namespace App\Http\Middleware;

use App\Libraries\Routes\Routes;
use Closure;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Session;

class AuthVerification
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if(!Auth::check()){
            return redirect('/guest/login');
        }
        return $next($request);
    }
}

I put this middleware info config/elfinder.php but when I access and login http://ift.tt/2CuGzdU my Auth::user() always null when I dd(Auth::user()) in ElfinderController.php and tinymce4.blade.php

'route' => [
    'prefix' => 'elfinder',
    'middleware' => 'AuthVerification', //Set to null to disable middleware filter
],

Does need any specific way to make my custom auth class work with elfinder?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2lFzjS0
via IFTTT

Aucun commentaire:

Enregistrer un commentaire