app/Http/Controllers/Admin/PostController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \App\Http\Requests\PostRequest  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(PostRequest $request)
    {
		$user_id = Sentinel::getUser()->id;
        $input = $request->except(['_token']);
		$data = array(
			'user_id' 	=> $user_id,
			'title'		=> trim($input['title']),
			'content'	=> $input['content']
		);
		$post = new Post();
		$post->savePost($data);
		$message = session()->flash('success', 'you have successfully added a new post.');
		return redirect()->route('admin.posts.index')->withFlashMessage($message);
    }
public function store ( PostRequest $ request ) { $ user_id = Sentinel :: getUser ( ) -> id ; $ input = $ request -> except ( [ '_token' ] ) ; $ data = array ( 'user_id' => $ user_id , 'title' => trim ( $ input [ 'title' ] ) , 'content' => $ input [ 'content' ] ) ; $ post = new Post ( ) ; $ post -> savePost ( $ data ) ; $ message = session ( ) -> flash ( 'success' , 'you have successfully added a new post.' ) ; return redirect ( ) -> route ( 'admin.posts.index' ) -> withFlashMessage ( $ message ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .