diff --git a/app/Models/Acars.php b/app/Models/Acars.php index 538567fc..c0a4249c 100644 --- a/app/Models/Acars.php +++ b/app/Models/Acars.php @@ -54,6 +54,6 @@ class Acars extends BaseModel public function pirep() { - return $this->belongsTo('App\Models\Pirep', 'pirep_id'); + return $this->belongsTo(Pirep::class, 'pirep_id'); } } diff --git a/app/Models/Aircraft.php b/app/Models/Aircraft.php index 41f992ff..1e227205 100644 --- a/app/Models/Aircraft.php +++ b/app/Models/Aircraft.php @@ -53,11 +53,11 @@ class Aircraft extends BaseModel public function airport() { - return $this->belongsTo('App\Models\Airport', 'airport_id'); + return $this->belongsTo(Airport::class, 'airport_id'); } public function subfleet() { - return $this->belongsTo('App\Models\Subfleet', 'subfleet_id'); + return $this->belongsTo(Subfleet::class, 'subfleet_id'); } } diff --git a/app/Models/Fare.php b/app/Models/Fare.php index c3769909..f17d7274 100644 --- a/app/Models/Fare.php +++ b/app/Models/Fare.php @@ -38,10 +38,8 @@ class Fare extends BaseModel */ public function subfleets() { - return $this->belongsToMany( - 'App\Models\Subfleet', - 'subfleet_fare' - )->withPivot('price', 'cost', 'capacity'); + return $this->belongsToMany(Subfleet::class, 'subfleet_fare') + ->withPivot('price', 'cost', 'capacity'); } } diff --git a/app/Models/Flight.php b/app/Models/Flight.php index 02905890..3cc888ad 100644 --- a/app/Models/Flight.php +++ b/app/Models/Flight.php @@ -64,39 +64,37 @@ class Flight extends BaseModel public function airline() { - return $this->belongsTo('App\Models\Airline', 'airline_id'); + return $this->belongsTo(Airline::class, 'airline_id'); } public function dpt_airport() { - return $this->belongsTo('App\Models\Airport', 'dpt_airport_id'); + return $this->belongsTo(Airport::class, 'dpt_airport_id'); } public function arr_airport() { - return $this->belongsTo('App\Models\Airport', 'arr_airport_id'); + return $this->belongsTo(Airport::class, 'arr_airport_id'); } public function alt_airport() { - return $this->belongsTo('App\Models\Airport', 'alt_airport_id'); + return $this->belongsTo(Airport::class, 'alt_airport_id'); } public function fares() { - return $this->belongsToMany( - Fare::class, - 'flight_fare' - )->withPivot('price', 'cost', 'capacity'); + return $this->belongsToMany(Fare::class, 'flight_fare') + ->withPivot('price', 'cost', 'capacity'); } public function fields() { - return $this->hasMany('App\Models\FlightFields', 'flight_id'); + return $this->hasMany(FlightFields::class, 'flight_id'); } public function subfleets() { - return $this->belongsToMany('App\Models\Subfleet', 'subfleet_flight'); + return $this->belongsToMany(Subfleet::class, 'subfleet_flight'); } } diff --git a/app/Models/FlightFields.php b/app/Models/FlightFields.php index 59fd37a5..a179b056 100644 --- a/app/Models/FlightFields.php +++ b/app/Models/FlightFields.php @@ -27,7 +27,7 @@ class FlightFields extends BaseModel public function flight() { - return $this->belongsTo('App\Models\Flight', 'flight_id'); + return $this->belongsTo(Flight::class, 'flight_id'); } } diff --git a/app/Models/Pirep.php b/app/Models/Pirep.php index 18d87b64..ee5bbb99 100644 --- a/app/Models/Pirep.php +++ b/app/Models/Pirep.php @@ -88,59 +88,59 @@ class Pirep extends BaseModel public function acars() { - return $this->hasMany('App\Models\Acars', 'pirep_id') + return $this->hasMany(Acars::class, 'pirep_id') ->where('type', AcarsType::FLIGHT_PATH) ->orderBy('created_at', 'asc'); } public function acars_logs() { - return $this->hasMany('App\Models\Acars', 'pirep_id') + return $this->hasMany(Acars::class, 'pirep_id') ->where('type', AcarsType::LOG) ->orderBy('created_at', 'asc'); } public function acars_route() { - return $this->hasMany('App\Models\Acars', 'pirep_id') + return $this->hasMany(Acars::class, 'pirep_id') ->where('type', AcarsType::ROUTE) ->orderBy('order', 'asc'); } public function aircraft() { - return $this->belongsTo('App\Models\Aircraft', 'aircraft_id'); + return $this->belongsTo(Aircraft::class, 'aircraft_id'); } public function airline() { - return $this->belongsTo('App\Models\Airline', 'airline_id'); + return $this->belongsTo(Airline::class, 'airline_id'); } public function arr_airport() { - return $this->belongsTo('App\Models\Airport', 'arr_airport_id'); + return $this->belongsTo(Airport::class, 'arr_airport_id'); } public function dpt_airport() { - return $this->belongsTo('App\Models\Airport', 'dpt_airport_id'); + return $this->belongsTo(Airport::class, 'dpt_airport_id'); } public function comments() { - return $this->hasMany('App\Models\PirepComment', 'pirep_id') + return $this->hasMany(PirepComment::class, 'pirep_id') ->orderBy('created_at', 'desc'); } public function fields() { - return $this->hasMany('App\Models\PirepFieldValues', 'pirep_id'); + return $this->hasMany(PirepFieldValues::class, 'pirep_id'); } public function flight() { - return $this->belongsTo('App\Models\Flight', 'flight_id'); + return $this->belongsTo(Flight::class, 'flight_id'); } public function pilot() @@ -154,13 +154,13 @@ class Pirep extends BaseModel */ public function position() { - return $this->hasOne('App\Models\Acars', 'pirep_id') + return $this->hasOne(Acars::class, 'pirep_id') ->where('type', AcarsType::FLIGHT_PATH) ->latest(); } public function user() { - return $this->belongsTo('App\Models\User', 'user_id'); + return $this->belongsTo(User::class, 'user_id'); } } diff --git a/app/Models/PirepComment.php b/app/Models/PirepComment.php index ff22e290..b1bad10a 100644 --- a/app/Models/PirepComment.php +++ b/app/Models/PirepComment.php @@ -23,11 +23,11 @@ class PirepComment extends BaseModel public function pirep() { - return $this->belongsTo('App\Models\Pirep', 'pirep_id'); + return $this->belongsTo(Pirep::class, 'pirep_id'); } public function user() { - return $this->belongsTo('App\Models\User', 'user_id'); + return $this->belongsTo(User::class, 'user_id'); } } diff --git a/app/Models/PirepFieldValues.php b/app/Models/PirepFieldValues.php index c8fdef24..23829dd1 100644 --- a/app/Models/PirepFieldValues.php +++ b/app/Models/PirepFieldValues.php @@ -28,6 +28,6 @@ class PirepFieldValues extends BaseModel public function pirep() { - return $this->belongsTo('App\Models\Pirep', 'pirep_id'); + return $this->belongsTo(Pirep::class, 'pirep_id'); } } diff --git a/app/Models/Rank.php b/app/Models/Rank.php index 47720d70..cd93b066 100644 --- a/app/Models/Rank.php +++ b/app/Models/Rank.php @@ -33,7 +33,7 @@ class Rank extends BaseModel ]; public function subfleets() { - return $this->belongsToMany('App\Models\Subfleet', 'subfleet_rank') + return $this->belongsToMany(Subfleet::class, 'subfleet_rank') ->withPivot('acars_pay', 'manual_pay'); } } diff --git a/app/Models/Subfleet.php b/app/Models/Subfleet.php index 41294e6f..2fe39ff6 100644 --- a/app/Models/Subfleet.php +++ b/app/Models/Subfleet.php @@ -51,10 +51,8 @@ class Subfleet extends BaseModel public function fares() { - return $this->belongsToMany( - Fare::class, - 'subfleet_fare' - )->withPivot('price', 'cost', 'capacity'); + return $this->belongsToMany(Fare::class, 'subfleet_fare') + ->withPivot('price', 'cost', 'capacity'); } public function flights() @@ -64,9 +62,7 @@ class Subfleet extends BaseModel public function ranks() { - return $this->belongsToMany( - Rank::class, - 'subfleet_rank' - )->withPivot('acars_pay', 'manual_pay'); + return $this->belongsToMany(Rank::class, 'subfleet_rank') + ->withPivot('acars_pay', 'manual_pay'); } } diff --git a/app/Models/User.php b/app/Models/User.php index 24c34a01..bd85eeac 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -91,9 +91,9 @@ class User extends Authenticatable */ public function getGravatarAttribute() { - $size = 80; - $default = 'https://en.gravatar.com/userimage/12856995/7c7c1da6387853fea65ff74983055386.png'; - return 'https://www.gravatar.com/avatar/' . + $size = config('gravatar.size'); + $default = config('gravatar.default'); + return config('gravatar.url') . md5(strtolower(trim($this->email))) . '?d=' . urlencode($default ) . '&s=' . $size; } @@ -103,36 +103,36 @@ class User extends Authenticatable public function airline() { - return $this->belongsTo('App\Models\Airline', 'airline_id'); + return $this->belongsTo(Airline::class, 'airline_id'); } public function home_airport() { - return $this->belongsTo('App\Models\Airport', 'home_airport_id'); + return $this->belongsTo(Airport::class, 'home_airport_id'); } public function current_airport() { - return $this->belongsTo('App\Models\Airport', 'curr_airport_id'); + return $this->belongsTo(Airport::class, 'curr_airport_id'); } public function last_pirep() { - return $this->belongsTo('App\Models\Pirep', 'last_pirep_id'); + return $this->belongsTo(Pirep::class, 'last_pirep_id'); } public function bids() { - return $this->hasMany('App\Models\UserBid', 'user_id'); + return $this->hasMany(UserBid::class, 'user_id'); } public function pireps() { - return $this->hasMany('App\Models\Pirep', 'user_id'); + return $this->hasMany(Pirep::class, 'user_id'); } public function rank() { - return $this->belongsTo('App\Models\Rank', 'rank_id'); + return $this->belongsTo(Rank::class, 'rank_id'); } } diff --git a/app/Models/UserBid.php b/app/Models/UserBid.php index 0968ad78..aab75add 100644 --- a/app/Models/UserBid.php +++ b/app/Models/UserBid.php @@ -19,11 +19,11 @@ class UserBid extends BaseModel */ public function flight() { - return $this->belongsTo('App\Models\Flight', 'flight_id'); + return $this->belongsTo(Flight::class, 'flight_id'); } public function user() { - return $this->belongsTo('App\Models\User', 'user_id'); + return $this->belongsTo(User::class, 'user_id'); } } diff --git a/config/gravatar.php b/config/gravatar.php new file mode 100644 index 00000000..b54e356f --- /dev/null +++ b/config/gravatar.php @@ -0,0 +1,10 @@ + 'https://www.gravatar.com/avatar/', + 'default' => 'https://en.gravatar.com/userimage/12856995/7c7c1da6387853fea65ff74983055386.png', + 'size' => 80, +];