app/Http/Controllers/TweetController.php
/**
	 * Store a newly created resource in storage.
	 *
	 * @param Request $request
	 * @return Response
	 */
Store a newly created resource in storage.
@param Request $request
@return Response
Store a newly created resource in storage . @param Request $request @return Response
public function store(CreateTweetRequest $request)
	{
		$tweet = new Tweet();
			$tweet->title = $request->input("title");
    	    $tweet->body = $request->input("body");
    	    $tweet->user_id = Auth::user()->id;
		$tweet->save();
		Log::info(Auth::user()->username . " (" . Auth::user()->id . ") CREATED tweet (" . $tweet->id . ")\r\n",
			[$tweet = json_decode($tweet, true)]
		);
        Session::flash('success','The tweet was successfully added!');
		return redirect()->route('tweets.index');
	}
public function store ( CreateTweetRequest $ request ) { $ tweet = new Tweet ( ) ; $ tweet -> title = $ request -> input ( " title " ) ; $ tweet -> body = $ request -> input ( " body " ) ; $ tweet -> user_id = Auth :: user ( ) -> id ; $ tweet -> save ( ) ; Log :: info ( Auth :: user ( ) -> username . "  ( " . Auth :: user ( ) -> id . " ) CREATED tweet ( " . $ tweet -> id . " ) \r \n " , [ $ tweet = json_decode ( $ tweet , true ) ] ) ; Session :: flash ( 'success' , 'The tweet was successfully added!' ) ; return redirect ( ) -> route ( 'tweets.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
// Save entry to log file using built-in Monolog // set a flash message to be displayed on screen