Example #1
0
 static function boot()
 {
     parent::boot();
     Static::observe(new DestinationObserver());
     Static::observe(new HasNameObserver());
     Static::observe(new TreeObserver());
 }
Example #2
0
 static function boot()
 {
     parent::boot();
     Static::observe(new HeadlineObserver());
     Static::observe(new HasManyImagesObserver());
     Static::observe(new BelongsToTravelAgentObserver());
 }
Example #3
0
 static function boot()
 {
     parent::boot();
     Static::saving(function ($model) {
         $model->is_admin = 1;
     });
 }
Example #4
0
 function setNameAttribute($v)
 {
     $this->attributes[Static::$name_field] = $v;
     if ($this->attributes['slug']) {
         $this->attributes['slug'] = Static::generateSlug($v, $this->_id);
     }
 }
Example #5
0
 static function boot()
 {
     parent::boot();
     Static::observe(new PackageObserver());
     Static::observe(new HasNameObserver());
     Static::observe(new HasSlugObserver());
 }
Example #6
0
 /**
  * @return Facade
  */
 protected static function getFacadeRoot()
 {
     static $instance = null;
     if (!$instance) {
         $instance = Container::GetInstance(Static::getFacadeAccessor());
     }
     return $instance;
 }
Example #7
0
 public static function ByPriorityTravelAgent($limit = 10)
 {
     return Static::join('travel_agencies', 'travel_agencies.id', '=', 'tours.travel_agent_id')->join('package_travel_agent', 'package_travel_agent.travel_agent_id', '=', 'travel_agencies.id')->join('packages', function ($join) {
         $join->on('packages.id', '=', 'package_travel_agent.package_id')->where('active_since', '<=', \Carbon\Carbon::now())->where('active_until', '>=', \Carbon\Carbon::now());
     })->whereHas('schedules', function ($q) {
         $q->where('departure', '>=', \Carbon\Carbon::now());
     })->select('tours.*')->orderBy('packages.priority', 'desc')->limit($limit)->get();
 }
Example #8
0
 static function boot()
 {
     parent::boot();
     Static::observe(new PlaceObserver());
     Static::observe(new HasNameObserver());
     Static::observe(new HasSlugObserver());
     Static::observe(new HasPublishedAtObserver());
 }
Example #9
0
 function scopeSlugIs($q, $v)
 {
     if (!$v) {
         return $q;
     } else {
         return $q->where(Static::getSlugField(), 'like', $v);
     }
 }
 public static function get($key = NULL, $default = NULL, $xss = true)
 {
     if ($xss) {
         return Static::get($key, $default);
     } else {
         return Static::get($key, $default);
     }
 }
Example #11
0
 public function scopeNameLike($q, $v = null)
 {
     if (!$v) {
         return $q;
     } else {
         $v = str_replace('*', '%', $v);
         return $q->where(Static::getNameField(), 'like', $v);
     }
 }
Example #12
0
 public function isBarcodeAmongAllProducts()
 {
     //if( strtolower($this->barcodeid) === 'empty'){	return true; }
     if (strtolower($this->barcodeid) === 'empty') {
         $this->barcodeid = '';
         return true;
     }
     $prd = Static::where('barcodeid', $this->barcodeid)->first();
     //dd($prd);
     return $prd === null ? true : false;
 }
Example #13
0
 static function bootPublishableTrait()
 {
     if (!isset(Static::$slug_field)) {
         throw new Exception("\$slug_field has not been set", 1);
     }
     if (!isset(Static::$slug_source_field)) {
         throw new Exception("\$slug_source_field has not been set", 1);
     }
     Static::saving(function ($model) {
         if (!$model->{$model->slug_field}) {
             $model->{$model->slug_field} = str_slug($model->{$model->slug_source_field});
         }
     });
 }
Example #14
0
 public static function textColorFor($color_string)
 {
     $color = Static::colorHexToDec($color_string);
     $black = [0, 0, 0];
     $white = [256, 256, 256];
     $blackTextPoints = 0;
     $whiteTextPoints = 0;
     Static::colorDiff($color, $black) == 'true' ? ++$blackTextPoints : --$blackTextPoints;
     Static::colorDiff($color, $white) == 'true' ? ++$whiteTextPoints : --$whiteTextPoints;
     Static::brightDiff($color, $black) == 'true' ? ++$blackTextPoints : --$blackTextPoints;
     Static::brightDiff($color, $white) == 'true' ? ++$whiteTextPoints : --$whiteTextPoints;
     Static::lumDiff($color, $black) == 'true' ? ++$blackTextPoints : --$blackTextPoints;
     Static::lumDiff($color, $white) == 'true' ? ++$whiteTextPoints : --$whiteTextPoints;
     Static::pythDiff($color, $black) == 'true' ? ++$blackTextPoints : --$blackTextPoints;
     Static::pythDiff($color, $white) == 'true' ? ++$whiteTextPoints : --$whiteTextPoints;
     return $blackTextPoints > $whiteTextPoints ? "black" : "white";
 }
Example #15
0
 static function boot()
 {
     parent::boot();
     Static::observe(new IssuedVoucherObserver());
 }
Example #16
0
 function getPathSlugAttribute()
 {
     return str_replace(Static::getDelimiter(), ',', $this->path);
 }
Example #17
0
 /**
  * @return FacadeService
  */
 protected static function getFacadeRoot()
 {
     return Container::Instance()->GetInstance(Static::getFacadeAccessor());
 }
Example #18
0
 static function boot()
 {
     parent::boot();
     Static::observe(new ContentObserver());
 }
Example #19
0
 static function boot()
 {
     parent::boot();
     Static::observe(new TravelAgentObserver());
     Static::observe(new HasNameObserver());
 }
Example #20
0
 static function GetDestinationTags()
 {
     Static::init();
     $query_data['type'] = 'destination';
     $query_data['group'] = true;
     $api_response = Cache::remember('destination_tag_' . http_build_query($query_data), 20, function () use($query_data) {
         return json_decode(self::$api->get(self::$api_url . '/tags?' . http_build_query(array_merge($query_data, ['access_token' => Session::get('access_token')])))->getBody(), false);
     });
     if ($api_response->status != 'success') {
         return null;
     }
     return $api_response->data->data;
 }
Example #21
0
 private static function setMenu()
 {
     Static::$arrMainMenu = [['url' => 'dashboard', 'label' => 'Dashboard', 'rawContent' => '<i class="fa fa-dashboard"></i> <span>Dashboard</span>'], ['url' => 'contacts', 'label' => 'Contact', 'rawContent' => '<i class="fa fa-dashboard"></i> <span>Contact</span> <small class="badge pull-right bg-yellow">12</small>'], ['url' => '#', 'label' => 'Parent', 'rawContent' => '<i class="fa fa-calendar"></i> <span>Parent</span> <i class="fa fa-angle-left pull-right"></i>', 'childrens' => [['url' => '#', 'label' => 'Menu 1', 'rawContent' => '<i class="fa fa-angle-double-right"></i>Menu 1'], ['url' => '#', 'label' => 'Menu 2', 'rawContent' => '<i class="fa fa-angle-double-right"></i>Menu 2'], ['url' => '#', 'label' => 'Menu 3', 'rawContent' => '<i class="fa fa-angle-double-right"></i>Menu 3']]], ['url' => 'inbox', 'label' => 'Inbox', 'rawContent' => '<i class="fa fa-envelope"></i> <span>Inbox</span>']];
 }
Example #22
0
 static function boot()
 {
     parent::boot();
     Static::observe(new SubscriberObserver());
 }
Example #23
0
 public function download()
 {
     $plan = new Static();
     return $plan->fill(['path' => storage_path() . '/' . $this->path, 'name' => $this->filename]);
 }
 function bootBelongsToDestinationTrait()
 {
     Static::observe(new BelongsToDestinationObserver());
 }
Example #25
0
 static function bootHasImages()
 {
     Static::observe(new HasImagesObserver());
 }
Example #26
0
 static function boot()
 {
     parent::boot();
     Static::observe(new AddressObserver());
 }
Example #27
0
 function setTitleAttribute($v)
 {
     $this->attributes[Static::$name_field] = $v;
     $this->attributes['slug'] = Static::generateSlug($v, $this->id);
 }
Example #28
0
 static function boot()
 {
     parent::boot();
     Static::observe(new ImageObserver());
 }
 function bootBelongsToManyPlacesTrait()
 {
     Static::observe(new BelongsToManyPlacesObserver());
 }
 function bootBelongsToTourTrait()
 {
     Static::observe(new BelongsToTourObserver());
 }