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)
    {
        $this->validate($request, [
        'newTaskName' => 'required|min:5|max:255',
        ]);
        $current_user = Auth::user();
        $task = new Task;
        $task->name = $request->newTaskName;
        $current_user->tasks()->save($task);
        return redirect()->route('tasks.index', [
            'id' => $current_user->id,
        ]);
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'newTaskName' => 'required|min:5|max:255' , ] ) ; $ current_user = Auth :: user ( ) ; $ task = new Task ; $ task -> name = $ request -> newTaskName ; $ current_user -> tasks ( ) -> save ( $ task ) ; return redirect ( ) -> route ( 'tasks.index' , [ 'id' => $ current_user -> id , ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .