Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $maestro = Maestro::create($request->all());
     $telefono = new Telefono();
     $telefono->numero_telefono = $request['numero_telefono'];
     $telefono->maestro_id = $maestro->id;
     $telefono->save();
     return redirect('/maestros')->with('message', 'store');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     $maestro = Maestro::create($request->all());
     $carbon = new Carbon();
     $date = $carbon->now()->year - 2000;
     $codigo = $maestro->id + 100;
     $maestro->codigo = "cat-" . $codigo . "" . $date;
     $maestro->save();
     $telefono = new Telefono();
     $telefono->numero_telefono = $request['numero_telefono'];
     $telefono->maestro_id = $maestro->id;
     $telefono->save();
     return redirect('/maestros')->with('message', 'store');
 }