title: How to give access to views to specific user in laravel?
body: <p>I have a Category Controller which checks if user is logged in</p>
  
  <pre><code>class CategoryController extends Controller
  {
       public function __construct() {
          $this-&gt;middleware('auth');
  
      }
      ...
  </code></pre>
  
  <p>My category routes are :</p>
  
  <pre><code>//Category Controller
  Route::get('admin/category/{category}/edit', ['uses'=&gt;'categoryController@edit','as'=&gt;'admin.category.edit']);
  Route::put('admin/category/{category}', ['uses'=&gt;'categoryController@update','as'=&gt;'admin.category.update']);
  Route::get('admin/category/{category}', ['uses'=&gt;'categoryController@show','as'=&gt;'admin.category.show']);
  Route::delete('admin/category/{category}', ['uses'=&gt;'categoryController@destroy','as'=&gt;'admin.category.destroy']);
  Route::get('admin/category/create', ['uses'=&gt;'categoryController@create','as'=&gt;'admin.category.create']);
  Route::get('admin/category', ['uses'=&gt;'categoryController@index','as'=&gt;'admin.category.index']);
  Route::post('admin/category', ['uses'=&gt;'categoryController@store','as'=&gt;'admin.category.store']);
  </code></pre>
  
  <p><strong>Is there a way to give access to these views to only specific user?</strong> </p>
  
  <p>For example if user email is admin123@gmail.com then he is allowed to go to those view.</p>
  
  <p>I know I can check like this</p>
  
  <pre><code>if(Auth::user()-&gt;email == 'admin123@gmail.com')
  {
     dd('admin Logged in');
  }
  </code></pre>
  
  <p>But this is possible if i go to individual view and put all my content in the if statement.</p>
  
  <p><strong>Is there way to handle this in controller.</strong> </p>
  
  <p>Thanks.</p>