/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 0; $i < 100; $i++) {
         $location = new Location();
         $location->latitude = -33.876173 + $this->getRandomArbitrary(-0.2, 0.2);
         $location->longitude = 151.209859 + $this->getRandomArbitrary(-0.2, 0.2);
         $location->save();
     }
 }
Example #2
0
 public function near()
 {
     $location = new Location();
     $location->load();
     $lat = $location->getPoint()->getLat();
     $lng = $location->getPoint()->getLng();
     if (!empty($lat) and !empty($lng)) {
         $dealsList = $this->api->searchDeals(array('lat' => $lat, 'lng' => $lng));
     } else {
         $this->redirect('/places/checkin');
     }
     $title = "Ofertas por perto";
     return compact('title', 'location', 'page', 'dealsList');
 }
 /**
  * Initial database seeds for locations
  *
  * @return void
  */
 public function run()
 {
     DB::table('locations')->truncate();
     Location::create(['title' => 'Bean Square (Theil)', 'description' => '<p>Bean Square fungeert als een ontmoetingsplek met koffie, thee en smakelijke tussendoortjes. In de ochtenduren bieden we een wisselend ontbijtassortiment aan. Tijdens de lunch verschillende sandwiches en gedurende de dag een ruime selectie muffins, cookies en andere patisserie. </p>', 'email' => '*****@*****.**', 'website' => '', 'icon' => '/images/icons/locations/vitam.svg', 'address' => 'Theil building (C)', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Bean Square (Mandeville)', 'description' => '<p>Bean Square fungeert als een ontmoetingsplek met koffie, thee en smakelijke tussendoortjes. In de ochtenduren bieden we een wisselend ontbijtassortiment aan. Tijdens de lunch verschillende sandwiches en gedurende de dag een ruime selectie muffins, cookies en andere patisserie. </p>', 'email' => '*****@*****.**', 'website' => '', 'icon' => '/images/icons/locations/vitam.svg', 'address' => 'Mandeville building (T), 4th floor', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Bean Square (V)', 'description' => '<p>Bean Square fungeert als een ontmoetingsplek met koffie, thee en smakelijke tussendoortjes. In de ochtenduren bieden we een wisselend ontbijtassortiment aan. Tijdens de lunch verschillende sandwiches en gedurende de dag een ruime selectie muffins, cookies en andere patisserie. </p>', 'email' => '*****@*****.**', 'website' => '', 'icon' => '/images/icons/locations/vitam.svg', 'address' => 'Building V', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Café In de Smitse', 'description' => '<p>Café In de Smitse is dé plek op het universiteitsterrein om je vrienden, medestudenten en collega’s te ontmoeten na een dagje op de uni! Gegarandeerd voor een middag en avond gezelligheid, met lekkere muziek op de achtergrond en een heerlijk drankje uit ons assortiment erbij.</p>
             <p>`Hoogstpersoonlijk gebrouwen, hoogstpersoonlijk getapt, hoogstpersoonlijk genieten`.</p>
             <p>Als je In de Smitse eenmaal ontdekt hebt, wil je niet meer anders. Er gaan zelfs geruchten dat veel studenten overdag niet op de universiteit studeren, maar aan het eind van de middag toch even op hun fiets richting In de Smitse gaan... </p>', 'email' => '*****@*****.**', 'phone' => '+31 (010) 4081183', 'website' => 'http://indesmitse.nl/', 'icon' => '/images/icons/unknown.svg', 'address' => 'Mandeville Building, ground floor', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'De Etude', 'description' => '<p>De Global Market is een samensmelting van verschillende eetculturen, heerlijke geuren en mooie producten. Dagelijks worden recepturen uit de hele wereld vers bereid met zoveel mogelijk producten uit de streek. Onze medewerkers koken met de seizoenen mee, waarbij smaak en variatie voorop staan.</p>', 'email' => '*****@*****.**', 'website' => '', 'icon' => '/images/icons/locations/vitam.svg', 'address' => 'Tinbergen Building, begane grond', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Erasmus Paviljoen', 'description' => '<p>Het Erasmus Paviljoen is de nieuwe bruisende ontmoetingsplek in het hart van de campus van de Erasmus Universiteit Rotterdam, waar studenten, medewerkers en bezoekers elkaar ontmoeten. Het biedt een inspirerend programma op gebied van wetenschap, kunst, cultuur en maatschappij en is een podium voor een breed scala aan onderwerpen en evenementen. Naast een theater heeft het Erasmus Paviljoen een grand café, foyer en studie- en werkplekken.</p>
             <p>Het Erasmus Paviljoen: <em>the place to be!</em></p>', 'email' => '*****@*****.**', 'website' => 'http://www.erasmuspaviljoen.nl/', 'phone' => '+31 (010) 408 9742', 'icon' => '/images/icons/locations/erasmus-paviljoen.svg', 'address' => 'Campus Woudestein, Erasmus Paviljoen', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Erasmus Sport Café', 'description' => '<p>In het Erasmus Sport Café kun je de hele dag door terecht. Goede koffie, lunchbroodje, sportdrank, avondhap, biertje, bittergarnituur, het is goed toeven in het Erasmus Sport Café. Het terras is heerlijk bij zomerse temperaturen en op die dagen kan er in groepen worden gebarbecued. Er zijn pooltafels, dartborden en een tafelvoetbalspel. Het Erasmus Sport Café is ook een uitstekende meetingplek voor of na colleges en voor het geven van een borrel...</p>', 'email' => '*****@*****.**', 'website' => 'http://erasmussport.nl/nl_NL/erasmus-sport-caf-.html', 'phone' => '+31 (010) 40 81879', 'icon' => '/images/icons/unknown.svg', 'address' => 'Building S', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Frozz', 'description' => 'Frozz frozen yoghurt is 100% natuurlijk, verse Nederlandse yoghurt – bevroren op het moment dat je het bestelt. Lekker, fris en laag in calorieën. We serveren ze met fruitige, knapperige
 of zoete toppings en zo creëer je iedere keer weer je eigen Frozz. Vanaf 3 euro.', 'email' => '*****@*****.**', 'website' => 'http://frozz.com/', 'icon' => '/images/icons/locations/frozz.svg', 'address' => 'Erasmus Food Plaza, Sanders building', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Oodlz', 'description' => 'Oodlz zijn de beste verse noodles, geserveerd in een vegetarische- of kippenbouillon. Kies vlees, kip of vega - met je favoriete verse groenten en kruiden. Zo maak je jouw eigen noodle soup. Licht, lekker en goed voor je. Vanaf 5 euro.', 'email' => '*****@*****.**', 'website' => 'http://oodlz.com/', 'icon' => '/images/icons/locations/oodlz.svg', 'address' => 'Erasmus Food Plaza, Sanders building', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Has Döner Kebab', 'description' => '<p>In 1999 opende het eerste HAS Döner Kebab®-restaurant zijn deuren in Rotterdam. Hier werd de unieke HAS-formule ontwikkeld, waar smaak en kwaliteit centraal staan. Dit is niet onopgemerkt gebleven: tegenwoordig is HAS niet meer weg te denken uit Rotterdam. Maar ook buiten de thuisstad groeit onze dönerkebabketen in rap tempo.</p>
             <p>Het geheim achter HAS zijn de kwalitatief hoogstaande verse ingrediënten en zelfbereide producten. Vers, eerlijk en schoon! Lang hoef je nooit te wachten op één van onze heerlijke gerechten: ons personeel serveert met zorg, maar klantvriendelijk en snel.</p>
             <p>Kom snel langs bij HAS Döner Kebab aan de EUR en ervaar onze passie voor döner kebab!</p>', 'email' => '*****@*****.**', 'website' => 'http://www.hasdoner.nl/', 'icon' => '/images/icons/locations/has-doner.svg', 'address' => 'Erasmus Food Plaza, Sanders building', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'New Fork', 'description' => 'Wij zijn New Fork. Een lunch- en ontbijtverzorger uit Rotterdam. Een paar jaar geleden zijn wij gestart met het maken van 100% natuurlijk, lekker eten en drinken. Een combinatie waar wij 100% in geloven.', 'email' => '*****@*****.**', 'website' => 'http://www.newfork.nl/', 'icon' => '/images/icons/locations/new-fork.svg', 'address' => 'Erasmus Food Plaza, Sanders building', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Satebar', 'description' => 'In Indonesia, you will find the best satay along the road side. Break the journey for good food and a chat. In Holland, you just come to Satebar - the place for the tastiest of satays since 2005!', 'email' => '*****@*****.**', 'website' => 'http://www.satebar.nl/', 'icon' => '/images/icons/locations/satebar.svg', 'address' => 'Erasmus Food Plaza, Sanders building', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Starbucks', 'description' => '<h2>Wereldse koffie op een campus van wereldformaat</h2>
             <p>Het is maar een kort moment - gewoon een hand die over de toonbank een andere uitgestoken hand een beker aanreikt. Maar er is connectie.</p>
             <p>Wij van Starbucks zorgen dat alles wat we doen in het teken staat van die verbinding - van ons streven naar koffie van de beste kwaliteit ter wereld tot de manier waarop we ons samen met onze klanten en omgeving inzetten voor verantwoord zaken doen.</p>
             <p>Vanaf het begin, met één vestiging bijna 40 jaar geleden, hebben we overal waar we zijn geweest en bij alles wat we aanraken, geprobeerd het wat beter te maken dan we het aantroffen.</p>', 'email' => '*****@*****.**', 'website' => 'http://www.starbucks.nl/', 'icon' => '/images/icons/locations/starbucks.svg', 'address' => 'Erasmus Food Plaza, Sanders building', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Supermarkt Spar', 'description' => '', 'email' => '*****@*****.**', 'website' => 'http://www.denkdifferent.nl/', 'phone' => '+31 (010) 25 40432', 'icon' => '/images/icons/locations/spar.svg', 'address' => 'Erasmus Food Plaza, Sanders building', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
     Location::create(['title' => 'Tosti World', 'description' => 'Voor een snel ontbijt of een gezonde lunch kun je altijd terecht bij Tosti World voor een driedubbele tosti met wit of bruin brood. Je kunt kiezen uit wel 26 verschillende tosti’s.', 'email' => '*****@*****.**', 'website' => 'http://www.tostiworld.nl/', 'phone' => '+31 (024) 365 68 45', 'icon' => '/images/icons/locations/tosti-world.svg', 'address' => 'Erasmus Food Plaza, Sanders building', 'postal_code' => '3062 PA', 'city' => 'Rotterdam', 'country' => 'NL', 'latitude' => 51.916901, 'longitude' => 4.52585, 'created_by' => 1]);
 }
Example #4
0
 public function testAssetAdd()
 {
     $location = factory(Location::class, 'location')->make();
     $values = ['name' => $location->name];
     Location::create($values);
     $this->tester->seeRecord('locations', $values);
 }
 public function run()
 {
     DB::table('locations')->delete();
     //Create Location
     $location = new Location();
     $location->name = 'Nonlocated';
     $location->save();
     $location = new Location();
     $location->name = 'Tools';
     $location->save();
     DB::table('metrics')->delete();
     $metric = new Metric();
     $metric->name = "Stk";
     $metric->symbol = "stk";
     $metric->save();
 }
Example #6
0
 public static function boot()
 {
     parent::boot();
     static::created(function (User $user) {
         $castle = $user->castle()->create(['name' => $user->caste_name ?: $user->name]);
         $cb = CommentBlock::create();
         $cb->save();
         $user->commentBlock()->associate($cb);
         $user->save();
         // Задать позицию на карте и армию по-умолчанию.
         $location = Location::freeRandom();
         if (is_null($location)) {
             throw new GameException('Нельзя добавить новый замок. Все поле уже занято.');
         }
         $location->castle()->associate($castle);
         $location->save();
         $castle->army()->create(['name' => "{$castle->name}'s army", 'size' => 15, 'level' => 1]);
         // Создаем сооружения
         $castle->createBuildings();
         // Инициализировать ресурсы в замке
         $castle->initResources();
     });
     static::updated(function (User $user) {
         $castle = $user->castle;
         $castle->name = $user->castle_name;
         $castle->save();
     });
 }
Example #7
0
 /**
  * @inheritdoc
  */
 public function attributeLabels()
 {
     $attributeLabels = parent::attributeLabels();
     $attributeLabels['abbr'] = 'Abbr';
     $attributeLabels['kai_template'] = 'Kai Template';
     return $attributeLabels;
 }
 public function run()
 {
     for ($i = 0; $i < 20; $i++) {
         for ($j = 0; $j < 20; $j++) {
             Location::create(['x' => $i, 'y' => $j]);
         }
     }
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 30) as $index) {
         Location::create(['city' => $faker->city, 'state' => $faker->state, 'country' => $faker->country]);
         $this->command->info('Location table seeded!');
     }
 }
Example #10
0
 public static function createEmptyStock($item)
 {
     $stock = $item->newStockOnLocation(Location::find(1));
     $stock->quantity = 0;
     $stock->reason = 'stock created';
     $stock->save();
     return $stock;
 }
Example #11
0
 public function addUser()
 {
     if ($this->validate()) {
         $user = new Users();
         $location = new Location();
         $user->name = $this->name;
         $user->email = $this->email;
         $user->save();
         $location->user_id = $user->id;
         $location->city_id = $this->city;
         $location->region_id = $this->region;
         $location->country_id = $this->country;
         $location->save();
         return true;
     }
     return false;
 }
 public function run()
 {
     DB::table('locations')->delete();
     $collection = [];
     foreach ($collection as $record) {
         Location::create($record);
     }
 }
Example #13
0
 /**
  * Finds the Location model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Location the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Location::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #14
0
 public function run()
 {
     DB::table('locations')->delete();
     $collection = [['location' => 'Corporate'], ['location' => 'OnSite'], ['location' => 'Tupelo'], ['location' => 'Singapore'], ['location' => 'United Kingdom']];
     foreach ($collection as $record) {
         Location::create($record);
     }
 }
Example #15
0
 public function run()
 {
     DB::table('locations')->delete();
     $collection = [['company_id' => 5, 'location' => 'San Francisco', 'address' => '1 Star Fleet Row', 'address2' => 'San Francisco, CA 90021, USA', 'phone' => '1239993434'], ['company_id' => 3, 'location' => 'Corporate Office', 'address' => '5350 Poplar Ave | Ste 150', 'address2' => 'Memphis, TN 38119, USA', 'phone' => '9016824064']];
     foreach ($collection as $record) {
         Location::create($record);
     }
 }
Example #16
0
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Location::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
Example #17
0
 public function massAdd($locations, $pid, $type)
 {
     /*
        $l = explode("\n", $str);
        foreach ($l as $t) {
            $locations[] = trim($t);
        }
     */
     foreach ($locations as $l) {
         Location::create(['title' => $l, 'pid' => $pid, 'type' => $type]);
     }
 }
 /**
  * Display a listing of the Tracking.
  *
  * @param Request $request
  * @return Response
  */
 public function index(Request $request)
 {
     $this->trackingRepository->orderBy('id', 'desc')->pushCriteria(new RequestCriteria($request));
     $location_id = $request->location_id;
     if (empty($location_id)) {
         $trackings = $this->trackingRepository;
     } else {
         $trackings = $this->trackingRepository->locatedAt($location_id);
     }
     $trackings = $trackings->with('location')->with('billboardOwner')->with('product')->with('brand')->with('facing')->with('user')->paginate(25);
     $locations = Location::lists('city', 'id');
     return view('trackings.index')->with('trackings', $trackings)->with('locations', $locations)->with('location_id', $location_id);
 }
Example #19
0
 public function create($category = 0)
 {
     $category = intval($category);
     if ($category > 0) {
         $category = Category::findOrFail($category);
     }
     $categories = Category::roots()->get();
     $user = Auth::user();
     $states = Location::states()->first();
     $regions = $states->children()->first();
     $locations = $regions->children;
     return view('pages.task.create', compact('category', 'categories', 'user', 'locations'));
 }
Example #20
0
 /**
  * Поиск
  * @param $params
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Location::find();
     $query->joinWith(['country', 'city', 'region', 'users']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['attributes' => ['users.name', 'users.email', 'country', 'region', 'city']], 'pagination' => ['pagesize' => 5]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andWhere('country LIKE "%' . $this->country . '%"');
     $query->andWhere('city LIKE "%' . $this->city . '%"');
     $query->andWhere('region LIKE "%' . $this->region . '%"');
     return $dataProvider;
 }
Example #21
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Location::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'title', $this->title]);
     return $dataProvider;
 }
Example #22
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Location::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'annual_budget' => $this->annual_budget]);
     $query->andFilterWhere(['like', 'location_name', $this->location_name])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'country', $this->country]);
     return $dataProvider;
 }
Example #23
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Location::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created' => $this->created, 'updated' => $this->updated, 'is_active' => $this->is_active]);
     $query->andFilterWhere(['like', 'nickname', $this->nickname])->andFilterWhere(['like', 'fullname', $this->fullname]);
     return $dataProvider;
 }
 /**
  * Filters inventory results by specified location.
  *
  * @param mixed      $query
  * @param int|string $locationId
  *
  * @return mixed
  */
 public function scopeLocation($query, $locationId = null)
 {
     if (!is_null($locationId)) {
         // Get descendants and self inventory category nodes
         $locations = Location::find($locationId)->getDescendantsAndSelf();
         // Perform a sub-query on main query
         $query->where(function ($query) use($locations) {
             // For each category, apply a orWhere query to the sub-query
             foreach ($locations as $location) {
                 $query->orWhere('location_id', $location->id);
             }
         });
     }
     return $query;
 }
 public function search($input)
 {
     $query = Location::query();
     $columns = Schema::getColumnListing('locations');
     $attributes = array();
     foreach ($columns as $attribute) {
         if (isset($input[$attribute]) and !empty($input[$attribute])) {
             $query->where($attribute, $input[$attribute]);
             $attributes[$attribute] = $input[$attribute];
         } else {
             $attributes[$attribute] = null;
         }
     }
     return [$query->get(), $attributes];
 }
Example #26
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Location::find();
     $query->joinWith(['room']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->sort->attributes['room'] = ['asc' => ['room.name' => SORT_ASC], 'desc' => ['room.name' => SORT_DESC]];
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'active' => $this->active]);
     $query->andFilterWhere(['like', 'location', $this->location])->andFilterWhere(['like', 'room.name', $this->room]);
     return $dataProvider;
 }
Example #27
0
 public static function flattenLocationsArray($location_options_array = null)
 {
     $location_options = array();
     foreach ($location_options_array as $id => $value) {
         // get the top level key value
         $location_options[$id] = $value['name'];
         // If there is a key named children, it has child locations and we have to walk it
         if (array_key_exists('children', $value)) {
             foreach ($value['children'] as $child_id => $child_location_array) {
                 $child_location_options = Location::flattenLocationsArray($value['children']);
                 foreach ($child_location_options as $child_id => $child_name) {
                     $location_options[$child_id] = '--' . $child_name;
                 }
             }
         }
     }
     return $location_options;
 }
Example #28
0
 public function beforeAction($action)
 {
     if (!parent::beforeAction($action)) {
         return false;
     }
     $locationModels = Location::find()->where(['status' => Location::STATUS_ACTIVE])->all();
     $locations = [];
     foreach ($locationModels as $locationModel) {
         $locations[$locationModel->id] = $locationModel->title;
     }
     $categoryModels = Category::find()->where(['status' => Location::STATUS_ACTIVE])->all();
     $categories = [];
     foreach ($categoryModels as $categoryModel) {
         $categories[$categoryModel->id] = $categoryModel->title;
     }
     $searchBar = ['locations' => $locations, 'categories' => $categories];
     $this->view->params['search_bar'] = $searchBar;
     return true;
 }
 public function getFill()
 {
     if (!$this->checkProfileType()) {
         return redirect('/profile');
     }
     if ($this->checkProfileFill()) {
         return redirect('/profile');
     }
     $user = $this->user;
     $profile = $this->user->profile;
     $city = $profile->city;
     if ($city) {
         $region = $city->parent;
     } else {
         $region = Location::states()->first()->children()->first();
     }
     $cities = $region->children;
     $categories = Category::roots()->get();
     $subscribePeriods = ['asap', 'hour', 'twice-day', 'day', 'two-days'];
     return view('pages.profile.fill', compact('user', 'profile', 'cities', 'categories', 'subscribePeriods'));
 }
 /**
  * Returns a new form for the specified asset.
  *
  * @param Asset $asset
  *
  * @return \Orchestra\Contracts\Html\Builder
  */
 public function form(Asset $asset)
 {
     return $this->form->of('assets', function (FormGrid $form) use($asset) {
         if ($asset->exists) {
             $method = 'PATCH';
             $route = route('maintenance.assets.update', [$asset->getKey()]);
             $form->submit = 'Save';
         } else {
             $method = 'POST';
             $route = route('maintenance.assets.store');
             $form->submit = 'Create';
         }
         $categories = Category::getSelectHierarchy('assets');
         $locations = Location::getSelectHierarchy();
         $form->resource($this, $route, $asset, compact('method'));
         $form->fieldset(function (Fieldset $fieldset) use($categories, $locations) {
             $fieldset->control('input:text', 'tag')->attributes(['placeholder' => 'ex. 100010']);
             $fieldset->control('input:text', 'name')->attributes(['placeholder' => 'ex. Ford F150']);
             $fieldset->control('select', 'category')->options($categories)->value(function (Asset $asset) {
                 return $asset->category_id;
             });
             $fieldset->control('select', 'location')->options($locations)->value(function (Asset $asset) {
                 return $asset->location_id;
             });
             $fieldset->control('input:textarea', 'description');
             $fieldset->control('select', 'condition')->options(trans('assets.conditions'))->value(function (Asset $asset) {
                 return $asset->condition_number;
             });
             $fieldset->control('input:text', 'vendor')->attributes(['placeholder' => 'ex. Ford']);
             $fieldset->control('input:text', 'make')->attributes(['placeholder' => 'ex. F']);
             $fieldset->control('input:text', 'model')->attributes(['placeholder' => 'ex. 150']);
             $fieldset->control('input:text', 'serial')->attributes(['placeholder' => 'ex. 153423-13432432-2342423']);
             $fieldset->control('input:text', 'size')->attributes(['placeholder' => 'ex. 1905 x 2463']);
             $fieldset->control('input:text', 'weight')->attributes(['placeholder' => 'ex. 1 Ton']);
             $fieldset->control('input:text', 'acquired_at')->attributes(['class' => 'pickadate', 'placeholder' => 'Click to Select a Date']);
             $fieldset->control('input:text', 'end_of_life')->attributes(['class' => 'pickadate', 'placeholder' => 'Click to Select a Date']);
         });
     });
 }