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)
    {
        $task = Task::create($request->all());
        if ($task) {
            $tasks = Task::all();
            return response()->json($tasks);
        }
    }
public function store ( Request $ request ) { $ task = Task :: create ( $ request -> all ( ) ) ; if ( $ task ) { $ tasks = Task :: all ( ) ; return response ( ) -> json ( $ tasks ) ; } }
Store a newly created resource in storage.
Store a newly created resource in storage .