Call to a member function getaction() on null

Kira-Kira cara solve nya gimana ya mohon bantuannya thks :)

D:\pkpk\latihan_01_CRUD\app\Http\Middleware\cekLevel.php:28

namespace App\Http\Middleware;



use Closure;



class cekLevel

{

    /**

     * Handle an incoming request.

     *

     * @param  \Illuminate\Http\Request  $request

     * @param  \Closure  $next

     * @return mixed

     */

    public function handle($request, Closure $next)

    {

        $level = $this->cekRoute($request->route());

        if($request->user()->hasLevel($level) || !$level)

        {

            return $next($request);

        }else{

            return abort(503,'Anda tidak Memiliki Hak akses');

        }

    }

    private function cekRoute($route)

    {
Ini Error nya :
     28.  $actions = $route->getAction();

        return isset($actions['level']) ? $actions['level'] : null;

    }

}

avatar jiasfjabfie1212
@jiasfjabfie1212

38 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban