app/Http/Controllers/PostsController.php
/**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
Show the form for creating a new resource.
@return \Illuminate\Http\Response
Show the form for creating a new resource . @return \ Illuminate \ Http \ Response
public function create()
    {
        $categories = Category::all();
        $tags = Tag::all();
        if($categories->count() == 0)
        {
            Session::flash('info', 'You must have some categories before attempting to create a post.');
            return redirect()->route('category.create');
        }
        if($tags->count() == 0)
        {
            Session::flash('info', 'You must have some tags before attempting to create a post.');
            return redirect()->route('tag.create');
        }
        return view('admin.posts.create')->with('categories', $categories)->with('tags', $tags);
    }
public function create ( ) { $ categories = Category :: all ( ) ; $ tags = Tag :: all ( ) ; if ( $ categories -> count ( ) == 0 ) { Session :: flash ( 'info' , 'You must have some categories before attempting to create a post.' ) ; return redirect ( ) -> route ( 'category.create' ) ; } if ( $ tags -> count ( ) == 0 ) { Session :: flash ( 'info' , 'You must have some tags before attempting to create a post.' ) ; return redirect ( ) -> route ( 'tag.create' ) ; } return view ( 'admin.posts.create' ) -> with ( 'categories' , $ categories ) -> with ( 'tags' , $ tags ) ; }
Show the form for creating a new resource.
Show the form for creating a new resource .