/**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $viajes = Viaje::all();
     $viajes = Viaje::with('nave', 'destino')->get();
     $naves = Nave::all();
     return view('viajes', ['viajes' => $viajes, 'naves' => $naves]);
 }
Пример #2
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $datos = \App\Viaje::all();
     if (Auth::user()->type == 'comun') {
         return view('comun.create', compact('datos'));
     } else {
         if (Auth::user()->type == 'administrador') {
             return Redirect::to('admin');
         }
     }
 }
 public function crearTikets()
 {
     print "entro ";
     $viaje = Viaje::find(1);
     //	$tiket = new Tikets();
     //	$tiket->codigo = "t1001";
     //	$tiket->precio = 250.000;
     //	$tiket->estado = "libre";
     //	$viaje->Tikets()->save($tiket);
     return $viaje->Tikets;
 }
Пример #4
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     \App\Viaje::destroy($id);
     Session::flash('message', 'Viaje Eliminado Correctamente');
     return Redirect::to('/viaje');
 }
Пример #5
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     Viaje::create($request->all());
     Session::flash('message', 'Usuario Creado Correctamente');
     return Redirect::to('/viaje');
 }
Пример #6
0
 public function mfInsertTripIntoDB()
 {
     if (Request::ajax()) {
         parse_str(Input::get('formData'), $formFields);
         $viaje = new Viaje();
         $viaje->idHogar = Session::get('infoRoomie')[0]['myself'][0]->idHogar;
         $viaje->idResidente = Session::get('infoRoomie')[0]['myself'][0]->idResidente;
         $viaje->destino = $formFields['destino'];
         $viaje->fecha = $formFields['fecha'];
         $viaje->hora = $formFields['hora'];
         $viaje->detalles = $formFields['detalles'];
         $viaje->save();
         return array('title' => 'Trip planned!', 'text' => '"' . $viaje->destino . '" has been created', 'type' => 'success');
     }
 }