|
|
@@ -13,6 +13,7 @@ use App\Models\Schedule;
|
|
|
use Exception;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
+use Illuminate\Support\Facades\Storage;
|
|
|
|
|
|
class ReviewService
|
|
|
{
|
|
|
@@ -156,6 +157,7 @@ class ReviewService
|
|
|
{
|
|
|
return [
|
|
|
'schedule.client.user',
|
|
|
+ 'schedule.client.profileMedia',
|
|
|
'schedule.provider.user',
|
|
|
'schedule.address.city',
|
|
|
'schedule.address.state',
|
|
|
@@ -194,11 +196,21 @@ class ReviewService
|
|
|
|
|
|
public function getByProviderReceived(int $providerId)
|
|
|
{
|
|
|
- return Review::with($this->detailEagerLoads())
|
|
|
+ $reviews = Review::with($this->detailEagerLoads())
|
|
|
->whereIn('origin', ['client', 'clients'])
|
|
|
->whereHas('schedule', fn ($q) => $q->where('provider_id', $providerId))
|
|
|
->orderBy('created_at', 'desc')
|
|
|
->get();
|
|
|
+
|
|
|
+ foreach ($reviews as $review) {
|
|
|
+ if ($review->schedule?->client?->profileMedia?->path) {
|
|
|
+ $review->schedule->client->profile_photo = Storage::temporaryUrl($review->schedule->client->profileMedia->path, now()->addMinutes(60));
|
|
|
+ } else {
|
|
|
+ $review->schedule->client->profile_photo = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $reviews;
|
|
|
}
|
|
|
|
|
|
public function update(int $id, array $data): Review
|