Shadow-Here


Server : Apache
System : Linux methusalix2 3.16.0-11-amd64 #1 SMP Debian 3.16.84-1 (2020-06-09) x86_64
User : hios ( 1437)
PHP Version : 5.6.40-0+deb8u12
Disable Function : proc_close,proc_open,dl,shell_exec,passthru
Directory :  /home/priorityservice-prod.1697609600/laravel/app/Models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :
Current File : /home/priorityservice-prod.1697609600/laravel/app/Models/Country.php
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Country extends Model
{
	public $primaryKey  = 'code';
	public $timestamps = false;
	/**
     * Scope a query to include all relations
     * see also https://laravel.com/docs/5.3/eloquent#query-scopes
     *
     * @return \Illuminate\Database\Eloquent\Builder
     */
	public function scopeWithAllRelations($query)
	{
		return $query->with(['packages','questions','questions.type','questions.options']);
	}

	/**
	 * retrieve all data including relations from a specific locale
	 * @param  [string] $locale
	 * @return [Country]
	 */
	static function getDataByLocale($locale = NULL) {
		return Country::where('locale','=',$locale)->withAllRelations()->first();
	}

	static function getEnabledCountries() {
		return Country::where('gp_enabled','=',1)->get();
	}

	/**
	 * Eloquent relation to packages
	 */
	public function packages() {
		return $this->hasMany('App\Models\Package','country_code','code')->where('active','=',true);
	}

	/**
	 * Eloquent relation to questions
	 */
	public function questions() {
		return $this->hasMany('App\Models\Question','country_code','code');
	}

}

Samx