[Solved] How can i convert it to laravel


Holy Moly….

I highly recommend you to read the documentation.

routes/web.php

<?php    
Route::get('form', 'TestController@form')->name('form');
Route::post('form', 'TestController@submit');

App\Http\Controllers\TestController.php

<?php
namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Request;

class TestController extends Controller
{

    public function form()
    {
        return view('form');
    }

    public function submit(Request $request)
    {
        $validator = $request->validate([
            // validation here
            // 'input' => 'rule'
        ]);

        dd($validator);
    }

}

resources/views/form.blade.php

<form method="post" action="{{ route('form') }}">
    {{ csrf_field() }}
    <input type="submit" name="button">
</form>

solved How can i convert it to laravel