Hello to all, welcome to therichpost.com. In this post, I will tell you, How to Setup Laravel Default Login Authentication? Laravel is one of the top php mvc framework.
Let’s Start the Authentication In laravel:
Laravel comes with Default Login Authentication, you just only run one command to add this and this is very easy and interesting.
Here is that command, first open your terminal and run below command:
php artisan make:auth
After run ablove command you can see, laravel will add all login related views itself and this is very good feature.
After all this done, laravel route file has also been updated routes/web.php file:
Route:auth() method has all the login and registration routes.
Now you have all the views into your laravel and open your laravel project and you can easily see login and registration menu nav on your laravel project header.
Before login first you need to run to migrate command into your terminal and that command will create user auth related tables into your database and here is the command:
Also save your database details in your .env file then run below command:
php artisan migrate
If you will get any kind of error like “Syntax error or access violation: 1071” then check below link:
Now after all this, you set your laravel project with default auth laravel feature.
There are so many code tricks in laravel and i will let you know all. Please do comment if you any query related to this post. Thank you. Therichpost.com
laravel back() helper helps to user’s previous location
public function calendarSetting(Request $request)
{
if ($request->isMethod(‘post’))
{
$updateArr = [
‘value’ => serialize($request->provider),
‘updated_at’ => Carbon::now()->toDateTimeString()
];
$setting = DB::table(‘rv_setup’)
->where(‘user_id’,$this->userid)
->where(‘type’,’calender_settings’)
->update($updateArr);
if($setting) {
Session::flash(‘success’,’Settings updated successfully.’);
} else {
Session::flash(‘danger’,’Query failed, Please try again.’);
}
return back();
}
}
In php we use
header(‘Location: ‘.$url);
but laravel made easy
nice tut 🙂