public function getWeighInEntryData() { $fishingCategories = array_filter((new CategoryTransformer())->transformCollection(Category::all()->toArray())); $fishingLocations = array_filter((new LocationTransformer())->transformCollection(Location::all()->toArray())); $fishingSectors = array_filter((new SectorTransformer())->transformCollection(Sector::all()->toArray())); $speciesList = array_filter((new SpeciesTransformer())->transformCollection(Species::with(['type', 'weights'])->get()->toArray())); return $this->respond(['fishingCategories' => $fishingCategories ?: null, 'fishingLocations' => $fishingLocations ?: null, 'fishingSectors' => $fishingSectors ?: null, 'speciesList' => $speciesList ?: null]); }
/** * @param $id * @return mixed */ public function show($id) { //$species = Species::find($id); $species = Species::with('weights', 'type')->find($id); if (!$species) { return $this->respondNotFound('Species does not exist.'); } return $this->respond(['data' => $this->speciesTransformer->transform($species)]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $species = Species::with('weights', 'type')->orderBy('name')->get(); $sectors = Sector::all(); return view('admin.pages.species.index', compact('species', 'sectors')); }