Generate and Run Laravel Files

This tutorial is about generating Laravel files (Controller, Model and view files) for database table .

What is Laravel?

Laravel is a PHP web application framework. A web framework provides a structure and starting point for creating your web application. Laravel is very handy and easy to use framework.

What can Sohag Builder for Laravel developers ?

Sohag Builder can help Laravel developers to create database tables and generate the required files to manipulate data in the table.


This tutorial requires following create web php project first

The last step of the previous tutorial of create web PHP project, was saving our project.

  • Press on the arrow in the generate list to open the list.
  • Select Laravel generator and hit it.

Sohag Builder create a laravel or web php bootstrap curd application

Sohag Builder will generate Controller and Model files in the project path and   one directory containing four view files for each class in the project as the following.

  • ItemController.php (the controller file).
  • Item.php  (the model file).

 sohag builder generate laravel php framework

items directory  containing the following blade view files.

  • create.blade.php
  • edit.blade.php
  • index.blade.php
  • show.blade.php

 sohag builder generate laravel php framework


The generated files are compatible with Laravel 8.

File ItemController.php (the controller file)

Item.php  (the model file).





Deploy the project to Laravel application.

Now we are going to transfer the files to our Laravel project and execute them. Sohag Builder generate files for Laravel 8.

  • Copy the controller file (ItemController.php) to path-to-laravel-project/app/Http/Controllers.
  • Copy the model file (Item.php) to path-to-laravel-project/app/Models.
  • Copy the views folder (items) to path-to-laravel-project/resources/views.
  • Edit  path-to-laravel-project/routes/web.php file to add a new route for our Class by adding the following lines to it.

Add this line in the use section at the top of web.php file.

use App\Http\Controllers\ItemController;

Add this line in the route section at the bottom of web.php file.


The following images demonstrate the generated web pages after deploying to Laravel application.

The index page.

sohag builder laravel index page


By default the remove button will be placed at the bottom of View and Edit buttons, you may use the following css code to display it in the same line

.delete-form {display: inline}

Create new item page.

sohag builder laravel create page

Edit item page.

sohag builder laravel edit page

Show item page.

sohag builder laravel show page

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
1 + 11 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.