CRUD through AJAX using Laravel framework

Step 1 : create project folder through command line

composer create-project laravel/laravel AjaxCrud

Step 2 : Create Post table and model

php artisan make:model Posts -m

under this :- database/migrations, you have to put bellow code in your migration file for create Posts table

After create “Posts” table you should create post model for posts, so first create file in this path app/Post.php and put bellow content in post.php

Post model : app\post.php

Step 3: Add Route  

Post route : routes\web.php

Step 4: Create a new Controllers 

Run this command to Create a new Controller

php artisan make:controller PostController

Controlllers : app\http\controllers\PostController

Step 5 : Create a new Blade File

View : resources\views\post\index.blade.php

Step 6: Create JS and CSS File

View : resources\views\layouts\app.blade.php

now in terminal write php artisan serve

Now open browser and paste the following link

Leave a Reply