2018-11-22 22:12:41 +11:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Repositories;
|
|
|
|
|
|
2018-11-27 17:59:16 +11:00
|
|
|
use App\Models\Client;
|
2018-11-22 22:12:41 +11:00
|
|
|
use App\Repositories\ClientContactRepository;
|
2018-11-27 17:59:16 +11:00
|
|
|
use Illuminate\Http\Request;
|
2018-11-22 22:12:41 +11:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
class ClientRepository extends BaseRepository
|
|
|
|
|
{
|
2018-11-27 17:59:16 +11:00
|
|
|
protected $clientContactRepo;
|
2018-11-22 22:12:41 +11:00
|
|
|
|
2018-11-27 17:59:16 +11:00
|
|
|
public function __construct(ClientContactRepository $clientContactRepo)
|
2018-11-22 22:12:41 +11:00
|
|
|
{
|
2018-11-27 17:59:16 +11:00
|
|
|
$this->clientContactRepo = $clientContactRepo;
|
2018-11-22 22:12:41 +11:00
|
|
|
}
|
|
|
|
|
|
2019-01-19 21:35:21 +11:00
|
|
|
public function getClassName()
|
|
|
|
|
{
|
|
|
|
|
return Client::class;
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-27 17:59:16 +11:00
|
|
|
public function save(Request $request, Client $client) : ?Client
|
2018-11-22 22:12:41 +11:00
|
|
|
{
|
2018-11-27 17:59:16 +11:00
|
|
|
$client->fill($request->input());
|
|
|
|
|
$client->save();
|
2018-11-22 22:12:41 +11:00
|
|
|
|
2018-11-27 17:59:16 +11:00
|
|
|
return $client;
|
2018-11-22 22:12:41 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|