public function showcerts($id = null) { $certs = Certificate::all(); $title = 'Vehicle Certificates'; if (is_numeric($id)) { $certs = Certificate::where('status', $id)->get(); $title = $id == 1 ? 'Approved Vehicle Certificates' : 'Unapproved Vehicle Certificates'; } return View::make('vehicles.certificates')->with('certificates', $certs)->with('title', $title); }