12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace App;
- use Illuminate\Contracts\Auth\MustVerifyEmail;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Illuminate\Notifications\Notifiable;
- class User extends Authenticatable
- {
- use Notifiable;
- /**
- * The attributes that are mass assignable.
- *
- * @var array
- */
- protected $fillable = [
- 'name', 'email', 'password', 'surname', 'username', 'day', 'month',
- 'year', 'skill', 'about', 'balance', 'country_id', 'city_id',
- 'group', 'ban_info', 'avatar_url', 'status_text', 'dob', 'verify'
- ];
- /**
- * The attributes that should be hidden for arrays.
- *
- * @var array
- */
- protected $hidden = [
- 'password', 'remember_token',
- ];
- /**
- * The attributes that should be cast to native types.
- *
- * @var array
- */
- protected $casts = [
- 'email_verified_at' => 'datetime',
- ];
- private $online_minutes = 15;
- public function city()
- {
- return $this->hasOne('App\City', 'id', 'city_id');
- }
- public function country()
- {
- return $this->hasOne('App\Country', 'id', 'country_id');
- }
- public function articles()
- {
- return $this->hasMany('App\Article', 'user_id', 'id')->latest();
- }
- public function online()
- {
- $control_time = $this->online_minutes * 60;
- return ((time() - $this->online) > $control_time) ? false : true;
- }
- }
|