Create Routes

routes/web.php : In next step, we will add new two routes in web.php file.

Route::get('/', function () {
    return view('registration');
Route::post('crud_insert', 'CrudController@save');

Creating The CrudController

Create a controller file CrudController.php and save it in the following path app/Http/Controllers/CrudController.php.


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\CrudModel;

class CrudController extends Controller
    function crud(){
        $data['data'] = CrudModel::all();
        return view('crud',$data);
    function save(Request $req){
        $data = new CrudModel;
        $data->name = $req->name;
        $data->email = $req->email;
        $data->password = $req->pwd;
        return back()
            ->with("status","Insert Successfully.");

Creating The CrudModel

Create a controller file CrudModel.php and save it in the following path app/CrudModel.php.


namespace App;

use Illuminate\Database\Eloquent\Model;

class CrudModel extends Model
    protected $table = 'demo';
    public $timestamps = false;

Creating The View

Create a view file crud.blade.php and save the below code it in resources/views/crud.blade.php.

<!DOCTYPE html>
<html lang="en">
  <title>Crud Form</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="">
  <link rel="stylesheet" href="">
  <link rel="stylesheet" href="">
  <script src=""></script>
  <script src=""></script>
  <script src=""></script>
  <script src=""></script>

<div class="container-fluid mt-5">
    <h1 class="text-center">Crud Form</h1>
    <div class="row">
        <div class="col-md-2"></div>
        <div class="col-md-8">
            <table class="table table-dark table-striped mt-3">
                        @foreach($data as $crud)
                    <td>{{ $crud->name }}</td>
                    <td>{{ $crud->email }}</td>
                    <td>{{ $crud->password }}</td>

Let us execute this example by the following URL in the browser. This URL may be different based on your website.