/** * Display a listing of the resource. * GET /settings * * @return Response */ public function index() { //show the main view $ingredients = Ingredient::lists('name', 'id'); $units = Unit::lists('symbol', 'id'); return View::make('settings.index')->with('ingredients', $ingredients)->with('units', $units)->with('title', 'Settings'); }
public function filterUnits() { if ($this->hasAccess('admin')) { $units = Unit::lists('name', 'id'); } elseif ($this->hasAccess('authorize')) { $units = Unit::where('role_id', '=', $this->role_id)->lists('name', 'id'); } elseif ($this->hasAccess('request')) { $units = Unit::where('id', '=', $this->unit_id)->lists('name', 'id'); } return $units; }