restAPP
This commit is contained in:
@@ -56,7 +56,7 @@ class RestaurantAppController extends Controller
|
||||
$restaurantIds = $user->getresturant->pluck('restaurant_xid')->toArray();
|
||||
|
||||
$user->restaurants = ManageRestaurant::whereIn('id', $restaurantIds)
|
||||
->select('id', 'name', 'image', 'address', 'latitude', 'longtitude')
|
||||
->select('id','restaurant_id', 'name', 'image', 'address', 'latitude', 'longtitude')
|
||||
->get();
|
||||
|
||||
// Optionally, if you want to format the images as in the previous example
|
||||
@@ -172,37 +172,20 @@ class RestaurantAppController extends Controller
|
||||
* Created at : 03 June 2024
|
||||
* Use : To view restaturant user.
|
||||
*/
|
||||
|
||||
|
||||
public function view_rest($id)
|
||||
{
|
||||
try {
|
||||
$restaurantView = IamPrincipal::with('restaurant')->findOrFail($id);
|
||||
|
||||
// Check if restaurant_users is not null before iterating over it
|
||||
if (!is_null($restaurantView->restaurant_users)) {
|
||||
foreach ($restaurantView->restaurant_users as $user) {
|
||||
$restaurantIds = $user->getresturant->pluck('restaurant_xid')->toArray();
|
||||
|
||||
$userRestaurants = ManageRestaurant::whereIn('id', $restaurantIds)
|
||||
->select('id', 'name', 'image', 'address', 'latitude', 'longtitude')
|
||||
->get();
|
||||
|
||||
foreach ($userRestaurants as $restaurant) {
|
||||
$restaurant->image = ListingImageUrl('restaurant_images', $restaurant->image);
|
||||
}
|
||||
|
||||
$user->restaurants = $userRestaurants;
|
||||
}
|
||||
}
|
||||
// return $restaurantView;
|
||||
|
||||
return view('Admin.pages.manage_users.restaurants_app.view_restaurant_users', compact('restaurantView'));
|
||||
$restdata = IamPrincipalRestaurantRole::with('restaurant','customer')->where('principal_xid', $id)->first();
|
||||
// return $restdata;
|
||||
|
||||
return view('Admin.pages.manage_users.restaurants_app.view_restaurant_users', compact('restdata'));
|
||||
} catch (Exception $e) {
|
||||
Log::error("Manage Voucher Page Not Load " . $e->getMessage());
|
||||
return jsonResponseWithErrorMessage(__('auth.something_went_wrong'), 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -295,13 +278,13 @@ class RestaurantAppController extends Controller
|
||||
throw new Exception('Restaurant not found.');
|
||||
}
|
||||
|
||||
|
||||
|
||||
$rest_data->first_name = $request->input('first_name');
|
||||
$rest_data->last_name = $request->input('last_name');
|
||||
|
||||
$rest_data->phone_number = $request->input('restaurant_phone');
|
||||
$rest_data->date_of_birth = $request->input('user_birth');
|
||||
|
||||
|
||||
|
||||
$rest_data->save();
|
||||
|
||||
|
||||
@@ -17,7 +17,13 @@ class IamPrincipalRestaurantRole extends Model
|
||||
'created_by',
|
||||
'modified_by',
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
public function restaurant()
|
||||
{
|
||||
return $this->belongsTo(ManageRestaurant::class, 'restaurant_xid', 'id');
|
||||
}
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(IamPrincipal::class, 'principal_xid', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ $currentPage = 'manage-restaurant_app';
|
||||
{{ $restaurant->name }}
|
||||
@endforeach
|
||||
</td>
|
||||
<td class="text-start">{{ $restaurant->id }}</td>
|
||||
<td class="text-start">{{ $restaurant->restaurant_id }}</td>
|
||||
<td class="text-start">{{ $restaurant_user->email_address }}</td>
|
||||
<td>{{ $restaurant_user->created_at->format('d/m/Y') }}</td>
|
||||
<td>{{ $restaurant_user->state ? $restaurant_user->state->name : 'No state assigned' }}</td>
|
||||
|
||||
@@ -41,20 +41,14 @@ $currentPage = 'manage-restaurant_app';
|
||||
<!-- <td>Image :</td> -->
|
||||
</tr>
|
||||
<tr class="w-100">
|
||||
|
||||
<!-- <td>{{ $restaurantView->first_name ?? 'NA' }}</td> -->
|
||||
|
||||
<td>{{ !empty($restaurantView->restaurant) ? $restaurantView->restaurant[0]->name : 'NA' }}</td>
|
||||
|
||||
<td>{{ $restdata->restaurant->name ?? 'NA' }}</td>
|
||||
<td>{{ $restdata->restaurant->restaurant_id ?? 'NA' }}</td>
|
||||
<td>{{ $restdata->customer->email_address ?? 'NA' }}</td>
|
||||
<td>{{ $restdata->customer->created_at ?? 'NA' }}</td>
|
||||
|
||||
<td>{{ !empty($restaurantView->restaurant) ? $restaurantView->restaurant[0]->restaurant_id : 'NA' }}</td>
|
||||
<td>{{ $restaurantView->email_address }}</td>
|
||||
<!-- <td>{{ $restaurantView->description }}</td> -->
|
||||
<td>{{ $restaurantView->created_at->format('d/m/Y') }}</td>
|
||||
|
||||
<td><img src=""></td>
|
||||
</tr>
|
||||
|
||||
|
||||
|
||||
|
||||
</table>
|
||||
@@ -71,9 +65,8 @@ $currentPage = 'manage-restaurant_app';
|
||||
<td>While at Restaurant be sure to try :</td> -->
|
||||
</tr>
|
||||
<tr class="w-100">
|
||||
<td>{{ $restaurantView->state->name}}</td>
|
||||
<!-- <td>{{ \Carbon\Carbon::parse($restaurantView->created_at)->format('d-m-y') }}</td> -->
|
||||
<td>{{ $restaurantView->phone_number}}</td>
|
||||
<td>{{ $restdata->customer->state_xid}}</td>
|
||||
<td>{{ $restdata->customer->phone_number}}</td>
|
||||
<!-- <td>lorem ipsum</td>
|
||||
<td>19/12/2023</td>
|
||||
<td class="d-flex flex-column justify-content-start">
|
||||
@@ -138,4 +131,4 @@ $currentPage = 'manage-restaurant_app';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user