/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $vehiculo = Vehiculo::find($id);
     if (!$vehiculo) {
         return response()->json(['mensaje' => 'No se encuentra este vehiculo', 'codigo' => 404], 404);
     }
     return response()->json(['datos' => $vehiculo], 202);
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $cantidad = Fabricante::all()->count();
     for ($i = 0; $i < 50; $i++) {
         Vehiculo::create(['color' => $faker->safeColorName(), 'cilindraje' => $faker->randomFloat(), 'potencia' => $faker->randomNumber(), 'peso' => $faker->randomFloat(), 'fabricante_id' => $faker->numberBetween(1, $cantidad)]);
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $vehiculo = Vehiculo::find($id);
     if (!$vehiculo) {
         return response()->json(['msg' => 'No se encuentra el vehiculo', 'status' => 404], 404);
     }
     return response()->json(['data' => $vehiculo], 200);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $vehiculo = Vehiculo::find($id);
     if (!$vehiculo) {
         return response()->json(['message' => 'No se encuentra este vehiculo'], 404);
     }
     return response()->json(['data' => $vehiculo], 200);
 }
 public function show($id)
 {
     $vehiculo = Vehiculo::find($id);
     if (!$vehiculo) {
         return response()->json(['mensaje' => 'No se encontro el vehiculo de id: ' . $id, 'codigo' => 404], 404);
     } else {
         return response()->json(['dato' => $vehiculo, 'codigo' => 202], 202);
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $vehiculo = Vehiculo::find($id);
     if (!$vehiculo) {
         return response()->json(['data' => 'No se encuentra el vehiculo con id ' . $id], '404');
     } else {
         return response()->json(['data' => $vehiculo], 200);
     }
 }
 public function listado($propietario)
 {
     $vehiculo = Vehiculo::all();
     return view("propietario.listavehiculos")->with("vehiculos", $vehiculo)->with("propietario", $propietario);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $vehiculos = Vehiculo::all();
     $conductore = Conductor::find($id);
     return view("conductor.edit")->with("conductore", $conductore)->with('vehiculos', $vehiculos);
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $data = Vehiculo::all();
     $res = ['data' => $data];
     return response()->json($res, 200);
 }