Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['name' => 'required', 'short_name' => 'required']);
     if ($validator->fails()) {
         //return redirect()->back()->withErrors($validator)->withInput();
         return redirect()->route('syndicates.create')->withErrors($validator)->withInput();
     }
     $syndicate = new Syndicate();
     $syndicate->name = $request->input('name');
     $syndicate->short_name = mb_strtoupper($request->input('short_name'), 'UTF-8');
     $syndicate->save();
     return redirect()->route('syndicates.index');
 }
Ejemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     //$employee = $this->employee->query()->find($id);
     //$employee = Employee::find($id);
     $employee = $this->employee->find($id);
     $payrolls = Payroll::all();
     $syndicates = Syndicate::all();
     if (empty($employee)) {
         Flash::error('Registro no encontrado');
         return redirect(route('employee.index'));
     }
     return view('employee.edit', ['employee' => $employee, 'payrolls' => $payrolls, 'syndicates' => $syndicates]);
 }
Ejemplo n.º 3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Syndicate::create(["name" => "Sindicato de trabajadores de la Cámara de Senadores", "short_name" => "STCS"]);
     Syndicate::create(["name" => "Sindicato de trabajadores de la H. Cámara de Senadores", "short_name" => "STHCS"]);
     Syndicate::create(["name" => "Sindicato Independiente de la Cámara de Senadores", "short_name" => "SITCS"]);
 }