laravel trickes code example
Example 1: laravel tricks and tips
//$user = User::find($id);
//if (!$user) { abort (404); }
//=> do this
$user = User::findOrFail($id);
//@sujay
Example 2: laravel tricks and tips
$user = [
'email' => 'email',
'password' => 'password'
];
if (Auth::attempt($user))
{
// user is now logged in!
// Access user object with Auth::user()
}
//@sujay