app/Http/Controllers/ObjetivoController.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)
    {
        $data=$request->all();
        $data['usuario_id']=Auth::user()->id;
        $objetivo = Objetivo::create($data);
        if ($request->is('api/*')) {
            return $objetivo;
        }
        return redirect()->route('objetivos.index');
    }
public function store ( Request $ request ) { $ data = $ request -> all ( ) ; $ data [ 'usuario_id' ] = Auth :: user ( ) -> id ; $ objetivo = Objetivo :: create ( $ data ) ; if ( $ request -> is ( 'api/*' ) ) { return $ objetivo ; } return redirect ( ) -> route ( 'objetivos.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .