I used this package on my app in local and it worked just fine but since i moved my app to server i'm getting this error:
Call to a member function hasPermissionTo() on null in AdminMiddleware.php (line 22)
I'm using TinyMCE 4
Here is my AdminMiddleware
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
use App\User;
class AdminMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$user = User::all()->count();
if (!($user == 1)) {
if (!Auth::user()->hasPermissionTo('Administer roles & permissions')) //If user does //not have this permission
{
abort('401');
}
}
return $next($request);
}
}
Hello,
I used this package on my app in local and it worked just fine but since i moved my app to server i'm getting this error:
Call to a member function hasPermissionTo() on null in AdminMiddleware.php (line 22)
I'm using TinyMCE 4
Here is my
AdminMiddleware
and here is my script on
post create page
Does anyone know why I have this issue and how to fix it?