Nexus-InglineSystems/app/Services/ClientService.php

35 lines
691 B
PHP

<?php
namespace App\Services;
use App\Models\Client;
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
class ClientService
{
public function __construct(protected Client $client) {}
public function addClient(array $client)
{
if (!Auth::check()) {
return redirect()->to('/login');
}
return Client::create($client);
}
public function updateClient(Client $client, $data)
{
$data['name'] = $data['client_name'];
return $client->update($data);
}
public function detailClient(Client $client)
{
//Detail method
return $client->all();
}
}