Зачем вам 2 цикла, если данные отсортированы
$dishes = Dishe::whereIn('id', $dishesRequest->pluck('id'))->Active()->whereHas('menu', function ($query) {
return $query->where('project_id', $this->project->id)->Active();
})->get();
if ($dishesRequest->count() !== $dishes->count()) {
return $fail(__('validation.exists'));
}
$totalDishes = $dishes->sum('price');
$total = $this->order ? $totalDishes + $this->order->totalPrice : $totalDishes;
if ($total < 1 || $total > 150000) {
return $fail('Сумма заказа должна быть от 1 ₽ до 150 000 ₽');
}
composer install
php artisan migrate
php artisan passport:install
php artisan key:generate
php artisan storage:link