diff --git a/app/Services/ClientService.php b/app/Services/ClientService.php index 4ed0af6..8368323 100644 --- a/app/Services/ClientService.php +++ b/app/Services/ClientService.php @@ -4,6 +4,7 @@ use App\Models\Client; use App\Models\User; +use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Gate; class ClientService @@ -12,6 +13,10 @@ class ClientService public function __construct(protected Client $client) {} public function addClient(array $client) { + if (!Auth::check()) { + return redirect()->to('/login'); + } + return Client::create($client); } }