Ejemplo n.º 1
0
 /**
  * Define your route model bindings, pattern filters, etc.
  *
  * @param  \Illuminate\Routing\Router  $router
  * @return void
  */
 public function boot(Router $router)
 {
     //
     parent::boot($router);
     $router->bind('vehicles', function ($value) {
         return Vehicle::whereId($value)->allowed()->firstOrFail();
     });
     $router->model('logs', 'Fuellog\\Log');
 }
Ejemplo n.º 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  Vehicle $vehicle
  * @return Response
  */
 public function destroy(Vehicle $vehicle)
 {
     $message = "Your vehicle \"{$vehicle->name}\" was successfully deleted.";
     foreach ($vehicle->logs as $log) {
         $log->delete();
     }
     $vehicle->delete();
     return redirect()->route('home')->withMessage($message);
 }
Ejemplo n.º 3
0
 protected function showDashboard()
 {
     $vehicles = Vehicle::allowed()->get();
     return view('dashboard', compact('vehicles'));
 }
Ejemplo n.º 4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Vehicle $vehicle)
 {
     $logs = $vehicle->logs()->latest()->get();
     return view('vehicles.logs.index', compact('logs'));
 }