/** * Display a listing of the resource. * * @return Response */ public function index(Region $region, TrainRoad $trainRoad, Stantion $stantion) { $regionsCount = $region->count(); $tRoadsCount = $trainRoad->count(); $stationsCount = $stantion->count(); $condCount = Condition::count(); $productsCount = Product::count(); $servicesCount = Service::count(); $catCount = Category::count(); $statusesCount = Status::count(); $serviceStatusesCount = ServiceStatus::count(); $newOrdersCount = Order::where('is_new', 1)->count(); $newServiceOrdersCount = ServiceOrder::where('is_new', 1)->count(); $customers = Firm::where('accountant_fio', null)->get(); return view('admin.adminArea', ['regionsCount' => $regionsCount, 'tRoadsCount' => $tRoadsCount, 'stationsCount' => $stationsCount, 'condCount' => $condCount, 'catCount' => $catCount, 'productsCount' => $productsCount, 'servicesCount' => $servicesCount, 'statusesCount' => $statusesCount, 'newOrdersCount' => $newOrdersCount, 'serviceStatusesCount' => $serviceStatusesCount, 'newServiceOrdersCount' => $newServiceOrdersCount, 'customers' => $customers]); }
public function storeServiceOrder(ServiceOrder $serviceOrder, StoreServiceOrder $request) { $status = ServiceStatus::where('is_first', Order::IS_FIRST)->first(); $user = Auth::user(); $service = Service::find($request->service_id); $serviceOrder->service_status_id = $status->id; $serviceOrder->user_id = $user->id; $serviceOrder->firm_id = $user->firm->id; $serviceOrder->service_name = $service->short_name; $serviceOrder->service_price = $service->price; $serviceOrder->more_info = $request->more_info; if ($request->need_station) { $serviceOrder->station_names = $request->station_names; } $serviceOrder->save(); $messageParams['service'] = $serviceOrder; Bus::dispatch(new SendWithTanksForServiceOrder($messageParams)); return view('orders.serviceSuccess', ['p' => 'purchases', 'serviceName' => $service->short_name]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $status = ServiceStatus::find($id); $status->delete(); return back()->with('alert-success', 'Статус ' . $status->status . ' удален'); }