Laravel Project Example

Hello Coders, today we develop the laravel crud application with laravel letest version larave 5.7.
Step 1 : First we install the laravel package using below command,

On this command we get laravel letest version because we not define the version of the laravel on the installation command, if we added the version on the command, command look like this,

If you want to know about how you can setup a existing laravel project see this link Click Here

Step 2: On second step we configure the database file name .env file, which is stored in Laravel project root directory.
Sometimes this file named as .env.example, so not confused do one thing that make a copy of that file and save with .env.

.env

Step 3: On this step we create a table on database.

we are going rto craete a crud proect for users, means Users data crud application. So very first run theis command on you terminal or gitbash( for windows ).

After run this command you will find a file on following path: database/migrations. And you have to put below file on the migration file for create a users table

After creting this file you the laravel migration command which is use for migrating the table on phpmyadmin database. Command is in below line,

Step 4: Now we creating a route file for Route the URL or controller function.

So first we add resource root for Users crud project, open path: routes/web.php and add below route code.

routes/web.php

Step 5: Now we Create Controller and Model

In this step first we create a controller named UsersController. For automatic creation we runt the below command,

On this command after resource part we create a model, this part “–resource –model=Users

After bellow command we will find controller file in this path: app/Http/Controllers/UsersController.php.

Laravel have some methods for creating crud application, some are as follows on the below code,

So, copy the below code on UsersController.php file.

app/Http/Controllers/UsersController.php

Ok, now open Users.php file and copy below code:

path: app/Users.php

On next we create designing files, laravel use Blade template engine for creating design files like below which i defined.

Step 6: Creating design files using Blade template engine.(layout file)

In last step. In this step we have to create just blade files. So mainly we have to create layout file and then create new folder “users” then create blade files of crud app. So finally you have to create following bellow blade file:

Blade Files: layout.blade.php, index.blade.php, create.blade.php, edit.blade.php, show.blade.php

So now create these files and put below code.

path: resources/views/Users/layout.blade.php

 

resources/views/Userss/index.blade.php

 

resources/views/Users/create.blade.php

 

resources/views/Users/edit.blade.php

 

resources/views/Users/show.blade.php

Now we complete the Crud project on laravel 5.7, open gitbash or terminal and run below command,

Open below URL on your browser:

http://localhost:8000/Users

Was this article helpful?
YesNo

By Bikash

My name is Bikash Kr. Panda. I own and operate PHPCODER.TECH. I am a web Programmer by profession and working on more than 50 projects to date. Currently I am working on the web-based project and all the CMS and frameworks which are based on PHP.

2 thoughts on “Laravel 5.7 CRUD application”

Leave a Reply

Your email address will not be published. Required fields are marked *