Harden
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\WorkOrder;
|
||||
use App\Notifications\ExchangeEventNotification;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -18,6 +19,11 @@ class ReviewController extends Controller
|
||||
|
||||
$data = $request->validate([
|
||||
'rating' => ['required', 'integer', 'min:1', 'max:5'],
|
||||
'communication_rating' => ['nullable', 'integer', 'min:1', 'max:5'],
|
||||
'scope_accuracy_rating' => ['nullable', 'integer', 'min:1', 'max:5'],
|
||||
'payment_reliability_rating' => ['nullable', 'integer', 'min:1', 'max:5'],
|
||||
'workmanship_rating' => ['nullable', 'integer', 'min:1', 'max:5'],
|
||||
'timeliness_rating' => ['nullable', 'integer', 'min:1', 'max:5'],
|
||||
'body' => ['nullable', 'string'],
|
||||
]);
|
||||
|
||||
@@ -31,6 +37,17 @@ class ReviewController extends Controller
|
||||
]
|
||||
);
|
||||
|
||||
$reviewee = $request->user()->id === $workOrder->buyer_id
|
||||
? $workOrder->provider
|
||||
: $workOrder->buyer;
|
||||
|
||||
$reviewee->notify(new ExchangeEventNotification(
|
||||
'New review received',
|
||||
$request->user()->name.' reviewed a completed work order.',
|
||||
route('work-orders.show', $workOrder),
|
||||
'review_received'
|
||||
));
|
||||
|
||||
return redirect()->route('work-orders.show', $workOrder)->with('status', 'Review saved.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user