コード例 #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $query = Location::orderBy("name");
     $paginate = new PaginateService($query);
     $this->data->locations = $paginate->data();
     $this->data->paging = $paginate->paging();
     if (Request::ajax()) {
         return $this->json();
     }
     return $this->view();
 }
コード例 #2
0
 /**
  * Makes a form view to edit location information.
  *
  * @author [A. Gianotto] [<*****@*****.**>]
  * @see LocationsController::postCreate() method that validates and stores
  * @param int $locationId
  * @since [v1.0]
  * @return View
  */
 public function getEdit($locationId = null)
 {
     // Check if the location exists
     if (is_null($location = Location::find($locationId))) {
         return redirect()->to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
     }
     // Show the page
     $locations = Location::orderBy('name', 'ASC')->get();
     $location_options_array = Location::getLocationHierarchy($locations);
     $location_options = Location::flattenLocationsArray($location_options_array);
     $location_options = array('' => 'Top Level') + $location_options;
     return View::make('locations/edit', compact('location'))->with('location_options', $location_options);
 }
コード例 #3
0
ファイル: Helper.php プロジェクト: stijni/snipe-it
 public static function locationsList()
 {
     $location_list = array('' => trans('general.select_location')) + Location::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
     return $location_list;
 }