Mails previews, Lead Passolution, Lead Country Files, LeadParticipant
This commit is contained in:
parent
5e3bd3a1ba
commit
ae70577289
28 changed files with 596 additions and 97 deletions
|
|
@ -5,6 +5,7 @@ namespace App\Repositories;
|
|||
|
||||
use App\Models\Lead;
|
||||
use App\Models\LeadNotice;
|
||||
use App\Models\LeadParticipant;
|
||||
use App\Models\StatusHistory;
|
||||
|
||||
class LeadRepository extends BaseRepository {
|
||||
|
|
@ -42,7 +43,6 @@ class LeadRepository extends BaseRepository {
|
|||
return $model;
|
||||
}
|
||||
|
||||
|
||||
public function updateLead($id, $data)
|
||||
{
|
||||
$this->model = Lead::findOrFail($id);
|
||||
|
|
@ -91,9 +91,34 @@ class LeadRepository extends BaseRepository {
|
|||
|
||||
StatusHistory::create($fill);
|
||||
}
|
||||
|
||||
}
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
public function updateLeadParticipant($id, $data){
|
||||
$this->model = Lead::findOrFail($id);
|
||||
if(isset($data['participant'])){
|
||||
foreach($data['participant'] as $p_id => $fill){
|
||||
$Participant = LeadParticipant::findOrFail($p_id);
|
||||
if($Participant->lead_id !== $this->model->id){
|
||||
abort(500);
|
||||
}
|
||||
$fill['participant_child'] = isset($fill['participant_child']) ? true : false;
|
||||
$fill['participant_birthdate'] = isset($fill['participant_birthdate']) ? _reformat_date($fill['participant_birthdate']) : null;
|
||||
$Participant->fill($fill);
|
||||
$Participant->save();
|
||||
}
|
||||
}
|
||||
//main
|
||||
$this->model->participant_salutation_id = isset($data['participant_salutation_id']) ? $data['participant_salutation_id'] : null;
|
||||
$this->model->participant_name = isset($data['participant_name']) ? $data['participant_name'] : null;
|
||||
$this->model->participant_firstname = isset($data['participant_firstname']) ? $data['participant_firstname'] : null;
|
||||
//$this->model->nationality_id = isset($data['nationality_id']) ? $data['nationality_id'] : null;
|
||||
$this->model->participant_birthdate = isset($data['participant_birthdate']) ? _reformat_date($data['participant_birthdate']) : null;
|
||||
|
||||
$this->model->save();
|
||||
return $this->model;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue