Employee queries — get() vs first()
<?php
public function getVsFirst()
{
// TODO (LEP 04): write the two queries
$emailToFind = "madhyam@yopmail.com";
$employee = Employee::where('email' , $emailToFind)->first();
$deptToSearch = "Engineering";
$employees=Employee::where('department' , $deptToSearch)->get();
return view('laravel.lep4_get_vs_first', [
'VIDEO' => null , 'employee' => $employee, 'employees' => $employees
]);
}
?>
Output
Find me the ageo off user whose email is madhyam@yopmail.com
Madhyam Sharma age 35
Give me list of users from Engineering dept
1 - Asha Rao
2 - Dillan Kuhic
3 - DAnny Lalwani