/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $user = \App\User::where('name', $id)->firstOrFail(); $isAdmin = Auth::user()->isAdmin; $breeders = \App\breeder::where('username', $id)->get(); return view('breeder.show', compact('breeders', 'user', 'id', 'isAdmin')); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $photoPath = public_path() . DIRECTORY_SEPARATOR . 'speciesResources' . DIRECTORY_SEPARATOR . $id . DIRECTORY_SEPARATOR . 'photos'; $notesPath = public_path() . DIRECTORY_SEPARATOR . 'speciesResources' . DIRECTORY_SEPARATOR . $id . DIRECTORY_SEPARATOR . 'notes'; $notes = null; $photos = null; if (File::exists($photoPath)) { $photos = File::files($photoPath); } if (File::exists($notesPath)) { $notes = File::files($notesPath); } $species = \App\Species::findOrFail($id); $breeders = \App\breeder::where('speciesID', $id)->get(); $numFish = DB::table('breeders')->where('speciesID', $id)->sum('numFish'); return view('species.show', compact('species', 'breeders', 'numFish', 'photos', 'notes')); }