count something

$users = DB::table(‘application_applicants’)
->select(DB::raw(‘count(*) as user_count’))
->where(‘application_id’, ‘=’, $application->application_id)
->first();
echo $users->user_count;

 


Cache It
Eloquent = easy…

->remember(20,'stored_here')

$stored_result = Cache::remember('stored_here', 20 , function()
{
  //raw code here
}