Add a column for the user avatar #226
This commit is contained in:
parent
bb73af3806
commit
f84ff8de92
@ -28,6 +28,7 @@ class CreateUsersTable extends Migration
|
|||||||
$table->unsignedBigInteger('flights')->default(0);
|
$table->unsignedBigInteger('flights')->default(0);
|
||||||
$table->unsignedBigInteger('flight_time')->nullable()->default(0);
|
$table->unsignedBigInteger('flight_time')->nullable()->default(0);
|
||||||
$table->unsignedBigInteger('transfer_time')->nullable()->default(0);
|
$table->unsignedBigInteger('transfer_time')->nullable()->default(0);
|
||||||
|
$table->string('avatar')->nullable();
|
||||||
$table->string('timezone', 64)->nullable();
|
$table->string('timezone', 64)->nullable();
|
||||||
$table->unsignedTinyInteger('status')->nullable()->default(0);
|
$table->unsignedTinyInteger('status')->nullable()->default(0);
|
||||||
$table->unsignedTinyInteger('state')->nullable()->default(0);
|
$table->unsignedTinyInteger('state')->nullable()->default(0);
|
||||||
|
@ -15,7 +15,7 @@ use Laratrust\Traits\LaratrustUserTrait;
|
|||||||
* @property string $email
|
* @property string $email
|
||||||
* @property string $password
|
* @property string $password
|
||||||
* @property string $api_key
|
* @property string $api_key
|
||||||
* @property string current_airport_id
|
* @property string curr_airport_id
|
||||||
* @property string home_airport_id
|
* @property string home_airport_id
|
||||||
* @property Flight[] $flights
|
* @property Flight[] $flights
|
||||||
* @property string $flight_time
|
* @property string $flight_time
|
||||||
@ -56,7 +56,7 @@ class User extends Authenticatable
|
|||||||
'flights',
|
'flights',
|
||||||
'flight_time',
|
'flight_time',
|
||||||
'transferred_time',
|
'transferred_time',
|
||||||
'balance',
|
'avatar',
|
||||||
'timezone',
|
'timezone',
|
||||||
'state',
|
'state',
|
||||||
'status',
|
'status',
|
||||||
@ -123,6 +123,20 @@ class User extends Authenticatable
|
|||||||
$this->attributes['timezone'] = $value;
|
$this->attributes['timezone'] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return a File model
|
||||||
|
*/
|
||||||
|
public function getAvatarAttribute()
|
||||||
|
{
|
||||||
|
if (!$this->attributes['avatar']) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new File([
|
||||||
|
'path' => $this->attributes['avatar']
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mixed $size Size of the gravatar, in pixels
|
* @param mixed $size Size of the gravatar, in pixels
|
||||||
* @return string
|
* @return string
|
||||||
|
Loading…
Reference in New Issue
Block a user