feat: Agora verifica se o usuário está logado antes de concluir uma ação.
This commit is contained in:
parent
a7b0de06f1
commit
c788a80d03
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
use App\Models\Client;
|
use App\Models\Client;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Gate;
|
use Illuminate\Support\Facades\Gate;
|
||||||
|
|
||||||
class ClientService
|
class ClientService
|
||||||
|
|
@ -12,6 +13,10 @@ class ClientService
|
||||||
public function __construct(protected Client $client) {}
|
public function __construct(protected Client $client) {}
|
||||||
public function addClient(array $client)
|
public function addClient(array $client)
|
||||||
{
|
{
|
||||||
|
if (!Auth::check()) {
|
||||||
|
return redirect()->to('/login');
|
||||||
|
}
|
||||||
|
|
||||||
return Client::create($client);
|
return Client::create($client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue