* Do not create account if email already exists in OAuth * Remove DB constraints in Discord OAuth * Apply fixes from StyleCI * Add flash to login_layout * Fix logoutProvider for tests * Update OAuth Callback * Remove register with discord * Remove DISCORD_BOT_TOKEN * Add OAuthTest * Apply fixes from StyleCI * Update avatar in OAuthTest * Debug test * Revert "Debug test" This reverts commit ddef2f64b3f5c6e999202353fd6fcafc37091240. * Debug test * Apply fixes from StyleCI * Still trying to debug tests * Add avatar to UserFactory * Remove debug stuff * Update OAuthTest * Return discord_id in API * Check for UserState in OAuthController * Update OAuthTest * Apply fixes from StyleCI * Retrieve discord_private_channel_id * Apply fixes from StyleCI --------- Co-authored-by: StyleCI Bot <bot@styleci.io> Co-authored-by: Nabeel S <nabeelio@users.noreply.github.com>
47 lines
1.6 KiB
PHP
47 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Contracts\Resource;
|
|
|
|
/**
|
|
* @mixin \App\Models\User
|
|
*/
|
|
class User extends Resource
|
|
{
|
|
public function toArray($request)
|
|
{
|
|
$res = [
|
|
'id' => $this->id,
|
|
'pilot_id' => $this->pilot_id,
|
|
'ident' => $this->ident,
|
|
'name' => $this->name_private,
|
|
'name_private' => $this->name_private,
|
|
'avatar' => $this->resolveAvatarUrl(),
|
|
'discord_id' => $this->discord_id,
|
|
'rank_id' => $this->rank_id,
|
|
'home_airport' => $this->home_airport_id,
|
|
'curr_airport' => $this->curr_airport_id,
|
|
'last_pirep_id' => $this->last_pirep_id,
|
|
'flights' => $this->flights,
|
|
'flight_time' => $this->flight_time,
|
|
'transfer_time' => $this->transfer_time,
|
|
'total_time' => $this->flight_time,
|
|
'timezone' => $this->timezone,
|
|
'state' => $this->state,
|
|
];
|
|
|
|
$res['airline'] = Airline::make($this->whenLoaded('airline'));
|
|
$res['bids'] = UserBid::collection($this->whenLoaded('bids'));
|
|
$res['rank'] = Rank::make($this->whenLoaded('rank'));
|
|
$res['subfleets'] = Subfleet::make($this->whenLoaded('subfleets'));
|
|
|
|
// If the transfer hours count, then set the total time to reflect that
|
|
if (setting('pilots.count_transfer_hours', false) === true) {
|
|
$res['total_time'] = $this->flight_time + $this->transfer_time;
|
|
}
|
|
|
|
return $res;
|
|
}
|
|
}
|