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(CreateTaskRequest $request)
    {
        $task = new Task;
            $task->user_id = Auth::user()->id;
            $task->name = $request->name;
        $task->save();
        Log::info(Auth::user()->username . " (" . Auth::user()->id . ") CREATED task (" . $task->id . ")\r\n", 
            [json_decode($task, true)]
        );
        Session::flash('success','New task added successfully!');
        return redirect()->route('tasks.index');
    }
public function store ( CreateTaskRequest $ request ) { $ task = new Task ; $ task -> user_id = Auth :: user ( ) -> id ; $ task -> name = $ request -> name ; $ task -> save ( ) ; Log :: info ( Auth :: user ( ) -> username . "  ( " . Auth :: user ( ) -> id . " ) CREATED task ( " . $ task -> id . " ) \r \n " , [ json_decode ( $ task , true ) ] ) ; Session :: flash ( 'success' , 'New task added successfully!' ) ; return redirect ( ) -> route ( 'tasks.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// Save entry to log file using built-in Monolog