lundi 5 octobre 2020

How to choose option amount record user in laravel?

I'm try to create choose option with 500 users

This my Controller

public function index()
    {
        $request = new \Illuminate\Http\Request();
    
     $employees = Employee::select('name','phone','email','id', DB::raw('2020 - year(day_of_birth) as age'));
     $amount = $request->record; 
     dd($amount);// output is null
     if( $amount == '25') $employees= $employees->paginate(25);
     else if($amount == '50') $employees= $employees->paginate(50);
     else if($amount == '100') $employees= $employees->paginate(100);
     else if($amount == '250') $employees= $employees->paginate(250);
     else $employees= $employees->paginate(500);
     return view('employees.index',['employees'=>$employees]);
    }

This is index.blade.php

 <div>
    <select name="record" class="autosubmit">
           <option value="25" selected="selected">25</option>
           <option value="50">50</option>
           <option value="100">100</option>
           <option value="250">250</option>
           <option value="500">500</option>
    </select>                    
 </div>

When i loading route index it's always has 500 users.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2SorPDU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire