Question: How to Save data to the Database using Laravel 8?

This is ItemManufactureController file
class ItemManufactureController extends Controller
{
    public function index(){

        return view('item_manufacture');
    }
    // Save category data into the database
    public function store(Request $request){

        $newManufacture = new ItemManufacture;
        $newManufacture->name = $request->input('txtManufactureName');
        $newManufacture->status = $request->input('status', 'available');

        dd($newManufacture);

        $newManufacture->save();
        return redirect('/item_manufacture');

    }
}

This is item_manufacture.blade.php file
{{--this page add to layout   --}}
@extends('layout.layout_01')

{{--identity the content form the layout--}}
@section('content')

    <div class="container">
        <div class="row">
            <div class="col-md-4"></div>

            <div class="col-md-4">
                <div class="card">
                    <h5 class="card-header">Add Item Manufacture Details</h5>
                    <div class="card-body">

                        <div class="input-field p-3">
                            <label for="txtManufactureName">Manufacture Name :</label>
                            <div class="col-sm-8 p-2">
                                <input type="text" placeholder="Item Name" name="txtManufactureName" id="txtManufactureName">
                            </div>
                        </div>

                        <div class="input-field p-3">

                            <div class="col-sm-8 p-2">

                            </div>
                        </div>

                        <a href="/save_manufacture" class="btn btn-primary mb-2" id="btnAdd">ADD</a>
                    </div>
                </div>
            </div>

            <div class="col-md-4"></div>
        </div>

    </div>

@endsection

This is route file

//save manufacture
Route::get('/save_manufacture', [ItemManufactureController::class, 'store'])->name('saveManufacture');
Route::get('/item_manufacture', function (){
    return view('pages.item_manufacture');
});

This is Model file
class ItemManufacture extends Model
{
    use HasFactory;
//    public $timestamps=false;
    protected $connection = 'mysql';
    protected $primaryKey = 'id';
    protected $table = 'item_manufacture';
    protected $fillable = [
        'name',
        'status'];
}

when add data into the form and click "ADD" button array comes null value
I used Laravel 8 framework, when I add data into the input field of the item_manufacture form, data will not pass the array. If there any error of my code, Please correct it.
How to save data and get values from the input fields using Laravel framework?


Answer:
Please make your route as post since you're storing the data and change your route in chaining name() method as saveManufacture.store
Route::post('/save_manufacture', [ItemManufactureController::class, 'store'])->name('saveManufacture.store');

And in your blade file wrap your inputs inside form tag and set named route in your action.
And then replace a tag (anchor tag) with input type submit since we have added action in our form tag. so your blade file will look this.
{{--this page add to layout   --}}
@extends('layout.layout_01')

{{--identity the content form the layout--}}
@section('content')
    <div class="container">
        <div class="row">
            <div class="col-md-4"></div>
            <div class="col-md-4">
                <div class="card">
                    <h5 class="card-header">Add Item Manufacture Details</h5>
                    <div class="card-body">
                        <form action="{{ route('saveManufacture.store') }}" method="post">
                        <div class="input-field p-3">
                            <label for="txtManufactureName">Manufacture Name :</label>
                            <div class="col-sm-8 p-2">
                                <input type="text" placeholder="Item Name" name="txtManufactureName" id="txtManufactureName">
                            </div>
                        </div>
                        <div class="input-field p-3">
                            <div class="col-sm-8 p-2">
                            </div>
                        </div>
                        <input type="submit" class="btn btn-primary mb-2" id="btnAdd" value="ADD">
                        </form>
                    </div>
                </div>
            </div>
            <div class="col-md-4"></div>
        </div>
    </div>
@endsection

Now you'll able to get the request param in your store() function, please try to debug dd($request->post());