Auth de cheques de laravel
use Illuminate\Support\Facades\Auth;
if (Auth::check()) {
// The user is logged in...
}
Yellowed Yacare
use Illuminate\Support\Facades\Auth;
if (Auth::check()) {
// The user is logged in...
}
@guest
// Show content if unauthenticated
@endguest
@auth
// The data only available for auth user
@endauth
composer require laravel/ui
php artisan ui vue --auth
npm install && npm run dev
Auth::login($user);
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class LoginController extends Controller
{
/**
* Handle an authentication attempt.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function authenticate(Request $request)
{
$credentials = $request->validate([
'email' => ['required', 'email'],
'password' => ['required'],
]);
if (Auth::attempt($credentials)) {
$request->session()->regenerate();
return redirect()->intended('dashboard');
}
return back()->withErrors([
'email' => 'The provided credentials do not match our records.',
]);
}
}
//namespace
use Illuminate\Support\Facades\Auth;