Laravel Multiple Input Array Crud

Another Tutorials LINK

Index.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<style>

</style>
</head>
<body>
    <form action="/salesorder" method="post">
        @csrf
    

<div class="container">
    <div class="panel panel-default" style="background-color: #CCC">
        <div class="panel-body">
                <div class="col-sm-6"> <!-- FIRST COLUMN -->
            <!--------------------------------- Customer Code -------------------------------------------->
            <div class="form-group">
                <label for="" class="col-sm-4 control-label">Customer</label>
                <div class="col-sm-8">
                <input type="text" class="form-control" id="" name="CardCode"  placeholder="">
                </div>
            </div>
    
            <!--------------------------------- Customer Name -------------------------------------------->
            <div class="form-group">
                <label for="" class="col-sm-4 control-label"> Name</label>
                <div class="col-sm-8">
                <input type="text" class="form-control" id="" name="CardName" placeholder="">
                </div>
            </div>
            
                </div>
                <div class="col-sm-6"> <!-- Second COLUMN -->
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label"> Contact Person</label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="CntctCode" placeholder="">
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label"> Pi No</label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="NumAtCard" placeholder="">
                        </div>
                    </div>
                </div>

                <div class="col-sm-6"> <!-- Third COLUMN -->
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label"> Currency</label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="DocCur" placeholder="">

                    </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Series </label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="Series" placeholder="">
                        </div>
                    </div>
                </div>

                <div class="col-sm-6"> <!-- Four COLUMN -->
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label"> So </label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="DocNum" placeholder="">

                    </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Date </label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="DocDueDate" placeholder="">
                        </div>
                    </div>
                </div>

                <div class="col-sm-6"> <!-- Five COLUMN -->
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label"> Delivery Date </label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="TaxDate" placeholder="">

                    </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Marketing </label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="SlpCode" placeholder="">
                        </div>
                    </div>
                </div>

                <div class="col-sm-6"> <!-- Six COLUMN -->
                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label"> Usd Rate </label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="DocRate" placeholder="">

                    </div>
                    </div>

                    <div class="form-group">
                        <label for="" class="col-sm-4 control-label">Owner </label>
                        <div class="col-sm-8">
                        <input type="text" class="form-control" id="" name="Owner" placeholder="">
                        </div>
                    </div>
                </div>
        </div>
    </div><!-- END PANEL -->
</div>


<h1>Sales Order</h1>

 
   
       
       


            <table class="table table-light " id="myTable">
                <thead class="thead-light">
                    <tr>
                        <th>#</th>
                        <th>Item No</th>
                        <th>Qty</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td></td>
                        <td><input type="text" name="itemno[]" id=""></td>
                        <td><input type="text" name="Quantity[]" id=""></td>
                        <td><input type="text" name="Amount[]" id=""></td>
                        <td><input type="text" name="Color[]" id=""></td>
                        <td><input type="text" name="Style[]" id=""></td>
                        <td><input type="text" name="ItemRef[]" id=""></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><input type="text" name="itemno[]" id=""></td>
                        <td><input type="text" name="Quantity[]" id=""></td>
                        <td><input type="text" name="Amount[]" id=""></td>
                        <td><input type="text" name="Color[]" id=""></td>
                        <td><input type="text" name="Style[]" id=""></td>
                        <td><input type="text" name="ItemRef[]" id=""></td>
                    </tr>
                </tbody>
                <tfoot>
                    <tr>
                        <th>#</th>
                    </tr>
                </tfoot>
            </table>
     
    
        <button class="btn-primary">Save</button>
        </form>
    </div>
</body>
<script>

</script>
</html>

SalesController.php

<?php

namespace App\Http\Controllers;

use App\SalesOrder;
use App\SalesItem;
use Illuminate\Http\Request;

class SalesOrderController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //

        $sales = new SalesOrder();
        $sales->CardCode = $request->CardCode;
        $sales->CardName = $request->CardName;
        $sales->CntctCode = $request->CntctCode;
        $sales->NumAtCard = $request->NumAtCard;
        $sales->DocCur = $request->DocCur;
        $sales->DocRate = $request->DocRate;
        $sales->Series = $request->Series;
        $sales->DocNum = $request->DocNum;
        $sales->DocDueDate = $request->DocDueDate;
        $sales->TaxDate = $request->TaxDate;
        $sales->SlpCode = $request->SlpCode;
        $sales->Owner = $request->Owner;
        $id = $sales->save();

        foreach ($request->itemno as $key => $val){
            $data = array("ItemCode"=>$request->itemno[$key],"Quantity"=>$request->Quantity[$key],"Amount"=>$request->Amount[$key],"Color"=>$request->Color[$key],"Style"=>$request->Style[$key],"ItemRef"=>$request->ItemRef[$key]);
            SalesItem::insert( $data);
        }

        

    }

    /**
     * Display the specified resource.
     *
     * @param  \App\SalesOrder  $salesOrder
     * @return \Illuminate\Http\Response
     */
    public function show(SalesOrder $salesOrder)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\SalesOrder  $salesOrder
     * @return \Illuminate\Http\Response
     */
    public function edit(SalesOrder $salesOrder)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\SalesOrder  $salesOrder
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, SalesOrder $salesOrder)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\SalesOrder  $salesOrder
     * @return \Illuminate\Http\Response
     */
    public function destroy(SalesOrder $salesOrder)
    {
        //
    }
}

SalesItemController.php

<?php

namespace App\Http\Controllers;

use App\SalesItem;
use Illuminate\Http\Request;

class SalesItemController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\SalesItem  $salesItem
     * @return \Illuminate\Http\Response
     */
    public function show(SalesItem $salesItem)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\SalesItem  $salesItem
     * @return \Illuminate\Http\Response
     */
    public function edit(SalesItem $salesItem)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\SalesItem  $salesItem
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, SalesItem $salesItem)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\SalesItem  $salesItem
     * @return \Illuminate\Http\Response
     */
    public function destroy(SalesItem $salesItem)
    {
        //
    }
}

SalesOrderController

<?php

namespace App\Http\Controllers;

use App\SalesOrder;
use App\SalesItem;
use Illuminate\Http\Request;

class SalesOrderController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //

        $sales = new SalesOrder();
        $sales->CardCode = $request->CardCode;
        $sales->CardName = $request->CardName;
        $sales->CntctCode = $request->CntctCode;
        $sales->NumAtCard = $request->NumAtCard;
        $sales->DocCur = $request->DocCur;
        $sales->DocRate = $request->DocRate;
        $sales->Series = $request->Series;
        $sales->DocNum = $request->DocNum;
        $sales->DocDueDate = $request->DocDueDate;
        $sales->TaxDate = $request->TaxDate;
        $sales->SlpCode = $request->SlpCode;
        $sales->Owner = $request->Owner;
        $id = $sales->save();

        foreach ($request->itemno as $key => $val){
            $data = array("ItemCode"=>$request->itemno[$key],"Quantity"=>$request->Quantity[$key],"Amount"=>$request->Amount[$key],"Color"=>$request->Color[$key],"Style"=>$request->Style[$key],"ItemRef"=>$request->ItemRef[$key]);
            SalesItem::insert( $data);
        }

        

    }

    /**
     * Display the specified resource.
     *
     * @param  \App\SalesOrder  $salesOrder
     * @return \Illuminate\Http\Response
     */
    public function show(SalesOrder $salesOrder)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\SalesOrder  $salesOrder
     * @return \Illuminate\Http\Response
     */
    public function edit(SalesOrder $salesOrder)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\SalesOrder  $salesOrder
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, SalesOrder $salesOrder)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\SalesOrder  $salesOrder
     * @return \Illuminate\Http\Response
     */
    public function destroy(SalesOrder $salesOrder)
    {
        //
    }
}

SalesOrder Migration File

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSalesOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sales_orders', function (Blueprint $table) {
            $table->id();
            $table->string('CardCode');
            $table->string('CardName');
            $table->string('CntctCode');
            $table->string('NumAtCard');
            $table->string('DocCur');
            $table->string('DocRate');
            $table->string('Series');
            $table->string('DocNum');
            $table->date('DocDueDate');
            $table->date('TaxDate');
            $table->timestamps();
            $table->string('SlpCode');
            $table->string('Owner');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sales_orders');
    }
}

SalesItem Migration File

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSalesItemsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sales_items', function (Blueprint $table) {
            $table->id();
            $table->string('ItemCode');
            $table->string('Quantity');
            $table->string('Amount');
            $table->string('Color');
            $table->string('Style');
            $table->string('ItemRef');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sales_items');
    }
}

SalesItem Model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class SalesItem extends Model
{
    //
    protected $table = "sales_items";
    protected $fillable = ['ItemCode','Quantity','Amount','Color','Style','ItemRef'];
}

SalesOrder model

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class SalesOrder extends Model
{
    //
    protected $table = "sales_orders";
    protected $fillable = ['CardCode','CardName','CntctCode','NumAtCard','DocCur','DocRate','Series','DocNum','DocDueDate','TaxDate','SlpCode','Owner'];
}

āϞāĻžāϰāĻžāϭ⧇āϞ āĻ reactjs āύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰāĻž

āϞāĻžāϰāĻžāϭ⧇āϞ āĻ reactjs āύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰāĻž :

Download Laravel7 & laravel7react boilarpalte

reactjs āĻāϰ āĻ…āύāϞāĻžāχāύ āϟ⧁āϞ :āĻ…āύ⧇āĻ• āϏāĻŽā§Ÿ html āϕ⧋āĻĄā§‡āϕ⧇ reactjs āĻāϰ jsx āĻ āĻ•āύāĻ­āĻžāĻ°ā§āϟ āĻ•āϰāĻžāϰ āĻĻāϰāĻ•āĻžāϰ āĻšā§Ÿ āφāĻŦāĻžāϰ css āϕ⧇ react āĻ āĻ­ā§āϝāĻžāϞāĻŋāĻĄ āĻ­āĻžāĻŦ⧇ āϞāĻŋāĻ–āĻžāϰ āϜāĻ¨ā§āϝ āĻāĻžāĻŽā§‡āϞāĻžā§Ÿ āĻĒ⧜āϤ⧇ āĻšā§Ÿ āϤāĻ–āύ āφāĻŽāϰāĻž āύāĻŋāĻšā§‡āϰ āϟ⧁āϞ āϗ⧁āϞ⧋ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāĻŦā§‹āĨ¤ htmltojsx āĻāĻ¨ā§āĻĄ css to reactjs

āĻ­āĻŋāĻœā§āϝ⧁⧟āĻžāϞ āĻˇā§āϟ⧁āĻĄāĻŋāĻ“ āϕ⧋āĻĄ āĻ āϤāĻžā§œāĻžāϤāĻžā§œāĻŋ reactjs āϕ⧋āĻĄ āϞāĻŋāĻ–āĻžāϰ āϜāĻ¨ā§āϝ āφāĻŽāϰāĻž reactjs āĻ¸ā§āύāĻŋāĻĒ⧇āϟ āĻāĻ•ā§āϏāĻŸā§‡āύāĻļāύāϟāĻŋ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻŦā§‹ āϤāĻžāĻšāϞ⧇ āϝāĻĻāĻŋ āϕ⧋āύ⧋ āĻ•ā§āϞāĻžāϏ āϤ⧈āϰ⧀ āĻ•āϰāϤ⧇ āϚāĻžāχ āϤāĻŦ⧇ rcc āϞāĻŋāĻ–āϞ⧇ āϏāĻŽā§āĻĒā§‚āĻ°ā§āĻŖ āĻāĻ•āϟāĻŋ āĻ•ā§āϞāĻžāϏ āϤ⧈āϰ⧀ āĻšā§Ÿā§‡ āϝāĻžāĻŦ⧇ āφāϰ āĻĢāĻžāĻ™ā§āĻ•āĻļāύ āϞāĻŋāĻ–āϤ⧇ āϚāĻžāχāϞ⧇ rrc āϞāĻŋāĻ–āϞ⧇ āϏāĻŽā§āĻĒā§‚āĻ°ā§āĻŖ āĻāĻ•āϟāĻŋ āĻĢāĻžāĻ™ā§āĻ•āĻļāύ āϤ⧈āϰ⧀ āĻšā§Ÿā§‡ āϝāĻžāĻŦ⧇āĨ¤

  • ā§§.āĻĒā§āϰāĻĨāĻŽā§‡ php ā§­.⧍ āĻ­āĻžāĻ°ā§āϏāύ āĻāϰ āχāύāϭ⧇āϰāύāĻŽā§‡āĻ¨ā§āϟ āϤ⧈āϰ⧀ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤ āĻāϜāĻ¨ā§āϝ āφāĻŽāϰāĻž Xamp,Wamp ,Uwamp ,Usbwebserver āĻŦāĻž āĻ…āĻ¨ā§āϝ āϝ⧇āϕ⧋āύ⧋ āωāĻĒāĻžā§Ÿā§‡ āφāĻŽāĻžāĻĻ⧇āϰ āϏāĻŋāĻ¸ā§āĻŸā§‡āĻŽ āĻ php āϕ⧋āĻĄ āϰāĻžāύ āĻ•āϰāĻžāϰ āĻĒāϰāĻŋāĻŦ⧇āĻļ āϤ⧈āϰ⧀ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŋāĨ¤
  • ⧍.Composer āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āĻāĻŦāĻ‚ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻžāϰ āϏāĻŽā§Ÿ āĻ…āĻŦāĻļā§āϝāχ āχāĻ¨ā§āϟāĻžāϰāύ⧇āϟ āĻ•āĻžāύ⧇āĻ•āĻļāύ āϞāĻžāĻ—āĻŦ⧇ āĻāĻŦāĻ‚ php.exe āĻĢāĻžāχāϞāϟāĻŋ āχāύāĻ¸ā§āϟāϞ āĻāϰ āϏāĻŽā§Ÿ āĻĻ⧇āĻ–āĻŋā§Ÿā§‡ āĻĻāĻŋāϤ⧇ āĻšāĻŦ⧇āĨ¤
  • ā§Š.Nodejs āĻāϰ āϰ⧇āϕ⧋āĻŽā§‡āĻ¨ā§āĻĄā§‡āĻĄ āĻ­āĻžāĻ°ā§āϏāύ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇
  • ā§Ē.āϞāĻžāϰāĻžāϭ⧇āϞ āĻ āĻāĻ•āϟāĻŋ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āϤ⧈āϰ⧀ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āĻāϜāĻ¨ā§āϝ cli āĻŦāĻž comand prump āĻ āĻāχ āϕ⧋āĻĄ āϟāĻŋ āϰāĻžāύ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ : composer create-project –prefer-dist laravel/laravel projectname āĻāĻŦāĻ‚ āχāĻ¨ā§āϟāĻžāϰāύ⧇āϟ āϏāĻ‚āϝ⧋āĻ— āϏāĻšāĻ•āĻžāϰ⧇ āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ āĻ…āĻĒ⧇āĻ•ā§āώāĻž āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āϝāϤāĻ•ā§āώāĻŖ āĻĒāĻ°ā§āϝāĻ¨ā§āϤ āϞāĻžāϰāĻžāϭ⧇āϞ āĻ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āϤ⧈āϰ⧀ āĻ•āĻŽāĻĒā§āϞāĻŋāϟ āĻšā§ŸāĨ¤ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āϤ⧈āϰ⧀ āĻ•āĻŽāĻĒā§āϞāĻŋāϟ āĻšāϞ⧇ āϏāĻŦ⧁āϜ āĻ•āĻžāϞāĻžāϰ⧇ successfull āϞāĻŋāĻ–āĻž āφāϏāĻŦ⧇āĨ¤
  • ā§Ģ.āϞāĻžāϰāĻžāϭ⧇āϞ ā§­ āĻ reactjs āύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āĻĒā§āϰāĻĨāĻŽā§‡ āĻāχ āϕ⧋āĻĄ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻ āĻ•āĻŽā§āϝāĻžāĻ¨ā§āĻĄ āĻĒāϰāĻžāĻŽā§āĻĒ āĻāϰ āĻŽāĻžāĻĻā§āϧāĻŽā§‡ āϰāĻžāύ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ : composer require laravel/ui āĻāĻŦāĻ‚ āχāĻ¨ā§āϟāĻžāϰāύ⧇āϟ āϏāĻ‚āϝ⧋āĻ— āϏāĻšāĻ•āĻžāϰ⧇ āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ āĻ…āĻĒ⧇āĻ•ā§āώāĻž āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āϝāϤāĻ•ā§āώāĻŖ āĻĒāĻ°ā§āϝāĻ¨ā§āϤ āĻ•āĻŽāĻĒā§āϞāĻŋāϟ āύāĻž āĻšā§ŸāĨ¤
  • ā§Ŧ.āĻāĻŦāĻžāϰ āĻāχ āϕ⧋āĻĄ āϟāĻŋ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĒā§āϰ⧌āĻŽā§āĻĒ āĻāϰ āϰāĻžāύ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ :php artisan ui react āĻāĻŦāĻ‚ āχāĻ¨ā§āϟāĻžāϰāύ⧇āϟ āϏāĻ‚āϝ⧋āĻ— āϏāĻšāĻ•āĻžāϰ⧇ āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ āĻ…āĻĒ⧇āĻ•ā§āώāĻž āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āϝāϤāĻ•ā§āώāĻŖ āĻĒāĻ°ā§āϝāĻ¨ā§āϤ āĻ•āĻŽāĻĒā§āϞāĻŋāϟ āύāĻž āĻšā§ŸāĨ¤
  • ā§­.āĻāĻŦāĻžāϰ āĻāχ āϕ⧋āĻĄ āϟāĻŋ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĒā§āϰ⧌āĻŽā§āĻĒ āĻāϰ āϰāĻžāύ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ :npm install āĻāĻŦāĻ‚ āχāĻ¨ā§āϟāĻžāϰāύ⧇āϟ āϏāĻ‚āϝ⧋āĻ— āϏāĻšāĻ•āĻžāϰ⧇ āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ āĻ…āĻĒ⧇āĻ•ā§āώāĻž āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āϝāϤāĻ•ā§āώāĻŖ āĻĒāĻ°ā§āϝāĻ¨ā§āϤ āĻ•āĻŽāĻĒā§āϞāĻŋāϟ āύāĻž āĻšā§ŸāĨ¤
  • ā§Ž.āĻāĻŦāĻžāϰ āĻāχ āϕ⧋āĻĄ āϟāĻŋ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĒā§āϰ⧌āĻŽā§āĻĒ āĻāϰ āϰāĻžāύ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ :npm run devāĻāĻŦāĻ‚ āχāĻ¨ā§āϟāĻžāϰāύ⧇āϟ āϏāĻ‚āϝ⧋āĻ— āϏāĻšāĻ•āĻžāϰ⧇ āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ āĻ…āĻĒ⧇āĻ•ā§āώāĻž āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āϝāϤāĻ•ā§āώāĻŖ āĻĒāĻ°ā§āϝāĻ¨ā§āϤ āĻ•āĻŽāĻĒā§āϞāĻŋāϟ āύāĻž āĻšā§ŸāĨ¤
  • ⧝.āĻāĻŦāĻžāϰ āĻāχ āϕ⧋āĻĄ āϟāĻŋ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĒā§āϰ⧌āĻŽā§āĻĒ āĻāϰ āϰāĻžāύ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ : php artisan serve
  • ā§§ā§Ļ.āĻāĻŦāĻžāϰ āĻŦā§āϰāĻžāωāϜāĻžāϰ āĻ http://127.0.0.1:8000/ āĻāχ āϞāĻŋāĻ‚āĻ• āϟāĻŋ āϤ⧇ āϗ⧇āϞ⧇ āφāĻŽāϰāĻž āφāĻŽāĻžāĻĻ⧇āϰ āϞāĻžāϰāĻžāϭ⧇āϞ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟāϟāĻŋ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāĻŦā§‹

ā§§ā§§.āφāĻŽāϰāĻž āĻāĻŦāĻžāϰ āĻāχ āĻ­āĻŋāω āϕ⧇ REACT āĻĻā§āĻŦāĻžāϰāĻž āĻĒāϰāĻŋāĻŦāĻ°ā§āϤāύ āĻ•āϰāĻŦā§‹ āĻāϜāĻ¨ā§āϝ resources/js/components/ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ āĻŽāĻ§ā§āϝ⧇ index.js āύāĻžāĻŽ āĻ āĻāĻ•āϟāĻŋ āĻĢāĻžāχāϞ āϤ⧈āϰ⧀ āĻ•āϰāĻŦā§‹āĨ¤
⧧⧍. resources/js/components/ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ Example.js āĻĢāĻžāχāϞ āĻāϰ āϏāĻŦ āĻ•āĻĒāĻŋ āĻ•āϰ⧇ index.js āĻĢāĻžāχāϞ āĻ āĻĒ⧇āĻ¸ā§āϟ āĻ•āϰ⧇ āĻ•āĻŋāϛ⧁ āĻĒāϰāĻŋāĻŦāĻ°ā§āϤāύ āĻ•āϰāĻŦā§‹āĨ¤
ā§§ā§Š. resources/js/App.js āĻĢāĻžāχāϞ āĻ index.js āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ āϟāĻŋ āĻ…ā§āϝāĻžāĻĄ āĻ•āϰāĻŦā§‹ āĻāχ āϕ⧋āĻĄ āĻĻāĻŋā§Ÿā§‡ :require(‘./components/index’);
ā§§ā§Ē. āĻāĻŦāĻžāϰ āφāĻŽāϰāĻž view āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ welcome āĻĢāĻžāχāϞ āϕ⧇ āĻāĻĄāĻŋāϟ āĻ•āϰāĻŦā§‹ āĻāϜāĻ¨ā§āϝ html āĻŦāĻĄāĻŋ āĻļ⧇āώ āĻšāĻ“ā§ŸāĻžāϰ āĻĒāϰ App.js āĻĢāĻžāχāϞ āϜāĻžāĻ­āĻžāĻ¸ā§āĻ•ā§āϰāĻŋāĻĒā§āϟ āĻĢāĻžāχāϞ āĻšāĻŋāϏāĻžāĻŦ⧇ āĻ…ā§āϝāĻžāĻĄ āĻ•āϰāĻŦā§‹ āĻāĻ­āĻžāĻŦ⧇


ā§§ā§Ģ. āĻāĻŦāĻ‚ āĻāϰ āĻŽāĻ§ā§āϝ⧇ āϝāĻž āϞāĻŋāĻ–āĻŦā§‹ āϤāĻžāχ āφāĻŽāĻžāĻĻ⧇āϰ āĻļā§‹ āĻ•āϰāĻŦ⧇
ā§§ā§Ŧ.āĻāĻŦāĻžāϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻāϰ āϰ⧁āϟ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻ cli āĻŦāĻž āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĒāϰāĻžāĻŽā§āĻĒ āĻ āĻāχ āϕ⧋āĻĄ āϟāĻŋ āχāĻ¨ā§āϟāĻžāϰāύ⧇āϟ āϏāĻ‚āϝ⧋āĻ— āϏāĻšāĻ•āĻžāϰ⧇ āϰāĻžāύ āĻ•āϰ⧇ : npm run dev

ā§§ā§­. āĻāĻŦāĻžāϰ āĻŦā§āϰāĻžāωāϜāĻžāϰ āĻ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āϟāĻŋ āϰāĻžāύ āφāϏāĻŦ⧇

āϞāĻžāϰāĻžāϭ⧇āϞ reactjs āĻ āĻŦ⧁āϟāĻ¸ā§āĻŸā§āĻ°ā§āϝāĻžāĻĒ āĻāϰ css āĻ“ js āύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ : āφāĻŽāϰāĻž āϏāĻŦāĻžāχ āĻŦ⧁āϟāĻ¸ā§āĻŸā§āĻ°ā§āϝāĻžāĻĒ āύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰāϤ⧇ āĻ…āĻ­ā§āĻ­āĻžāϏāϤ⧋ āϤāĻžāχ āφāĻŽāϰāĻž āύāĻŋāĻšā§‡āϰ āĻĒāĻĻā§āϧāϤāĻŋ āĻ…āĻŦāϞāĻŽā§āĻŦāύ āĻ•āϰāĻŦā§‹ : āĻĒā§āϰāĻĨāĻŽā§‡ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰāϟāĻŋ cmd āϤ⧇ āĻ“āĻĒ⧇āύ āĻ•āϰ⧇ āϞāĻŋāĻ–āĻŦā§‹
npm install –save bootstrap āĻāĻŦāĻžāϰ⧇āϰ āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ āĻ…āĻĒ⧇āĻ•ā§āώāĻž āĻ•āϰ⧇ āĻ•āĻŽāĻĒā§āϞāĻŋāϟ āĻšāϞ⧇ App.js āĻĢāĻžāχāϞ āĻ āĻŦ⧁āϟāĻ¸ā§āĻŸā§āϰāĻžāĻĒāϟāĻŋ āχāĻŽā§āĻĒā§‹āĻ°ā§āϟ āĻ•āϰāĻŦā§‹ āĻāĻ­āĻžāĻŦ⧇ import Bootstrap from ‘bootstrap/dist/css/bootstrap.min.css’; āĻāĻŦāĻžāϰ cmd āϤ⧇ npm run dev āϞāĻŋāϖ⧇ āĻāĻ¨ā§āϟāĻžāϰ āĻ•āϰāϞ⧇ reactjs āĻ…āĻĒā§āĻĒāϟāĻŋ āĻŦāĻŋāĻ˛ā§āĻĄ āĻšāĻŦ⧇ āĻāĻŦāĻžāϰ āφāĻŽāϰāĻž āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻāϰ āχāωāφāϰāĻāϞ āϟāĻŋ āϰāĻŋāĻĢā§āϰ⧇āĻļ āĻ•āϰāϞ⧇ āϤāĻžāϰ āĻĒāϰāĻŋāĻŦāĻ°ā§āϤāύ āϝ⧇ āϝ⧇āϗ⧁āϞ⧋ āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ āĻ āφāĻŽāϰāĻž āĻŦ⧁āϟāĻ¸ā§āĻŸā§āĻ°ā§āϝāĻžāĻĒ āĻāϰ āĻ•ā§āϞāĻžāϏ āĻŦ⧇āĻŦāĻšāĻžāϰ āĻ•āϰ⧇āĻ›āĻŋ āϤāĻž āĻ•āĻžāϜ āĻ•āϰāϛ⧇

āϞāĻžāϰāĻžāϭ⧇āϞ reactjs āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻ āϰāĻŋāĻāĻ•ā§āϟ router āύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰāĻž : āϏāĻžāĻŽāĻžāĻĻ āϤ⧇ āϰāĻžāύ āĻ•āϰāĻŋ npm install react-router-dom –save āĻ•āĻŋāϛ⧁āĻ•ā§āώāύ āĻ…āĻĒ⧇āĻ•ā§āώāĻž āĻ•āϰ⧇ āĻ•āĻŽāĻĒā§āϞāĻŋāϟ āĻšāϞ⧇ āφāĻŽāϰāĻž āϝ⧇ āĻĢāĻžāχāϞ āĻ āϰāĻŋāĻāĻ•ā§āϟ āϰāĻžāωāϟāĻžāϰ āĻŦ⧇āĻŦāĻšāĻžāϰ āĻ•āϰāĻŦā§‹ āϏ⧇āχ āĻĒ⧇āϜ āĻ āχāĻŽā§āĻĒā§‹āĻ°ā§āϟ āĻ•āϰāĻŋ āĻāĻ­āĻžāĻŦ⧇ : import {
BrowserRouter as Router,
Switch,
Route,
Link
} from “react-router-dom”;

ā§§ā§Ž.. āĻāĻŦāĻžāϰ āφāĻŽāϰāĻž āϞāĻ—āχāύ āĻ“ āϰ⧇āϜāĻŋāĻ¸ā§āĻŸā§āϰ⧇āĻļāύ āϏāĻŋāĻ¸ā§āĻŸā§‡āĻŽ āϤ⧈āϰ⧀ āĻ•āϰāĻŦā§‹ āϝāĻžāϤ⧇ āĻ…āĻ¨ā§āϝ āĻ•ā§€ā§Ÿ āφāĻŽāĻžāĻĻ⧇āϰ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻ āĻĸ⧁āĻ•āϤ⧇ āύāĻž āĻĒāĻžāϰ⧇ āĻāϜāĻ¨ā§āϝ āĻĒā§āϰāĻĨāĻŽā§‡ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻ āĻ—āĻŋā§Ÿā§‡
ā§§.composer require laravel/ui āĻāχ āϕ⧋āĻĄ āϟāĻŋ āφāĻŽāĻžāĻĻ⧇āϰ āϞāĻžāĻ—āĻŦ⧇ āύāĻž āĻ•āĻžāϰāĻŖ āφāĻŽāϰāĻž āĻĒā§‚āĻ°ā§āĻŦ⧇ āϰāĻŋāĻāĻ•ā§āϟ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāĻžāϰ āĻĒā§‚āĻ°ā§āĻŦ⧇ āĻāχ āϕ⧋āĻĄ āϰāĻžāύ āĻ•āϰ⧇ āĻ“āχ āϗ⧁āϞ⧋ āύāĻŋā§Ÿā§‡ āϚāĻŋ āĻāĻŦāĻžāϰ āύāĻŋāĻšā§‡āϰ āϕ⧋āĻĄ āϰāĻžāύ āĻ•āϰāĻŋ
⧍.php artisan ui:auth āĻāĻŦāĻžāϰ āύāĻŋāĻšā§‡āϰ āϕ⧋āĻĄ āϰāĻžāύ āĻ•āϰāĻŋ
ā§Š.php artisan ui react –auth (āφāĻŽāϰāĻž āϝāĻĻāĻŋ vue āĻŦāĻž bootstrap āωāϏ⧇ āĻ•āϰāĻŋ āϤāĻžāĻšāϞ⧇ āĻāχ āϕ⧋āĻĄ āϗ⧁āϞ⧋ āϰāĻžāύ āĻ•āϰāĻŦā§‹ php artisan ui vue –auth
āĻāĻŦāĻ‚ php artisan ui bootstrap –auth
)
ā§Ē. āĻāĻŦāĻžāϰ āφāĻŽāϰāĻž āφāĻŽāĻžāĻĻ⧇āϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āϕ⧇ āĻĄāĻžāϟāĻžāĻŦ⧇āϏ āĻāϰ āϏāĻžāĻĨ⧇ āĻ•āύāĻĢāĻŋāĻ—āĻžāϰ āĻ•āϰāĻŦā§‹ āĻāϜāĻ¨ā§āϝ .env āĻĢāĻžāχāϞ āĻ āĻĄāĻžāϟāĻžāĻŦ⧇āϏ āĻ•āύāĻĢāĻŋāĻ—āĻžāϰ āĻ•āϰāĻŋ
ā§Ģ.āĻāĻŦāĻžāϰ āφāĻŽāĻžāĻĻ⧇āϰ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ migrate āĻ•āϰāĻžāϰ āĻĒāĻžāϞāĻž āĻ…āύ⧇āĻ• āϏāĻŽā§Ÿ āĻŽāĻžāχāĻ—ā§āϰ⧇āϟ āĻ•āϰāĻžāϰ āϏāĻŽā§Ÿ āĻāϰāϰ āĻļā§‹ āĻ•āϰ⧇ āĻāϜāĻ¨ā§āϝ āφāĻŽāϰāĻž app\Providers\AppServiceProvider.php āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻ āĻāχ āϕ⧋āĻĄ āϟāĻŋ āϞāĻŋāĻ–āĻŦā§‹

use Illuminate\Support\Facades\Schema;
āĻāĻŦāĻ‚ boot āĻĢāĻžāĻ™ā§āĻ•āĻļāύāϟāĻŋ āĻāϰāĻ•āĻŽ āĻšāĻŦ⧇
public function boot()
{
Schema::defaultStringLength(191);
}
ā§Ŧ.āĻāĻŦāĻžāϰ migrate āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āĻāχ āϕ⧋āĻĄ āϰāĻžāύ āĻ•āϰāĻŋ : php artisan migrate:fresh

⧧⧝. āĻāĻŦāĻžāϰ āφāĻŽāϰāĻž āφāĻŽāĻžāĻĻ⧇āϰ āχāωāφāϰāĻāϞ āĻ http://127.0.0.1:8000/home āϞāĻŋāĻ–āϞ⧇ āύāĻŋāĻšā§‡āϰ āĻāĻ•āϟāĻŋ āĻĒ⧇āϜ āĻāϰ āĻĄā§āϝāĻžāĻļāĻŦā§‹āĻ°ā§āĻĄ āĻļā§‹ āĻ•āϰāĻŦ⧇

⧍ā§Ļ.āĻāĻŦāĻžāϰ āφāĻŽāĻŋ āϝāĻĻāĻŋ āφāĻŽāĻžāϰ resourse /views /home.blade.php āĻĢāĻžāχāϞ āϟāĻŋ āĻ“āĻĒ⧇āύ āĻ•āϰāĻŋ āϤāĻžāĻšāϞ⧇ āĻāϰāĻ•āĻŽ āϕ⧋āĻĄ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāĻŦā§‹

@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">Dashboard</div>

                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif

                    You are logged in!
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

⧍⧧. āĻāĻŦāĻžāϰ āφāĻŽāĻŋ āĻāϟāĻžāϕ⧇ āĻāĻ­āĻžāĻŦ⧇ āĻŽā§‹āĻĄāĻŋāĻĢāĻžāχ āĻ•āϰāĻŦā§‹

@extends('layouts.app')

@section('content')
<div class="container">
    <div id="example"></div>
</div>
@endsection

⧍⧍.āĻāĻ–āĻžāύ⧇ āĻĻāĻŋā§Ÿā§‡āĻ›āĻŋ āϝāĻžāϤ⧇ āĻāĻ–āĻžāύ⧇ āφāĻŽāĻŋ react āĻāϰ āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ āύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŋ

ā§¨ā§Š. āĻāĻŦāĻžāϰ āφāĻŽāĻŋ āϝāĻĻāĻŋ āĻŦā§āϰāĻžāωāϏāĻžāϰ āϰāĻŋāĻĢā§āϰ⧇āĻļ āĻ•āϰāĻŋ āϤāĻžāĻšāϞ⧇ āφāĻŽāĻŋ āĻĻ⧇āĻ–āϤ⧇ āĻĒāĻžāĻŦā§‹ āϝ⧇ example id āĻāϰ āĻŽāĻ§ā§āϝ⧇ Example component āϟāĻŋ āϞ⧋āĻĄ āĻšā§Ÿā§‡ āφāϛ⧇āĨ¤

⧍ā§Ē. āĻāĻŦāĻžāϰ js/Component/Example.js āĻĢāĻžāχāϞ āϕ⧇ App.js āĻĢāĻžāχāϞ āĻ rename āĻ•āϰāĻŋ āĻāĻŦāĻ‚ āϤāĻžāϰāĻŽāĻ§ā§āϝ⧇ āϕ⧋āĻĄ āϗ⧁āϞ⧋ āĻāϰāĻ•āĻŽ āĻšāĻŦ⧇

import React from 'react';
import ReactDOM from 'react-dom';

function Example() {
    return (
        <div className="container">
            <div className="row justify-content-center">
                <div className="col-md-8">
                    <div className="card">
                        <div className="card-header">Example Component</div>

                        <div className="card-body">I'm an example component!</div>
                    </div>
                </div>
            </div>
        </div>
    );
}

export default Example;

if (document.getElementById('example')) {
    ReactDOM.render(<Example />, document.getElementById('example'));
}

⧍ā§Ģ āĻāĻŦāĻžāϰ js/Component/index.js āĻĢāĻžāχāϞ āϟāĻŋ āĻāϰāĻ•āĻŽ āĻšāĻŦ⧇

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
// import App component
import App from './components/App'

// change the getElementId from example to app 
// render App component instead of Example
if (document.getElementById('root')) {
    ReactDOM.render(<App />, document.getElementById('root'));
}

⧍ā§Ŧ. āĻāĻŦāĻžāϰ js/App.js āϝ⧇ āĻĢāĻžāχāϞ āϤāĻž āφāϛ⧇ āϤāĻž āĻāϰāĻ•āĻŽ āĻšāĻŦ⧇āĨ¤

/**
 * First we will load all of this project's JavaScript dependencies which
 * includes React and other helpers. It's a great starting point while
 * building robust, powerful web applications using React + Laravel.
 */

require('./bootstrap');

/**
 * Next, we will create a fresh React component instance and attach it to
 * the page. Then, you may begin adding components to this application
 * or customize the JavaScript scaffolding to fit your unique needs.
 */

require('./components/index');

⧍⧭. āĻāĻŦāĻžāϰ home.blade.php āĻĢāĻžāχāϞāϟāĻŋ āĻāϰāĻ•āĻŽ āĻšāĻŦ⧇ āϝāĻžāϤ⧇ āφāĻŽāϰāĻž example āφāχāĻĄāĻŋ āĻāϰ āĻĒāϰāĻŋāĻŦāĻ°ā§āϤ⧇ root āĻāχāĻĄ āĻŦ⧇āĻŦāĻšāĻžāϰ āĻ•āϰāĻŦā§‹

@extends('layouts.app')

@section('content')
<div class="container">
    <div id="root"></div>
</div>
@endsection

ā§¨ā§Ž. āĻāĻŦāĻžāϰ āφāĻŽāĻžāĻĻ⧇āϰ js/Component/ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻ āĻŦāĻŋāĻ­āĻŋāĻ¨ā§āύ āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ āĻŦāĻžāύāĻŋā§Ÿā§‡ āĻŦ⧇āĻŦāĻšāĻžāϰ āĻ•āϰāĻžāϰ āϏāĻŽā§Ÿ

⧍⧝.āĻāϟāĻž āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ react āĻ āϝ⧇āĻ­āĻžāĻŦ⧇ āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ āύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰ⧇āĻ›āĻŋāϞāĻžāĻŽ āϏ⧇āχāĻ­āĻžāĻŦ⧇ āĻāĻ–āĻžāύ⧇ āĻ•āĻŽā§āĻĒā§‹āύ⧇āĻ¨ā§āϟ āĻŦāĻžāύāĻŋā§Ÿā§‡ āĻ•āĻžāϜ āĻ•āϰāĻŦā§‹

ā§Šā§Ļ.āĻāĻŦāĻžāϰ āφāĻŽāϰāĻž āĻāĻ–āύ āĻĨ⧇āϕ⧇ āĻāĻ•āϟāĻŋ āĻāĻĒā§āϞāĻŋāϕ⧇āĻļāύ āĻŦāĻžāύāĻžāĻŦā§‹ āĻāχ And Eita āϟāĻŋāωāĻŸā§‹āϰāĻŋ⧟āĻžāϞ āĻĢāϞ⧋ āĻ•āϰ⧇āĨ¤

āϞāĻžāϰāĻžāϭ⧇āϞ āĻ“ āϰāĻŋāĻāĻ•ā§āϟ āĻāϰ crud āĻ¸ā§āĻŸā§‡āĻĒ āĻŦāĻžāχ āĻ¸ā§āĻŸā§‡āĻĒ :
ā§§. āĻĒā§āϰāĻĨāĻŽā§‡ model,migration,controller āϤ⧈āϰ⧀ āĻ•āϰ⧇ āύ⧇āχ āĻĄā§‡āĻŽā§‹ āĻšāĻŋāϏāĻžāĻŦ⧇ āφāĻŽāĻŋ Product āύāĻžāĻŽ āĻāĻ•āϟāĻŋ āϰāĻŋāϏ⧋āĻ°ā§āϏ⧇ āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ āĻāϰ āϏāĻžāĻĨ⧇ āĻŽāĻĄā§‡āϞ āϤ⧈āϰ⧀ āĻ•āϰāϞāĻžāĻŽ

php artisan make:model Product

product.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    //
    protected $fillable = ['title','body'];
}

product migration file

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->string('body');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('products');
    }
}

routes/api.php

Route::resource('products', 'ProductController');




laravel+reactjs crud link

laravel crud tutorial

āĻĒā§āϰāĻĨāĻŽā§‡ āϞāĻžāϰāĻžāϭ⧇āϞ āĻāϰ project āϤ⧈āϰ⧀ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤ āĻ āϜāĻ¨ā§āϝ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĒā§āϰāĻŽā§āĻĒ āĻ blog āύāĻžāĻŽ āĻ āĻāĻ•āϟāĻŋ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āϤ⧈āϰ⧀ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āĻāχ āϕ⧋āĻĄ āϟāĻŋ āϞāĻŋāϖ⧇ āĻāĻ¨ā§āϟāĻžāϰ āĻ•āϰāĻŋāĨ¤

composer create-project --prefer-dist laravel/laravel blog

āĻāĻŦāĻžāϰ āφāĻŽāĻžāĻĻ⧇āϰ āĻĄāĻžāϟāĻžāĻŦ⧇āϏ āĻāϰ āĻ•āύāĻĢāĻŋāĻ—āĻžāϰ āĻ…āύ⧁āϝāĻžā§Ÿā§€ āφāĻŽāĻžāĻĻ⧇āϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻāϰ āĻŽā§‡āχāύ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻ .env āĻĢāĻžāχāϞ āĻ āĻĄāĻžāϟāĻžāĻŦ⧇āϏ āĻāϰ āχāύāĻĢāϰāĻŽā§‡āĻļāύ āĻĻāĻŋāϤ⧇ āĻšāĻŦ⧇ āϝ⧇āĻŽāύ āφāĻŽāĻžāϰ āĻĄāĻžāϟāĻžāĻŦ⧇āϏ āĻāϰ āχāωāφāϰāĻāϞ ,āωāϜāĻžāϰāύ⧇āĻŽ,āĻĒāĻžāϏāĻ“ā§ŸāĻžāĻ°ā§āĻĄ,,āĻĄāĻžāϟāĻžāĻŦ⧇āϏ āύāĻžāĻŽ āχāĻ¤ā§āϝāĻžāĻĻāĻŋāĨ¤

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=root

Route.php

Route::resource('/student', 'StudentController');

Create a student controller ,model,migration File

php artisan make:model Student -mcr

Student.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Student extends Model
{
    //
    protected $table = "students";
    protected $fillable = ['name','roll','class'];

}

StudentController.php

<?php

namespace App\Http\Controllers;

use App\Student;
use Illuminate\Http\Request;

class StudentController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //

        $data = Student::all();
        return view('student.index',compact('data'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create()
    {
        //
        return view ('student.save');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
        $validatedData = $request->validate([
            'name'=>'required|max:255',
            'roll'=>'required',
            'class'=>'required'
        ]);
        $show = Student::create($validatedData);
        return redirect('/student')->with('successs','Student Added');
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Student  $student
     * @return \Illuminate\Http\Response
     */
    public function show(Student $student)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Student  $student
     * @return \Illuminate\Http\Response
     */
    public function edit($id)
    {
        //
        $studentedit = Student::findOrFail($id);
        return view('student.edit')->with('data',$studentedit);
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Student  $student
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request,  $id)
    {
        //
        $validatedData = $request->validate([
            'name'=>'required',
            'roll'=>'required',
            'class'=>'required'
        ]);

        $studentupdate = Student::whereId($id)->update($validatedData);
        return redirect('/student')->with('success','Data is successfully updated');
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Student  $student
     * @return \Illuminate\Http\Response
     */
    public function destroy( $id)
    {
        //

        $deleteid = Student::findOrFail( $id);
        $deleteid->delete();
        return redirect('/student')->with('success','Data is successfully Deleted');

    }
}

Migration File

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStudentsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('students', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('roll');
            $table->string('class');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('students');
    }
}

Layout View File under student folder resource/view/student/

layout.blade.php

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">

</head>
<body>
    <div class="container">
        @yield('content')
    </div>
</body>
</html>

index.blade.php

@extends('student.layout')
@section('content')
<div class="row">
<a href="/student/create">Aadd Students</a>
    <div class="col-md-12 margin-tb">
            <table class="table-responsive table-bordered">
                <thead>
                    <th>Id</th>
                    <th>Name</th>
                    <th>Roll</th>
                    <th>Class</th>

                    <th>aAction</th>

                </thead>
                <tbody>
                    @foreach ($data as $row)
                    <tr><td>{{$row->id}}</td>
                    <td>{{$row->name}}</td>
                    <td>{{$row->roll}}</td>
                    <td>{{$row->class}}</td>

                    <td><a href="{{route('student.edit',$row->id)}}">Edit</a></td>
                    <td> <form action="{{route('student.destroy',$row->id)}}" method="post">
                        @csrf
                        @method('DELETE')                        <button class="btn btn-danger" type="submit">Delete</button>
                    </form>
                    </td>
                   </tr>
                    @endforeach
                </tbody>
            </table>
    </div>
</div>
@endsection

save.blade.php

@extends ('student.layout')
@section('content')
<div class="card-body">
    @if ($errors->any())
      <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
              <li>{{ $error }}</li>
            @endforeach
        </ul>
      </div><br />
    @endif
<form action="{{route('student.store')}}" method="post">
    @csrf
    <div class="form-group">
              @csrf
              <label for="name">Name:</label>
              <input type="text" id="name" class="form-control" name="name"/>
          </div>
          <div class="form-group">
              <label for="roll">Roll :</label>
              <input type="text" id='roll' class="form-control" name="roll"/>
          </div>
         <div class="form-group">
         <label for="roll">Class :</label>
              <input type="text" id='roll' class="form-control" name="class"/>
         </div>
         <button type="submit" class="btn btn-primary">Add Data</button>
      </form>
</form>
@endsection

edit.blade.php

@extends('student.layout')
@section('content')
<div class="row">
    <div class="col-md-12">
    @if ($errors->any())
      <div class="alert alert-danger">
        <ul>
            @foreach ($errors->all() as $error)
              <li>{{ $error }}</li>
            @endforeach
        </ul>
      </div><br />
    @endif
        <form action="{{route('student.update',$data->id)}}" method="post">
            @csrf
            @method('PATCH')
            <div class="form-group">
                <label for="name">Name</label>
                <input id="name" class="form-control" type="text" name="name" value="{{$data->name}}">
            </div>
            <div class="form-group">
                <label for="roll">Roll</label>
                <input id="roll" class="form-control" type="text" name="roll" value="{{$data->roll}}">
            </div>
            <div class="form-group">
                <label for="class">Class</label>
                <input id="class" class="form-control" type="text" name="class" value="{{$data->class}}">
            </div>
            <button class="btn btn-primary" type="submit">Update</button>
        </form>
    </div>
</div>
@endsection

Laravel Reference By Oleetech

Laravel Database Column Datatype

Command	Description
$table->bigIncrements('id');
$table->bigInteger('votes');	  BIGINT equivalent for the database.
$table->binary('data');	          BLOB equivalent for the database.
$table->boolean('confirmed');	  BOOLEAN equivalent for the database.
$table->char('name', 4);	  CHAR equivalent with a length.
$table->date('created_at');	  DATE equivalent for the database.
$table->dateTime('created_at');	  DATETIME equivalent for the database.
$table->dateTimeTz('created_at'); DATETIME (with timezone) for  database.
$table->decimal('amount', 5, 2);  DECIMAL  with a precision and scale.
$table->double('column', 15, 8);  DOUBLE equivalent with precision, 15 digits in total and 8 after the decimal point.
$table->enum('choices', ['foo', 'bar']);
ENUM equivalent for the database.
$table->float('amount');	FLOAT equivalent for the database.
$table->increments('id');	Incrementing ID (primary key) using a “UNSIGNED INTEGER” equivalent.
$table->integer('votes');	INTEGER equivalent for the database.
$table->ipAddress('visitor');	IP address equivalent for the database.
$table->json('options');	JSON equivalent for the database.
$table->jsonb('options');	JSONB equivalent for the database.
$table->longText('description');	LONGTEXT equivalent for the database.
$table->macAddress('device');	MAC address equivalent for the database.
$table->mediumInteger('numbers');	MEDIUMINT equivalent for the database.
$table->mediumText('description');	MEDIUMTEXT equivalent for the database.
$table->morphs('taggable');	Adds INTEGER taggable_id and STRINGtaggable_type.
$table->nullableTimestamps();	Same as timestamps(), except allows NULLs.
$table->rememberToken();	Adds remember_token as VARCHAR(100) NULL.
$table->smallInteger('votes');	SMALLINT equivalent for the database.
$table->softDeletes();	Adds deleted_at column for soft deletes.
$table->string('email');	VARCHAR equivalent column.
$table->string('name', 100);	VARCHAR equivalent with a length.
$table->text('description');	TEXT equivalent for the database.
$table->time('sunrise');	TIME equivalent for the database.
$table->timeTz('sunrise');	TIME (with timezone) equivalent for the database.
$table->tinyInteger('numbers');	TINYINT equivalent for the database.
$table->timestamp('added_on');	TIMESTAMP equivalent for the database.
$table->timestampTz('added_on');	TIMESTAMP (with timezone) equivalent for the database.
$table->timestamps();	Adds created_at and updated_at columns.
$table->uuid('id');	UUID equivalent for the database.

laravel Tutorial

For Laravel preparetion after basic go to link link2 , Laravel7 Official Doc, laravel 7 coostomdocs custom registrationsystem

ā§§. āĻĒā§āϰāĻĨāĻŽā§‡ āĻ•āĻŽā§āĻĒā§‹āϜāĻžāϰ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤
⧍. www āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋ āϤ⧇ āχāĻšā§āĻ›āĻžāĻŽāϤ⧋ āĻāĻ•āϟāĻŋ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ āύāĻžāĻŽ āĻĻāĻŋā§Ÿā§‡ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āϤ⧈āϰ⧀ āĻ•āϰāĻŋāĨ¤
ā§Š. cmd āĻĻāĻŋā§Ÿā§‡ www āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋāϤ⧇ āĻ—āĻŋā§Ÿā§‡ āĻ•āĻŽā§āϝāĻžāĻ¨ā§āĻĄ āĻāϰ āĻŽāĻžāĻĻā§āϧāĻŽā§‡ āϞāĻžāϰāĻžāϭ⧇āϞ āχāύāĻ¸ā§āϟāϞ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤ āĻ…āύ⧇āĻ• āϏāĻŽā§Ÿ cmd āĻĻāĻŋā§Ÿā§‡ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋ āĻšā§‡āĻžā§āϜ āĻšā§ŸāύāĻž (D:) āĻāĻ­āĻžāĻŦ⧇ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋ āĻšā§‡āĻžā§āϜ āĻ•āϰāϤ⧇ āĻšā§Ÿ āĻāĻ–āĻžāύ⧇ d: āĻĻāĻŋāϞ⧇ d āĻĄā§āϰāĻžāχāĻ­ āĻ āĻ•āĻžāϜ āĻ•āϰāĻŦ⧇āĨ¤

ā§Ē.cmd āϤ⧇ āϞāĻŋāĻ– composer create-project laravel/laravel firstproject
āĻāĻ–āĻžāύ⧇ blog āĻšāϞ⧋ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ āύāĻžāĻŽ
ā§Ģ. āĻāĻŦāĻžāϰ cmd āϤ⧇ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻ āĻĢāĻŋā§Ÿā§‡ āĻāχ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĻāĻŋāϤ⧇ āĻšāĻŦ⧇ php artisan serve

āϞāĻžāϰāĻžāϭ⧇āϞ āϰāĻžāωāϟāĻŋāĻ‚

āϞāĻžāϰāĻžāϭ⧇āϞ āϰāĻžāωāϟāĻŋāĻ‚ āĻŦāĻž āχāωāφāϰāĻāϞ āĻĢāϰāĻ“ā§ŸāĻžāĻ°ā§āĻĄāĻŋāĻ‚ : āϞāĻžāϰāĻžāϭ⧇āϞ āĻ āχāωāφāϰāĻāϞ āĻŦāĻžāϰ āĻ āϕ⧋āύ āχāωāφāϰāĻāϞ āĻšāϞ⧇ āϕ⧋āύ āĻĒ⧇āϜ āĻļā§‹ āĻ•āϰāĻŦ⧇ āϤāĻž āĻ āĻŋāĻ• āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ route/web.php āĻĢāĻžāχāϞ āĻ āĻ•āĻžāϜ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤
āφāĻŽāϰāĻž āϝāĻĻāĻŋ āĻāĻ­āĻžāĻŦ⧇ āϞāĻŋāĻ–āĻŋ
Route::get(‘/olee’, function () { return ” Olee Is Best”;});
āĻāĻŦāĻ‚ āχāωāφāϰāĻāϞ āĻ /olee āϞāĻŋāϖ⧇ āĻāĻ¨ā§āϟāĻžāϰ āĻ•āϰāĻŋ āϤāĻžāĻšāϞ⧇ āĻāϰāĻ•āĻŽ āφāωāϟāĻĒ⧁āϟ āφāϏāĻŦ⧇āĨ¤

āφāĻŦāĻžāϰ āφāĻŽāϰāĻž āϝāĻĻāĻŋ āϕ⧋āύ⧋ āĻ­āĻŋāω āĻŦāĻž āĻŸā§‡āĻŽā§āĻĒāϞ⧇āϟ āĻĢāĻžāχāϞ āĻĻ⧇āĻ–āϤ⧇ āϚāĻžāχ āϤāĻŦ⧇ āύāĻŋāĻšā§‡āϰ āĻĒāĻĻā§āϧāϤāĻŋ āĻ…āĻŦāϞāĻŽā§āĻŦāύ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤
āφāĻŽāϰāĻž āĻāĻ•āϟāĻŋ āĻŸā§‡āĻŽā§āĻĒāϞ⧇āϟ āĻĢāĻžāχāϞ āĻšāĻŋāϏāĻžāĻŦ⧇ views āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ āĻŽāĻ§ā§āϝ⧇ blade.php āĻāĻ•ā§āϏāĻŸā§‡āύāĻļāύ āϏāĻšāĻ•āĻžāϰ⧇ āĻāĻ•āϟāĻŋ āĻĢāĻžāχāϞ āϰāĻžāĻ–āϞāĻžāĻŽ āϝāĻžāϰ āύāĻžāĻŽ olee .blade.php āĻāĻŦāĻ‚ āϤāĻžāϰ āĻŽāĻ§ā§āϝ⧇ āχāĻšā§āĻ›āĻžāĻŽāϤ⧋ āϕ⧋āĻĄāĻŋāĻ‚ āĻ•āϰāϞāĻžāĻŽ āĻāĻŦāĻžāϰ āχāωāφāϰāĻāϞ āϟāĻŋ āĻĒāĻžāĻ“ā§ŸāĻžāύ⧋āϰ āϜāĻ¨ā§āϝ route/web.php āĻĢāĻžāχāϞ āĻ āύāĻŋāĻšā§‡āϰ āĻŽāϤ⧋ āϕ⧋āĻĄ āϞāĻŋāĻ–āϤ⧇ āĻšāĻŦ⧇āĨ¤

html āĻĢāĻ°ā§āĻŽ secure āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āύāĻŋāĻšā§‡āϰ āĻŽāϤ⧋ āĻ•āϰ⧇ āĻ•āĻžāϜ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ āĨ¤ āĻĢāĻ°ā§āĻŽ āĻŸā§āϝāĻžāĻ— āĻāϰ āĻĢāĻžāĻ°ā§āĻ¸ā§āϟ āϞāĻžāχāύ āĻ @csrf āϞāĻŋāĻ–āϤ⧇ āĻšāĻŦ⧇āĨ¤

<form method="POST" action="/profile">  
    @csrf  
    ...  
</form>  

āϞāĻžāϰāĻžāϭ⧇āϞ route āĻāϰ āĻŽāĻ§ā§āϝ⧇ āχāωāφāϰāĻāϞ āĻāϰ āϏāĻžāĻĨ⧇ āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāϟāĻžāϰ āĻĒāĻžāĻ āĻžāύ⧋ āϝāĻžāχ āĻĻ⧁āχ āĻ­āĻžāĻŦ⧇āĨ¤

Required Parameters
Optional Parameters

Required Parameters
// get the parameter of name
Route::get(‘students/{name}’, function($name) {
echo ‘Students Name is ‘ . $name;
});

āĻāĻ•āχāĻ­āĻžāĻŦ⧇ āφāĻĒāύāĻŋ āĻāĻ•āĻžāϧāĻŋāĻ• Required Parameter āĻĒāĻžāĻ āĻžāϤ⧇ āĻĒāĻžāϰ⧇āύ, āύāĻŋāĻšā§‡āϰ āωāĻĻāĻžāĻšāϰāĻŖ āϞāĻ•ā§āĻˇā§āϝ āĻ•āϰ⧁āύ :

Route::get(‘/olee/{name}/{salary}’, function ($name,$sal) {    return “my name is “.$name.$sal;});

Optional Parameters

āφāĻĒāύāĻŋ āϝāĻĻāĻŋ āφāĻĒāύāĻžāϰ URL āĻ āĻāĻŽāύ āĻ•āĻŋāϛ⧁ Parameter āĻĒāĻžāĻ āĻžāϤ⧇ āϚāĻžāύ , āϝāĻž āĻĨāĻžāĻ•āϤ⧇āĻ“ āĻĒāĻžāϰ⧇ āφāĻŦāĻžāϰ āύāĻžāĻ“ āĻĨāĻžāĻ•āϤ⧇ āĻĒāĻžāϰ⧇āĨ¤ āĻāχ āϏāĻŦ āĻ•ā§āώ⧇āĻ¤ā§āϰ⧇ āφāĻĒāύāĻžāϕ⧇ Laravel āĻāϰ Optional Parameter System āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤ āϤāĻ–āύ URL āĻ āĻāχ āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāϟāĻžāϰ āϗ⧁āϞāĻŋāϰ āĻĨāĻžāĻ•āĻžāϰ āφāĻŦāĻļā§āϝāϕ⧀āϝāĻŧ āύāϝāĻŧāĨ¤ āφāϰ āĻāχ Parameter āϗ⧁āϞāĻŋāϰ āύāĻžāĻŽā§‡āϰ āĻĒāϰ⧇ “?” āϚāĻŋāĻšā§āύ āĻĻāĻŋāϤ⧇ āĻšāϝāĻŧāĨ¤ āύāĻŋāĻŽā§āύ⧇āϰ āϕ⧋āĻĄāϟāĻŋ āϞāĻ•ā§āĻˇā§āϝ āĻ•āϰ⧁āύ :

Route::get('users/{name?}', function($name="Olee Ahmmed") {
        echo 'User Name is ' . $name;
});

āϞāĻžāϰāĻžāϭ⧇āϞ āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ :

āĻĒā§āϰāĻĨāĻŽā§‡ āφāĻŽāϰāĻž āϝāĻ–āύ āϕ⧋āύ⧋ āϰāĻŋāĻ•ā§‹ā§Ÿā§‡āĻ¸ā§āϟ āĻĒāĻžāĻ āĻžā§Ÿ āϤāĻ–āύ āĻĒā§āϰāĻĨāĻŽā§‡ āϏ⧇āϟāĻž route āĻ āϝāĻžā§Ÿ āĻāϰāĻĒāϰ āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ āϕ⧇ āϖ⧁āρāĻœā§‡ āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞ⧇āϰ āĻāϰ āĻŽāĻ§ā§āϝ⧇ āφāĻŽāĻžāĻĻ⧇āϰ āϏāĻ•āϞ āĻļāĻ°ā§āϤ āϏāĻŽā§‚āĻš āĻĨāĻžāϕ⧇ āϤāĻžāϰāĻĒāϰ āĻŽāĻĄā§‡āϞ āĻ āĻ—āĻŋā§Ÿā§‡ āĻĻ⧇āϖ⧇ āϝ⧇ āĻĄāĻžāϟāĻžāĻŦ⧇āϏ āĻšāϤ⧇ āϕ⧋āύ⧋ āĻĄāĻžāϟāĻž āφāύāϤ⧇ āĻšāĻŦ⧇ āĻ•āĻŋāύāĻž āϤāĻžāϰ āĻĒāϰ āϏ⧇āϟāĻž āĻ­āĻŋāω āĻ āĻļā§‹ āĻ•āϰ⧇āĨ¤
Laravel Framework āĻ āĻ•āĻŋāĻ­āĻžāĻŦ⧇ Controller āϤ⧈āϰ⧀ āĻ•āϰāĻž āĻšā§Ÿ ?
āĻĒā§āϰāĻĨāĻŽā§‡ āϞāĻžāϰāĻžāϭ⧇āϞ āĻāϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻ āĻ—āĻŋā§Ÿā§‡ āĻ•āĻŽāĻžāĻ¨ā§āĻĄ āĻĒā§āϰāĻŽā§āĻĒ āĻāϰ āĻŽāĻžāĻĻā§āϧāĻŽā§‡ āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ āϤ⧈āϰ⧀ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤
php artisan make:controller homeController āϞāĻŋāϖ⧇ āχāĻ¨ā§āϟāĻžāϰ āĻ•āϰāϞ⧇ homeController āύāĻžāĻŽ āĻāĻ•āϟāĻŋ āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ āĻĢāĻžāχāϞ āϤ⧈āϰ⧀ āĻšāĻŦ⧇ app/http /controller āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ āĻŽāĻ§ā§āϝ⧇ āϝāĻĻāĻŋ āϕ⧋āύ⧋ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ āĻŽāĻ§ā§āϝ⧇ āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ āϤ⧈āϰ⧀ āĻ•āϰāϤ⧇ āĻšā§Ÿ āϤāĻžāĻšāϞ⧇ php artisan make:controller āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰāύāĻžāĻŽ/āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞ⧇āϰāύāĻžāĻŽ āĻāĻ­āĻžāĻŦ⧇ āϞāĻŋāϖ⧇ āĻāĻ¨ā§āϟāĻžāϰ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤āχāϟāĻž āφāϏāϞ⧇ āĻāĻ•āϟāĻž āĻ•ā§āϞāĻžāϏ āĻĢāĻžāχāϞ āĻāϰ āĻŽāĻ§ā§āϝ⧇ āĻŽā§‡āĻĨāĻĄ āϞāĻŋāϖ⧇ route āĻšāϤ⧇ āĻāĻ•ā§āϏ⧇āϏ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤
route āĻāϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ controller class āĻāϰ āϝ⧇āϕ⧋āύ⧋ āĻŽā§‡āĻĨāĻĄ show āĻ•āϰāĻž:
āφāĻŽāϰāĻž āφāĻŽāĻžāĻĻ⧇āϰ āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ āĻ•ā§āϞāĻžāϏ āĻĢāĻžāχāϞ āĻāϰ āĻŽāĻ§ā§āϝ⧇ āĻāĻ•āϟāĻŋ āĻŽā§‡āĻĨāĻĄ āϤ⧈āϰ⧀ āĻ•āϰāϞāĻžāĻŽ āĻāĻŦāĻ‚ āϏ⧇āϟāĻžāϕ⧇ route āĻšāϤ⧇ āĻāĻ•ā§āϏ⧇āϏ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ :

// āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ āĻ•ā§āϞāĻžāϏ āĻāϰ āϕ⧋āĻĄ 
<?php
 
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
class homeController extends Controller
{
    public function index(){
        echo "Hello World";
    }
}
// route āĻĢāĻžāχāϞ  āĻāϰ āϕ⧋āĻĄ 
Route::get('/home', 'homeController@index');

URL āĻ Route āĻāϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ Controller āĻāϰ āύāĻŋāĻ°ā§āĻĻāĻŋāĻˇā§āϟ Method āĻ Parameter āĻĒāĻžāĻ āĻžāύ⧋ :

Route::get('/home/{name}/{age}', 'homeController@index');
// āφāĻĒāύāĻŋ Parameter āĻĻ⧁āϟāĻŋāϕ⧇ Optional āĻ•āϰ⧇ āĻĻāĻŋāϤ⧇ āĻĒāĻžāϰ⧇āύ 
Route::get('/home/{name?}/{age?}', 'homeController@index');
// āĻ•āĻ¨ā§āĻŸā§āϰ⧋āϞāĻžāϰ āĻ•ā§āϞāĻžāϏ āĻāϰ āϕ⧋āĻĄ 

<?php
 
namespace App\Http\Controllers;
 
use Illuminate\Http\Request;
 
class homeController extends Controller
{
    public function index($name,$age){
        echo "Welcome $name You're $age years old";
    }
 
}

āϞāĻžāϰāĻžāϭ⧇āϞ āĻ­āĻŋāω :

āϞāĻžāϰāĻžāϭ⧇āϞ āĻ­āĻŋāω : āχāωāϏāĻžāϰ āϝāĻž āĻĄāĻŋāϏāĻĒā§āϞ⧇ āϤ⧇ āĻĻ⧇āĻ–āĻŦ⧇ āĻāĻŦāĻ‚ āϝāĻžāϰ āĻŽāĻžāĻĻā§āϧāĻŽā§‡ āϰāĻŋāĻ•ā§‹ā§Ÿā§‡āĻ¸ā§āϟ āĻĒāĻžāĻ āĻžāĻŦ⧇ āĻāĻŦāĻ‚ āĻŦāĻŋāĻ­āĻŋāĻ¨ā§āύ āĻ•āĻžāϜ āĻ•āϰāĻŦ⧇ āϤāĻž āĻšāϞ⧋ āĻ­āĻŋāω :
Laravel route āĻāϰ āĻŽāĻžāĻ§ā§āϝāĻŽā§‡ view folder āĻāϰ āϝ⧇āϕ⧋āύ⧋ file display āĻ•āϰāĻž :
āĻĒā§āϰāĻĨāĻŽā§‡ āφāĻŽāϰāĻž resources/views/ āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ āĻŽāĻ§ā§āϝ⧇ hello.php āύāĻžāĻŽā§‡ āĻāĻ•āϟāĻŋ file āϤ⧈āϰ⧀ āĻ•āϰāĻŋāĨ¤ āĻāĻŦāĻ‚ āϏ⧇āχ āĻĢāĻžāχāϞ āĻ āύāĻŋāĻšā§‡āϰ code āϗ⧁āϞ⧋ āĻĻāĻŋāĻŦā§‹āĨ¤āφāĻŽāϰāĻž āϚāĻžāχāϞ⧇ āĻ­āĻŋāω āĻĢāĻžāχāϞāϟāĻŋāϕ⧇ blade āĻāĻ•ā§āϏāĻŸā§‡āύāĻļāύ āĻĻāĻŋā§Ÿā§‡āĻ“ āϏ⧇āĻ­ āĻ•āϰāϤ⧇ āĻĒāĻžāϰāĻŋ same āĻ•āĻžāϜ āĻ•āϰāĻŦ⧇āĨ¤

<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
 
        <title>Laravel</title>
 
        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Raleway:100,600" rel="stylesheet" type="text/css">
 
        <!-- Styles -->
        <style>
            html, body {
                background-color: #fff;
                color: #636b6f;
                font-family: 'Raleway', sans-serif;
                font-weight: 100;
                height: 100vh;
                margin: 0;
            }
 
            .title {
                font-size: 26px;
            }
 
             
            .m-b-md {
                margin-bottom: 30px;
            }
        </style>
    </head>
    <body>
         
 
            <div class="content">
                <div class="title m-b-md">
                    <center>Welcome to Laravel World</center>
                </div>
            </div>
    </body>
</html>

āĻāχ hello.php file āϟāĻŋ āĻŦā§āϰāĻžāωāϜāĻžāϰ āĻĻ⧇āĻ–āĻžāύ⧋āϰ āϜāĻ¨ā§āϝ āĻāĻ•āϟāĻž route āϞāĻŋāĻ–āĻŦ , āύāĻŋāĻŽā§āύ⧇āϰ āϕ⧋āĻĄāϟāĻŋ routes/web.php āϤ⧇ āϞāĻŋāϖ⧁āύ :
Route::get('/hello', function (){ return view("hello"); });

āϞāĻžāϰāĻžāϭ⧇āϞ Middleware

Laravel Framework āĻ Middleware āĻšāĻšā§āϛ⧇ āφāĻĒāύāĻžāϰ application āĻ āĻŦāĻŋāĻ­āĻŋāĻ¨ā§āύ āϏ⧋āĻ°ā§āϏ āĻĨ⧇āϕ⧇ āφāϏāĻž HTTP request āϗ⧁āϞ⧋āϕ⧇ controller āĻ āĻĒāĻžāĻ āĻžāύ⧋āϰ āφāϗ⧇ filtering āĻ•āϰāĻžāϰ āĻāĻ•āϟāĻž āĻĻ⧁āĻ°ā§āĻĻāĻžāĻ¨ā§āϤ Mechanism āĻŦāĻž āĻĒāĻĻā§āϧāϤāĻŋāĨ¤ āϧāϰ⧁āύ Laravel authentication Middleware āĻāϰ āĻ•āĻĨāĻžāχ āϧāϰāĻž āϝāĻžāĻ•, āϝāĻ–āύ āφāĻĒāύāĻžāϰ application āĻ āϕ⧋āύ⧋ user āϞāĻ—āχāύ āĻ•āϰāϤ⧇ āϚāĻžāϝāĻŧ, āϏ⧇āĻ•ā§āώ⧇āĻ¤ā§āϰ⧇ Laravel authentication Middleware āĻ•āĻžāϜ āĻšāĻšā§āϛ⧇ āϝ⧇āχ user āϞāĻ—āχāύ āĻ•āϰāϤ⧇ āϚāĻžāϝāĻŧ , āϤāĻžāϕ⧇ authentication Middleware āύāĻŋāĻœā§‡ Middle Man āĻšāĻŋāϏ⧇āĻŦ⧇ verify āĻ•āϰāĻŦ⧇ , āϝāĻĻāĻŋ āχāωāϜāĻžāϰ authenticated āύāĻž āĻšāϝāĻŧ , āϤāĻžāĻšāϞ⧇ Laravel authentication Middleware āϏ⧇āχ user āϕ⧇ login screen āĻ āĻĒāĻžāĻ āĻžāĻŦ⧇ , āφāϰ āϝāĻĻāĻŋ authenticated āĻšāύ, āϤāĻžāĻšāϞ⧇ laravel authentication Middleware āχāωāϜāĻžāϰāϕ⧇ āĻĒāϰāĻŦāĻ°ā§āϤ⧀ āĻ•āĻžāϜ āĻ•āϰāĻžāϰ āĻŦāĻž āĻĒāϰāĻŦāĻ°ā§āϤ⧀ āϧāĻžāĻĒ⧇ āϝāĻžāĻ“āϝāĻŧāĻžāϰ āĻ…āύ⧁āĻŽāϤāĻŋ āĻĒā§āϰāϧāĻžāύ āĻ•āϰāĻŦ⧇āĨ¤ āϏāĻšāϜ āĻ­āĻžāĻŦ⧇ āĻŦāϞāĻž āϝāĻžāϝāĻŧ , āφāĻĒāύāĻžāϰ application āĻ āϝ⧇āϕ⧋āύ⧋ request āĻāϰ āĻĒāϰ āĻāĻŦāĻ‚ response āĻāϰ āĻĒā§‚āĻ°ā§āĻŦ⧇ āϏāĻŦ āϧāϰāϪ⧇āϰ verification āĻāĻŦāĻ‚ authentication āĻ•āϰāĻžāϰ Mechanism āĻšāĻšā§āϛ⧇ Laravel Middleware. Laravel āĻ Middleware āĻĢāĻžāχāϞ āϗ⧁āϞāĻž app/Http/Middleware āĻāχ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋāϤ⧇ āϰāĻžāĻ–āϤ⧇ āĻšāϝāĻŧāĨ¤

āĻ•āĻŋāĻ­āĻžāĻŦ⧇ Middleware āϤ⧈āϰ⧀ āĻ•āϰāĻž āĻšāϝāĻŧ : middleware āϤ⧈āϰ⧀ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āĻ āύāĻŋāĻšā§‡āϰ āĻ•āĻŽāĻžāĻ¨ā§āĻĄāϟāĻŋ āϰāĻžāύ āĻ•āϰ⧁āύ 
// āĻāĻ–āĻžāύ⧇ checkage āĻŽāĻŋāĻĄāϞāĻ“ā§ŸāĻžāϰ āĻāϰ āύāĻžāĻŽ
php artisan make:middleware CheckAge

āφāĻĒāύāĻžāϰ app/Http/Middleware āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ⧇ checkAge āύāĻžāĻŽā§‡ āĻāĻ•āϟāĻž middleware āϤ⧈āϰ⧀ āĻšāϝāĻŧ⧇āϗ⧇āϛ⧇
āύāϤ⧁āύ CheckAge Middleware āϰ⧇āϜāĻŋāĻ¸ā§āĻŸā§āϰ⧇āĻļāύ : āύāϤ⧁āύ checkAge Middleware āύāĻŋāϝāĻŧ⧇ āĻ•āĻžāϜ āĻ•āϰāϤ⧇ āĻšāϞ⧇ āφāĻĒāύāĻžāϕ⧇ app/Http/kernel.php file āĻ āĻāϟāĻŋāϕ⧇ āϰ⧇āϜāĻŋāĻ¸ā§āϟāĻžāϰ āĻ•āϰ⧇ āĻĻāĻŋāϤ⧇ āĻšāĻŦ⧇ , āĻ āĻŋāĻ• āύāĻŋāĻšā§‡āϰ āĻŽāϤ⧋ :

protected $routeMiddleware = [
        'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
        'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
        'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
        'can' => \Illuminate\Auth\Middleware\Authorize::class,
        'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
        'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
        'CheckAge' => \App\Http\Middleware\CheckAge::class,
    ];

āϞāĻžāϰāĻžāϭ⧇āϞ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ āϞ⧋āĻ•āĻžāϞ āϏāĻžāĻ°ā§āĻ­āĻžāϰ āĻ āϰ⧇āϖ⧇ āĻĄāĻžāχāϰ⧇āĻ•ā§āϟ āϞ⧋āĻĄ āĻ•āϰāĻž : āφāĻŽāϰāĻž āϜāĻžāύāĻŋ āϞāĻžāϰāĻžāϭ⧇āϞ āĻāϰ āĻĒā§āϰāĻœā§‡āĻ•ā§āϟ php artisan serve āĻāχ āĻ•āĻŽā§āϝāĻžāĻ¨ā§āĻĄ āĻĻāĻŋā§Ÿā§‡ āĻāĻ•āϟāĻŋ āϏāĻžāĻ°ā§āĻ­āĻžāϰ āĻ āϰāĻžāύ āĻšā§Ÿ āĻ•āĻŋāĻ¨ā§āϤ⧁ āϏāϰāĻžāϏāϰāĻŋ āϞ⧋āĻĄ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āύāĻŋāĻšā§‡āϰ āĻĒāĻĻā§āϧāϤāĻŋ āĻ…āĻŦāϞāĻŽā§āĻŦāύ āĻ•āϰāϤ⧇ āĻšāĻŦ⧇āĨ¤
ā§§. āϰ⧁āϟ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋ āĻāϰ server.php āϕ⧇ index.php āĻ•āϰāϤ⧇ āĻšāĻŦ⧇ public āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ āĻŽāĻ§ā§āϝ⧇ htaccess āĻĢāĻžāχāϞ āϕ⧇ āϰ⧁āϟ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋāϤ⧇ āĻ•āĻĒāĻŋ āĻ•āϰ⧇ āφāĻ¨ā§āϤ⧇ āĻšāĻŦ⧇ āĻāϰāĻĒāϰ config āĻĢā§‹āĻ˛ā§āĻĄāĻžāϰ āĻāϰ app.php āĻĢāĻžāχāϞ āĻ application URL āĻ url āϞāĻžāχāύ āĻāϰ āύāĻŋāĻšā§‡ āĻāχ āϕ⧋āĻĄ āϞāĻŋāĻ–āĻŦ⧇
‘asset_url’ => env(‘APP_URL’, ‘http://localhost/yourprojectname /public’), āĻāĻ–āĻžāύ⧇ āϝāĻĻāĻŋ āϞāĻžāϰāĻžāϭ⧇āϞ āϰ⧁āϟ āĻĄāĻŋāϰ⧇āĻ•ā§āϟāϰāĻŋ āϤ⧇ āĻĨāĻžāϕ⧇ āϤāĻžāĻšāϞ⧇ ‘asset_url’ => env(‘APP_URL’, ‘http://localhost/public&#8217;),