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 class="clearfix">
<form class="title_left form-inline row" method="get" action="">
...
</form>
<div class="custom-select">
<select name="record" class="custom-select">
<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>
</div>
...
When i loading route index it's always has 500 users.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire