diff --git a/app/Http/Controllers/Admin/ManageLeadController.php b/app/Http/Controllers/Admin/ManageLeadController.php index c0935f6..4c10dd3 100644 --- a/app/Http/Controllers/Admin/ManageLeadController.php +++ b/app/Http/Controllers/Admin/ManageLeadController.php @@ -31,6 +31,7 @@ class ManageLeadController extends Controller if (!$check) { abort(404); } + // dd($this->lead->getAllLeads()); return view('Admin.Pages.manage_leads.manage_leads', [ 'leads' => $this->lead->getAllLeads(), 'leadCount' => $this->lead->totalLead(), diff --git a/app/Models/Lead.php b/app/Models/Lead.php index 55fdf07..d50274c 100644 --- a/app/Models/Lead.php +++ b/app/Models/Lead.php @@ -18,6 +18,11 @@ class Lead extends Model { return $this->belongsTo(User::class,'lead_owner','id'); } + + public function leadSourceName() + { + return $this->belongsTo(User::class,'lead_source'); + } public function user() { @@ -44,7 +49,7 @@ class Lead extends Model public function calls(){ return $this->hasMany(LeadCall::class, 'leads_id'); } - + public function kyc(){ return $this->belongsTo(UserKyc::class,'users_id'); } diff --git a/app/Services/Admin/LeadService.php b/app/Services/Admin/LeadService.php index eac77cf..f9e720f 100644 --- a/app/Services/Admin/LeadService.php +++ b/app/Services/Admin/LeadService.php @@ -12,7 +12,7 @@ use Illuminate\Support\Facades\DB; class LeadService{ public function getAllLeads(){ - return Lead::with('kyc','user', 'product.category')->latest()->get(); + return Lead::with('kyc','leadSourceName','user', 'product.category')->latest()->get(); // dd(Lead::with('kyc','user', 'product.category')->latest()->first()); } diff --git a/resources/views/Admin/Pages/manage_leads/manage_leads.blade.php b/resources/views/Admin/Pages/manage_leads/manage_leads.blade.php index ca8a93c..e914563 100644 --- a/resources/views/Admin/Pages/manage_leads/manage_leads.blade.php +++ b/resources/views/Admin/Pages/manage_leads/manage_leads.blade.php @@ -255,7 +255,8 @@ Email Product Name Product Category - Status + KYC Status + Lead Source Contact Number Lead Status Created Date @@ -288,9 +289,12 @@ @endforeach --}} @else - N/A + No kyc @endif + + {{$lead->leadSourceName != null ? $lead->leadSourceName->name : 'No lead assigned'}} + {{ $lead->mobile }} {{ $lead->lead_status }}