Posts

Showing posts with the label resource controller

Laravel with MongoDB CURD operations - part 2

Image
We will create simple page with posts. This is our post structure. PostController Post model inside views/posts folder     index.blade     add.blade     edit.blade Create controller using following command. php artisan make:controller PostController -- resource Then you can get PostController in your controller folder with method for show,add,edit, delete and update.Open that controller we are going to add some data to mongodb collection. Inside your PostController fill the create method by returning the add view. Your method now looks like this.     /**      * Show the form for creating a new resource.      *      * @return \Illuminate\Http\Response      */     public function create()     {         return view('posts.add');     } Now you need to add route for view add add page. Go to routes/web.php file a...