public function index($results = null) { $departments = null; if ($results == null) { $departments = Department::all(); } else { $departments = Department::paginate($results); } return Response::json($departments); }
public function index() { $branchs = Branch::all(['id', 'name']); $branchselectlist = array(); array_push($branchselectlist, ':เลือกสาขา'); foreach ($branchs as $item) { array_push($branchselectlist, $item->id . ':' . $item->name); } $departments = Department::all(['id', 'name']); $departmentselectlist = array(); array_push($departmentselectlist, ':เลือกแผนก'); foreach ($departments as $item) { array_push($departmentselectlist, $item->id . ':' . $item->name); } $teams = Team::all(['id', 'name']); $teamselectlist = array(); array_push($teamselectlist, ':เลือกทีม'); foreach ($teams as $item) { array_push($teamselectlist, $item->id . ':' . $item->name); } return view('employee', ['branchselectlist' => implode(";", $branchselectlist), 'departmentselectlist' => implode(";", $departmentselectlist), 'teamselectlist' => implode(";", $teamselectlist)]); }
public function getAllDepartments() { return Department::all(); }
public function __construct() { $this->departments = Department::all(); }
public function index() { if (!$this->hasPermission($this->menuPermissionName)) { return view($this->viewPermissiondeniedName); } $branchs = Branch::all(['id', 'name']); $branchselectlist = array(); array_push($branchselectlist, ':เลือกสาขา'); foreach ($branchs as $item) { array_push($branchselectlist, $item->id . ':' . $item->name); } $departments = Department::all(['id', 'nameth', 'nameen']); $departmentselectlist = array(); array_push($departmentselectlist, ':เลือกแผนก'); foreach ($departments as $item) { array_push($departmentselectlist, $item->id . ':' . str_replace('&', '\\u0026', $item->nameth) . ' - ' . str_replace('&', '\\u0026', $item->nameen)); } $teams = Team::all(['id', 'name']); $teamselectlist = array(); array_push($teamselectlist, ':เลือกทีม'); foreach ($teams as $item) { array_push($teamselectlist, $item->id . ':' . $item->name); } return view('employee', ['branchselectlist' => implode(";", $branchselectlist), 'departmentselectlist' => implode(";", $departmentselectlist), 'teamselectlist' => implode(";", $teamselectlist)]); }