Edit / PDF / Mail / ->Leads
This commit is contained in:
parent
5d55e5be3f
commit
66ca252bfa
43 changed files with 2915 additions and 76 deletions
|
|
@ -3,19 +3,46 @@
|
|||
namespace App\Repositories;
|
||||
|
||||
|
||||
use App\Models\Booking;
|
||||
use App\Models\Customer;
|
||||
use App\Models\Lead;
|
||||
|
||||
class CustomerRepository extends BaseRepository {
|
||||
|
||||
|
||||
public function __construct(Booking $model)
|
||||
public function __construct(Customer $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function update($data)
|
||||
public function updateCustomer($id, $data)
|
||||
{
|
||||
|
||||
$this->model = Customer::findOrFail($id);
|
||||
$fill = [
|
||||
'salutation_id' => $data['salutation_id'],
|
||||
'name' => $data['name'],
|
||||
'firstname' => $data['firstname'],
|
||||
'street' => $data['street'],
|
||||
'zip' => $data['zip'],
|
||||
'city' => $data['city'],
|
||||
'email' => $data['email'],
|
||||
'phone' => $data['phone'],
|
||||
'phonemobile' => $data['phonemobile'],
|
||||
'country_id' => $data['country_id'],
|
||||
];
|
||||
$this->model->fill($fill);
|
||||
$this->model->save();
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
|
||||
public function updateCustomerFromLead($id, $data){
|
||||
|
||||
$lead = Lead::findOrFail($id);
|
||||
if(isset($data['customer']) && $lead->customer){
|
||||
return $this->updateCustomer($lead->customer->id, $data['customer']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue