Adds docblocks to models

This commit is contained in:
jncampbell 2016-03-14 16:37:38 +00:00
parent 0210beb20b
commit c6f01728be
22 changed files with 616 additions and 19 deletions

View File

@ -9,16 +9,36 @@ class Account extends MyBaseModel
{
use SoftDeletes;
/**
* The validation rules
*
* @var array $rules
*/
protected $rules = [
'first_name' => ['required'],
'last_name' => ['required'],
'email' => ['required', 'email'],
];
/**
* The attributes that should be mutated to dates.
*
* @var array $dates
*/
public $dates = ['deleted_at'];
/**
* The validation error messages.
*
* @var array $messages
*/
protected $messages = [];
/**
* The attributes that are mass assignable.
*
* @var array $fillable
*/
protected $fillable = [
'first_name',
'last_name',
@ -47,21 +67,41 @@ class Account extends MyBaseModel
'stripe_data_raw'
];
/**
* The users associated with the account.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function users()
{
return $this->hasMany('\App\Models\User');
}
/**
* The orders associated with the account.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function orders()
{
return $this->hasMany('\App\Models\Order');
}
/**
* The currency associated with the account.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function currency()
{
return $this->hasOne('\App\Models\Currency');
}
/**
* Get the stripe api key.
*
* @return \Illuminate\Support\Collection|mixed|static
*/
public function getStripeApiKeyAttribute()
{
if (Utils::isAttendize()) {

View File

@ -13,4 +13,5 @@ namespace App\Models;
*/
class Activity extends \Illuminate\Database\Eloquent\Model
{
//put your code here.
}

View File

@ -8,8 +8,25 @@ namespace App\Models;
class Affiliate extends \Illuminate\Database\Eloquent\Model
{
protected $fillable = ['name', 'visits', 'tickets_sold', 'event_id', 'account_id', 'sales_volume'];
/**
* The attributes that are mass assignable.
*
* @var array $fillable
*/
protected $fillable = [
'name',
'visits',
'tickets_sold',
'event_id',
'account_id',
'sales_volume'
];
/**
* The attributes that should be mutated to dates.
*
* @var array $dates
*/
public function getDates()
{
return ['created_at', 'updated_at'];

View File

@ -15,9 +15,14 @@ use Illuminate\Database\Eloquent\SoftDeletes;
*/
class Attendee extends MyBaseModel
{
use SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array $fillable
*/
protected $fillable = [
'first_name',
'last_name',
@ -30,7 +35,8 @@ class Attendee extends MyBaseModel
];
/**
* Generate a private referennce number for the attendee. Use for checking in the attendee.
* Generate a private reference number for the attendee. Use for checking in the attendee.
*
*/
public static function boot()
{
@ -41,21 +47,43 @@ class Attendee extends MyBaseModel
});
}
/**
* The order associated with the attendee.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function order()
{
return $this->belongsTo('\App\Models\Order');
}
/**
* The ticket associated with the attendee.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function ticket()
{
return $this->belongsTo('\App\Models\Ticket');
}
/**
* The event associated with the attendee.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function event()
{
return $this->belongsTo('\App\Models\Event');
}
/**
* Scope a query to return attendees that have not cancelled.
*
* @param $query
*
* @return mixed
*/
public function scopeWithoutCancelled($query)
{
return $query->where('attendees.is_cancelled', '=', 0);
@ -66,11 +94,21 @@ class Attendee extends MyBaseModel
// return $this->order->order_reference
// }
/**
* Get the full name of the attendee.
*
* @return string
*/
public function getFullNameAttribute()
{
return $this->first_name.' '.$this->last_name;
}
/**
* The attributes that should be mutated to dates.
*
* @var array $dates
*/
public function getDates()
{
return ['created_at', 'updated_at', 'arrival_time'];

View File

@ -13,11 +13,32 @@ namespace App\Models;
*/
class Currency extends \Illuminate\Database\Eloquent\Model
{
public $timestamps = false;
protected $softDelete = false;
/**
* The database table used by the model.
*
* @var string $table
*/
protected $table = 'currencies';
/**
* Indicates whether the model should be timestamped.
*
* @var bool $timestamps
*/
public $timestamps = false;
/**
* Indicates whether the model should use soft deletes.
*
* @var bool $softDelete
*/
protected $softDelete = false;
/**
* The event associated with the currency.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function event()
{
return $this->belongsTo('\App\Models\Event');

View File

@ -13,6 +13,17 @@ namespace App\Models;
*/
class DateFormat extends \Illuminate\Database\Eloquent\Model
{
/**
* Indicates whether the model should be timestamped.
*
* @var bool $timestamps
*/
public $timestamps = false;
/**
* Indicates whether the model should use soft deletes.
*
* @var bool $softDelete
*/
protected $softDelete = false;
}

View File

@ -13,8 +13,24 @@ namespace App\Models;
*/
class DateTimeFormat extends \Illuminate\Database\Eloquent\Model
{
/**
* The database table used by the model.
*
* @var string $table
*/
protected $table = 'datetime_formats';
/**
* Indicates whether the model should be timestamped.
*
* @var bool $timestamps
*/
public $timestamps = false;
/**
* Indicates whether the model should use soft deletes.
*
* @var bool $softDelete
*/
protected $softDelete = false;
}

View File

@ -11,6 +11,11 @@ class Event extends MyBaseModel
{
use SoftDeletes;
/**
* The validation rules.
*
* @var array $rules
*/
protected $rules = [
'title' => ['required'],
'description' => ['required'],
@ -21,6 +26,12 @@ class Event extends MyBaseModel
'organiser_name' => ['required_without:organiser_id'],
'event_image' => ['mimes:jpeg,jpg,png', 'max:3000'],
];
/**
* The validation error messages.
*
* @var array $messages
*/
protected $messages = [
'title.required' => 'You must at least give a title for your event.',
'organiser_name.required_without' => 'Please create an organiser or select an existing organiser.',
@ -30,95 +41,181 @@ class Event extends MyBaseModel
'venue_name_full.required_without' => 'Please enter a venue for your event',
];
/**
* The questions associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function questions()
{
return $this->belongsToMany('\App\Models\Question', 'event_question');
}
/**
* The attendees associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function attendees()
{
return $this->hasMany('\App\Models\Attendee');
}
/**
* The images associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function images()
{
return $this->hasMany('\App\Models\EventImage');
}
/**
* The messages associated with the event.
*
* @return mixed
*/
public function messages()
{
return $this->hasMany('\App\Models\Message')->orderBy('created_at', 'DESC');
}
/**
* The tickets associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function tickets()
{
return $this->hasMany('\App\Models\Ticket');
}
/**
* The stats associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function stats()
{
return $this->hasMany('\App\Models\EventStats');
}
/**
* The affiliates associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function affiliates()
{
return $this->hasMany('\App\Models\Affiliate');
}
/**
* The orders associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function orders()
{
return $this->hasMany('\App\Models\Order');
}
/**
* The account associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function account()
{
return $this->belongsTo('\App\Models\Account');
}
/**
* The currency associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function currency()
{
return $this->belongsTo('\App\Models\Currency');
}
/**
* The organizer associated with the event.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function organiser()
{
return $this->belongsTo('\App\Models\Organiser');
}
/*
* Getters & Setters
/**
* Get the embed url.
*
* @return mixed
*/
public function getEmbedUrlAttribute()
{
return str_replace(['http:', 'https:'], '', route('showEmbeddedEventPage', ['event' => $this->id]));
}
/**
* Get the fixed fee.
*
* @return mixed
*/
public function getFixedFeeAttribute()
{
return config('attendize.ticket_booking_fee_fixed') + $this->organiser_fee_fixed;
}
/**
* Get the percentage fee.
*
* @return mixed
*/
public function getPercentageFeeAttribute()
{
return config('attendize.ticket_booking_fee_percentage') + $this->organiser_fee_percentage;
}
/**
* Indicates whether the event is currently happening.
*
* @return bool
*/
public function getHappeningNowAttribute()
{
return Carbon::now()->between($this->start_date, $this->end_date);
}
/**
* Get the currency sybol.
*
* @return \Illuminate\Support\Collection
*/
public function getCurrencySymbolAttribute()
{
return $this->currency->symbol_left;
}
/**
* Get the currency code.
*
* @return \Illuminate\Support\Collection
*/
public function getCurrencyCodeAttribute()
{
return $this->currency->code;
}
/**
* Get the embed html code.
*
* @return string
*/
public function getEmbedHtmlCodeAttribute()
{
return "<!--Attendize.com Ticketing Embed Code-->
@ -126,8 +223,9 @@ class Event extends MyBaseModel
<!--/Attendize.com Ticketing Embed Code-->";
}
/*
/**
* Get a usable address for embedding Google Maps
*
*/
public function getMapAddressAttribute()
{
@ -142,21 +240,41 @@ class Event extends MyBaseModel
return urlencode($string);
}
/**
* Get the big image url.
*
* @return string
*/
public function getBgImageUrlAttribute()
{
return URL::to('/').'/'.$this->bg_image_path;
}
/**
* Get the url of the event.
*
* @return string
*/
public function getEventUrlAttribute()
{
return URL::to('/').'/e/'.$this->id.'/'.Str::slug($this->title);
}
/**
* Get the sales and fees volume.
*
* @return \Illuminate\Support\Collection|mixed|static
*/
public function getSalesAndFeesVoulmeAttribute()
{
return $this->sales_volume + $this->organiser_fees_volume;
}
/**
* The attributes that should be mutated to dates.
*
* @var array $dates
*/
public function getDates()
{
return ['created_at', 'updated_at', 'start_date', 'end_date'];

View File

@ -13,4 +13,5 @@ namespace App\Models;
*/
class EventImage extends MyBaseModel
{
//put your code here.
}

View File

@ -7,14 +7,16 @@ use DB;
class EventStats extends \Illuminate\Database\Eloquent\Model
{
/**
* Indicates if the model should be timestamped.
*
* @var bool $timestamps
*/
public $timestamps = false;
public static $unguarded = true;
/**
* @todo This shouldn't be in a view.
*/
/**
* Update the amount of revenue a ticket has earned.
*
* @param int $ticket_id
@ -36,6 +38,13 @@ class EventStats extends \Illuminate\Database\Eloquent\Model
return $ticket->save();
}
/**
* Update the amount of views a ticket has earned.
*
* @param $event_id
*
* @return bool
*/
public function updateViewCount($event_id)
{
$stats = $this->firstOrNew([
@ -55,8 +64,10 @@ class EventStats extends \Illuminate\Database\Eloquent\Model
return $stats->save();
}
/*
* TODO: Missing amount?
/**
* @todo: Missing amount?
* Updates the sales volume earned by an event.
*
*/
public function updateSalesVolume($event_id)
{
@ -70,6 +81,14 @@ class EventStats extends \Illuminate\Database\Eloquent\Model
return $stats->save();
}
/**
* Updates the number of tickets sold for the event.
*
* @param $event_id
* @param $count
*
* @return bool
*/
public function updateTicketsSoldCount($event_id, $count)
{
$stats = $this->firstOrNew([

View File

@ -13,18 +13,32 @@ namespace App\Models;
*/
class Message extends MyBaseModel
{
/**
* The attributes that are mass assignable.
*
* @var array $fillable
*/
protected $fillable = [
'message',
'subject',
'recipients',
];
/**
* The event associated with the message.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function event()
{
return $this->belongsTo('\App\Models\Event');
}
/**
* Get the recipient label of the model.
*
* @return string
*/
public function getRecipientsLabelAttribute()
{
if ($this->recipients == 0) {
@ -36,6 +50,11 @@ class Message extends MyBaseModel
return 'Ticket: '.$ticket->title;
}
/**
* The attributes that should be mutated to dates.
*
* @var array $dates
*/
public function getDates()
{
return ['created_at', 'updated_at', 'sent_at'];

View File

@ -11,12 +11,48 @@ use Validator;
class MyBaseModel extends \Illuminate\Database\Eloquent\Model
{
/**
* Indicates whether the model uses soft deletes.
*
* @var bool $softDelete
*/
protected $softDelete = true;
/**
* Indicates if the model should be timestamped.
*
* @var bool $timestamps
*/
public $timestamps = true;
/**
* The validation rules of the model.
*
* @var array $rules
*/
protected $rules = [];
/**
* The validation error messages of the model.
*
* @var array $messages
*/
protected $messages = [];
/**
* The validation errors of model.
*
* @var $errors
*/
protected $errors;
/**
* Validate the model instance.
*
* @param $data
*
* @return bool
*/
public function validate($data)
{
$v = Validator::make($data, $this->rules, $this->messages);
@ -31,12 +67,21 @@ class MyBaseModel extends \Illuminate\Database\Eloquent\Model
return true;
}
/**
* Gets the validation error messages.
*
* @param bool $returnArray
*
* @return mixed
*/
public function errors($returnArray = true)
{
return $returnArray ? $this->errors->toArray() : $this->errors;
}
/**
* Create a new model.
*
* @param int $account_id
* @param int $user_id
* @param bool $ignore_user_id
@ -67,6 +112,14 @@ class MyBaseModel extends \Illuminate\Database\Eloquent\Model
return $entity;
}
/**
* Get a formatted date.
*
* @param $field
* @param string $format
*
* @return bool|null|string
*/
public function getFormatedDate($field, $format = 'd-m-Y H:i')
{
return $this->$field === null ? null : date($format, strtotime($this->$field));

View File

@ -10,57 +10,113 @@ class Order extends MyBaseModel
{
use SoftDeletes;
/**
* The validation rules of the model.
*
* @var array $rules
*/
public $rules = [
'order_first_name' => ['required'],
'order_last_name' => ['required'],
'order_email' => ['required', 'email'],
];
/**
* The validation error messages.
*
* @var array $messages
*/
public $messages = [
'order_first_name.required' => 'Please enter a valid first name',
'order_last_name.required' => 'Please enter a valid last name',
'order_email.email' => 'Please enter a valid email',
];
/**
* The items associated with the order.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function orderItems()
{
return $this->hasMany('\App\Models\OrderItem');
}
/**
* The attendees associated with the order.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function attendees()
{
return $this->hasMany('\App\Models\Attendee');
}
/**
* The account associated with the order.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function account()
{
return $this->belongsTo('\App\Models\Account');
}
/**
* The event associated with the order.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function event()
{
return $this->belongsTo('\App\Models\Event');
}
/**
* The tickets associated with the order.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function tickets()
{
return $this->hasMany('\App\Models\Ticket');
}
/**
* The status associated with the order.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function orderStatus()
{
return $this->belongsTo('\App\Models\OrderStatus');
}
/**
* Get the organizer fee of the order.
*
* @return \Illuminate\Support\Collection|mixed|static
*/
public function getOrganiserAmountAttribute()
{
return $this->amount + $this->organiser_booking_fee;
}
/**
* Get the total amount of the order.
*
* @return \Illuminate\Support\Collection|mixed|static
*/
public function getTotalAmountAttribute()
{
return $this->amount + $this->organiser_booking_fee + $this->booking_fee;
}
/**
* Get the full name of the order.
*
* @return string
*/
public function getFullNameAttribute()
{
return $this->first_name.' '.$this->last_name;
@ -102,6 +158,9 @@ class Order extends MyBaseModel
return file_exists($pdf_file);
}
/**
* Boot all of the bootable traits on the model.
*/
public static function boot()
{
parent::boot();

View File

@ -13,5 +13,11 @@ namespace App\Models;
*/
class OrderItem extends MyBaseModel
{
/**
* Indicates if the model should be timestamped.
*
* @var bool $timestamps
*/
public $timestamps = false;
}

View File

@ -13,4 +13,5 @@ namespace App\Models;
*/
class OrderStatus extends \Illuminate\Database\Eloquent\Model
{
//put your code here
}

View File

@ -6,11 +6,22 @@ use Str;
class Organiser extends MyBaseModel
{
/**
* The validation rules for the model.
*
* @var array $rules
*/
protected $rules = [
'name' => ['required'],
'email' => ['required', 'email'],
'organiser_logo' => ['mimes:jpeg,jpg,png', 'max:10000'],
];
/**
* The validation error messages for the model.
*
* @var array $messages
*/
protected $messages = [
'name.required' => 'You must at least give a name for the event organiser.',
'organiser_logo.max' => 'Please upload an image smaller than 10Mb',
@ -18,16 +29,31 @@ class Organiser extends MyBaseModel
'organiser_logo.mimes' => 'Please select a valid image type (jpeg, jpg, png)',
];
/**
* The events associated with the organizer.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function events()
{
return $this->hasMany('\App\Models\Event');
}
/**
* The attendees associated with the organizer.
*
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function attendees()
{
return $this->hasManyThrough('\App\Models\Attendee', '\App\Models\Event');
}
/**
* Get the full logo path of the organizer.
*
* @return mixed|string
*/
public function getFullLogoPathAttribute()
{
if ($this->logo_path && (file_exists(config('attendize.cdn_url_user_assets').'/'.$this->logo_path) || file_exists(public_path($this->logo_path)))) {
@ -37,6 +63,11 @@ class Organiser extends MyBaseModel
return config('attendize.fallback_organiser_logo_url');
}
/**
* Get the url of the organizer.
*
* @return string
*/
public function getOrganiserUrlAttribute()
{
return route('showOrganiserHome', [
@ -45,11 +76,19 @@ class Organiser extends MyBaseModel
]);
}
/**
* Get the sales volume of the organizer.
*
* @return mixed|number
*/
public function getOrganiserSalesVolumeAttribute()
{
return $this->events->sum('sales_volume');
}
/**
* TODO:implement DailyStats method
*/
public function getDailyStats()
{
}

View File

@ -13,11 +13,21 @@ class Question extends MyBaseModel
{
use SoftDeletes;
/**
* The events associated with the question.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function events()
{
return $this->belongsToMany('\App\Models\Event');
}
/**
* The type associated with the question.
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function question_types()
{
return $this->hasOne('\App\Models\QuestionType');

View File

@ -4,4 +4,5 @@ namespace App\Models;
class QuestionType extends \Illuminate\Database\Eloquent\Model
{
//put your code here
}

View File

@ -13,4 +13,5 @@ namespace App\Models;
*/
class ReservedTickets extends \Illuminate\Database\Eloquent\Model
{
//put your code here
}

View File

@ -8,6 +8,11 @@ class Ticket extends MyBaseModel
{
use SoftDeletes;
/**
* The rules to validate the model.
*
* @var array $rules
*/
public $rules = [
'title' => ['required'],
'price' => ['required', 'numeric', 'min:0'],
@ -15,45 +20,80 @@ class Ticket extends MyBaseModel
'end_sale_date' => ['date', 'after:start_sale_date'],
'quantity_available' => ['integer', 'min:0'],
];
/**
* The validation error messages.
*
* @var array $messages
*/
public $messages = [
'price.numeric' => 'The price must be a valid number (e.g 12.50)',
'title.required' => 'You must at least give a title for your ticket. (e.g Early Bird)',
'quantity_available.integer' => 'Please ensure the quantity available is a number.',
];
/**
* The event associated with the ticket.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function event()
{
return $this->belongsTo('\App\Models\Event');
}
/**
* The order associated with the ticket.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function order()
{
return $this->belongsToMany('\App\Models\Order');
}
/**
* The questions associated with the ticket.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function questions()
{
return $this->belongsToMany('\App\Models\Question', 'ticket_question');
}
/**
* TODO:implement the reserved method.
*/
public function reserved()
{
}
/**
* Scope a query to only include tickets that are sold out.
*
* @param $query
*/
public function scopeSoldOut($query)
{
$query->where('remaining_tickets', '=', 0);
}
/*
* Getters & Setters
/**
* The attributes that should be mutated to dates.
*
* @var array $dates
*/
public function getDates()
{
return ['created_at', 'updated_at', 'start_sale_date', 'end_sale_date'];
}
/**
* Get the number of tickets remaining.
*
* @return \Illuminate\Support\Collection|int|mixed|static
*/
public function getQuantityRemainingAttribute()
{
if (is_null($this->quantity_available)) {
@ -63,6 +103,11 @@ class Ticket extends MyBaseModel
return $this->quantity_available - ($this->quantity_sold + $this->quantity_reserved);
}
/**
* Get the number of tickets reserved.
*
* @return mixed
*/
public function getQuantityReservedAttribute()
{
$reserved_total = \DB::table('reserved_tickets')
@ -73,26 +118,51 @@ class Ticket extends MyBaseModel
return $reserved_total;
}
/**
* Get the booking fee of the ticket.
*
* @return float|int
*/
public function getBookingFeeAttribute()
{
return (int) ceil($this->price) === 0 ? 0 : round(($this->price * (config('attendize.ticket_booking_fee_percentage') / 100)) + (config('attendize.ticket_booking_fee_fixed')), 2);
}
/**
* Get the organizer's booking fee.
*
* @return float|int
*/
public function getOrganiserBookingFeeAttribute()
{
return (int) ceil($this->price) === 0 ? 0 : round(($this->price * ($this->event->organiser_fee_percentage / 100)) + ($this->event->organiser_fee_fixed), 2);
}
/**
* Get the total booking fee of the ticket.
*
* @return float|int
*/
public function getTotalBookingFeeAttribute()
{
return $this->getBookingFeeAttribute() + $this->getOrganiserBookingFeeAttribute();
}
/**
* Get the total price of the ticket.
*
* @return float|int
*/
public function getTotalPriceAttribute()
{
return $this->getTotalBookingFeeAttribute() + $this->price;
}
/**
* Get the maximum and minimum range of the ticket.
*
* @return array
*/
public function getTicketMaxMinRangAttribute()
{
$range = [];
@ -104,6 +174,11 @@ class Ticket extends MyBaseModel
return $range;
}
/**
* Indicates if the ticket is free.
*
* @return bool
*/
public function isFree()
{
return (int) ceil($this->price) === 0;

View File

@ -13,6 +13,18 @@ namespace App\Models;
*/
class Timezone extends \Illuminate\Database\Eloquent\Model
{
/**
* Indicates if the model should be timestamped.
*
* @var bool $timestamps
*/
public $timestamps = false;
/**
* Indicates if the model should use soft deletes.
*
* @var bool $softDelete
*/
protected $softDelete = false;
}

View File

@ -20,7 +20,13 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
*/
protected $table = 'users';
/**
* The attributes that should be mutated to dates.
*
* @var array $dates
*/
public $dates = ['deleted_at'];
/**
* The attributes excluded from the model's JSON form.
*
@ -28,6 +34,11 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
*/
protected $hidden = ['password'];
/**
* The attributes that are mass assignable.
*
* @var array $fillable
*/
protected $fillable = [
'account_id',
'first_name',
@ -42,11 +53,21 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
'remember_token'
];
/**
* The account associated with the user.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function account()
{
return $this->belongsTo('\App\Models\Account');
}
/**
* The activity associated with the user.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function activity()
{
return $this->hasMany('\App\Models\Activity');
@ -82,21 +103,39 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
return $this->email;
}
/**
* Get the remember token for the user.
*
* @return \Illuminate\Support\Collection|mixed|static
*/
public function getRememberToken()
{
return $this->remember_token;
}
/**
* Set the remember token for the user.
*
* @param string $value
*/
public function setRememberToken($value)
{
$this->remember_token = $value;
}
/**
* Get the name of the remember token for the user.
*
* @return string
*/
public function getRememberTokenName()
{
return 'remember_token';
}
/**
* Boot all of the bootable traits on the model.
*/
public static function boot()
{
parent::boot();