changes
This commit is contained in:
@@ -59,7 +59,11 @@ class ManageCustomerController extends Controller
|
||||
|
||||
|
||||
try {
|
||||
$customers_data = IamPrincipal::findOrFail($id);
|
||||
$customers_data = IamPrincipal::with('state','contactMessages')->findOrFail($id);
|
||||
if ($customers_data->contactMessages->isEmpty()) {
|
||||
Log::info('No contact messages found for customer with ID: ' . $id);
|
||||
}
|
||||
// return $customers_data;
|
||||
return view('Admin.pages.manage_users.manage_customer.view_customer_details', compact('customers_data'));
|
||||
} catch (Exception $e) {
|
||||
Log::error("Manage Voucher Page Not Load " . $e->getMessage());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
@@ -44,7 +45,7 @@ class IamPrincipal extends Authenticatable implements JWTSubject
|
||||
|
||||
public function moduleLinks()
|
||||
{
|
||||
return $this->hasMany(ManageModuleLink::class,'principal_xid', 'id');
|
||||
return $this->hasMany(ManageModuleLink::class, 'principal_xid', 'id');
|
||||
}
|
||||
|
||||
public function feedbacks()
|
||||
@@ -130,35 +131,35 @@ class IamPrincipal extends Authenticatable implements JWTSubject
|
||||
'password' => 'hashed',
|
||||
];
|
||||
|
||||
public function getPermissionGranted($id,$module)
|
||||
public function getPermissionGranted($id, $module)
|
||||
{
|
||||
// $id is used as authuser id
|
||||
// $moudle is the slug of sidebar module
|
||||
|
||||
$isSubAdmin = IamPrincipal::where('id',$id)->where('principal_type_xid',2)->first();
|
||||
// 'is_admin',1 is for checking the login user is subadmin or not
|
||||
$isSubAdmin = IamPrincipal::where('id', $id)->where('principal_type_xid', 2)->first();
|
||||
// 'is_admin',1 is for checking the login user is subadmin or not
|
||||
|
||||
$isMainAdmin = IamPrincipal::where('id',$id)->where('principal_type_xid',1)->first();
|
||||
if($isMainAdmin){
|
||||
return true;
|
||||
}elseif($isSubAdmin){
|
||||
//search for module
|
||||
$isModule = ManageModule::where('slug',$module)->first();
|
||||
if($isModule){
|
||||
$isSubAdminModuleLink = ManageModuleLink::where('principal_xid',$id)
|
||||
->where('manage_modules_xid',$isModule->id)->first();
|
||||
// dd($id,$module,$isSubAdmin->id,$isModule,$isSubAdminModuleLink);
|
||||
if($isSubAdminModuleLink){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
$isMainAdmin = IamPrincipal::where('id', $id)->where('principal_type_xid', 1)->first();
|
||||
if ($isMainAdmin) {
|
||||
return true;
|
||||
} elseif ($isSubAdmin) {
|
||||
//search for module
|
||||
$isModule = ManageModule::where('slug', $module)->first();
|
||||
if ($isModule) {
|
||||
$isSubAdminModuleLink = ManageModuleLink::where('principal_xid', $id)
|
||||
->where('manage_modules_xid', $isModule->id)->first();
|
||||
// dd($id,$module,$isSubAdmin->id,$isModule,$isSubAdminModuleLink);
|
||||
if ($isSubAdminModuleLink) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// public function orders()
|
||||
@@ -184,8 +185,11 @@ class IamPrincipal extends Authenticatable implements JWTSubject
|
||||
// }
|
||||
|
||||
public function restaurant()
|
||||
{
|
||||
return $this->hasMany(ManageRestaurant::class, 'id', 'restaurant_xid');
|
||||
}
|
||||
|
||||
{
|
||||
return $this->hasMany(ManageRestaurant::class, 'id', 'restaurant_xid');
|
||||
}
|
||||
public function contactMessages()
|
||||
{
|
||||
return $this->hasMany(ManageContactus::class, 'principal_xid', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ $currentPage = 'manage-customer';
|
||||
<td>Location :</td>
|
||||
|
||||
<td>Email ID :</td>
|
||||
<td>Contact History : </td>
|
||||
<td>Onboarded date :</td>
|
||||
{{-- <td>Location :</td> --}}
|
||||
{{-- <td>Start Date :</td> --}}
|
||||
@@ -88,8 +89,10 @@ $currentPage = 'manage-customer';
|
||||
<td>{{ $customers_data->state->name}}</td>
|
||||
|
||||
<td>{{ $customers_data->email_address }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($customers_data->created_at)->format('d-m-y') }}
|
||||
</td>
|
||||
@foreach($customers_data->contactMessages as $messages)
|
||||
<td>{{$messages->message}}</td>
|
||||
@endforeach
|
||||
<td>{{ \Carbon\Carbon::parse($customers_data->created_at)->format('d-m-y') }}</td>
|
||||
<td>{{ $customers_data->country_xid }}</td>
|
||||
{{-- <td>03/07/2023</td> --}}
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user