-1

How to do this: 1. Access route only when user is login. 2. Redirect to voyager login when accessing the restricted page.

Route::get('/call_sheet', 'CallSheetsController@index');

the route returns a view.

TRD-Warren
  • 357
  • 5
  • 16

1 Answers1

1

You can use Voyager middleware.

Route::get('/call_sheet', 'CallSheetsController@index')->middleware('admin.user');
Ali Özen
  • 1,525
  • 2
  • 14
  • 29
  • Thanks for your answer. But how can i redirect it to 'test.local/admin/login of Voyager .. not to test.local/login' which is generated by auth. ? – TRD-Warren Jun 13 '18 at 07:48
  • hmm .. i don't think so sir .. i will not use the prefix admin.. my url is test.local/call_sheet .. – TRD-Warren Jun 13 '18 at 07:58
  • You are misunderstood whole point. middleware('admin.user') is redirecting directly admin/login. my first answer is working perfectly :) – Ali Özen Jun 13 '18 at 08:48
  • This seems to be the correct answer for me too and should be accepted. – Boyan May 14 '20 at 10:11