You can set authentication in route for specific action as bellows
Route::get('profile', function () { // Only authenticated users may enter... })->middleware('auth');
Of course, if you are using controllers, you may call the middleware method from the controller's constructor instead of attaching it in the route definition directly:
public function __construct()
{
$this->middleware('auth');
}
Still now, contact all action is public and accessible without login. We want to set authentication for all action contact list, edit, delete except create just updating contact controller which is as bellow:
public function __construct() {
$currentAction = Route::getCurrentRoute()->getName();
if ($currentAction == 'contact.create' || $currentAction == 'contact.store') {
} else {