app/Http/Controllers/TaskController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $create_new_validator = $this->validator($request->all());
        if ($create_new_validator->fails()) {
            $this->throwValidationException(
                $request, $create_new_validator
                );
        } else {
            $task = new Task;
            $task->fecha            = $request->input('date');
            $task->hora_inicio      = $request->input('start_hour');
            $task->cant_horas       = $this->transformHours($request->input('hours'));
            $task->descripcion      = $request->input('description');
            $task->tipo             = $request->input('type');
            $task->client_id        = $request->input('client');
            $task->save();
            $user = User::find($request->input('admin'));
            $user->tasks()->save($task);
            return redirect('task')->with('status', 'Actividad creada éxitosamente!');
        }
    }
public function store ( Request $ request ) { $ create_new_validator = $ this -> validator ( $ request -> all ( ) ) ; if ( $ create_new_validator -> fails ( ) ) { $ this -> throwValidationException ( $ request , $ create_new_validator ) ; } else { $ task = new Task ; $ task -> fecha = $ request -> input ( 'date' ) ; $ task -> hora_inicio = $ request -> input ( 'start_hour' ) ; $ task -> cant_horas = $ this -> transformHours ( $ request -> input ( 'hours' ) ) ; $ task -> descripcion = $ request -> input ( 'description' ) ; $ task -> tipo = $ request -> input ( 'type' ) ; $ task -> client_id = $ request -> input ( 'client' ) ; $ task -> save ( ) ; $ user = User :: find ( $ request -> input ( 'admin' ) ) ; $ user -> tasks ( ) -> save ( $ task ) ; return redirect ( 'task' ) -> with ( 'status' , 'Actividad creada éxitosamente!') ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .
// THE SUCCESSFUL RETURN