0

I tried to let the user enter his ID to display the payment recode I have two model Customer, payment which has one to many relations here is my form

  <form action= "{{url('/Check')}}" method="POST" enctype="multipart/from-data">
    @csrf    
    <div class="row gtr-uniform">
            <h3>Please Enter youe National ID</h3>
            <div class="col-6 col-12-xsmall">
                <input type="text" name="cust_id" id="cust_id" value="" placeholder="ID" required/>
            </div>
            
            <!-- Break -->
            <div class="col-6 col-12-xsmall">
                <ul class="actions">
                    <li><input type="submit" id="btnclaim" value="Search" class="primary" /></li>
                    <li><input type="reset" value="Reset" /></li>
                </ul>
            </div>
        </div>
    </form>

this is the route statement

Route::post('/Check',[paymetController::class,'Check']);

and here is the controller

public function Check(Request $request){
    $cust_id=$request->CustomerID;
    $pay=Customer::with('payment')->find($cust_id);
    return view('DisplayPay',compact('pay'));
}

when I submit the form I got

 419 PAGE EXPIRED
fyafee
  • 53
  • 7
  • This error normally occurs due to expired or absence of `csrf` token. But you already have `@csrf` directive. So try to refresh the page and submit the form again. – Donkarnash Jun 01 '22 at 20:24
  • Does this answer your question? [Post request in Laravel - Error - 419 Sorry, your session/ 419 your page has expired](https://stackoverflow.com/questions/52583886/post-request-in-laravel-error-419-sorry-your-session-419-your-page-has-exp) – miken32 Mar 09 '23 at 21:23

1 Answers1

-1

run the following command:

  1. php artisan optimize
  2. php artisan optimize:clear
  3. php artisan serve
  4. npm run dev
SwissCodeMen
  • 4,222
  • 8
  • 24
  • 34