| Total Complexity | 4 |
| Total Lines | 65 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class User extends Authenticatable |
||
| 12 | { |
||
| 13 | use Notifiable; |
||
|
|
|||
| 14 | |||
| 15 | /** |
||
| 16 | * The attributes that are mass assignable. |
||
| 17 | * |
||
| 18 | * @var array |
||
| 19 | */ |
||
| 20 | protected $fillable = [ |
||
| 21 | 'name', 'biography', 'profile_picture', 'email', 'password', 'provider', 'provider_id' |
||
| 22 | ]; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * The attributes that should be hidden for arrays. |
||
| 26 | * |
||
| 27 | * @var array |
||
| 28 | */ |
||
| 29 | protected $hidden = [ |
||
| 30 | 'password', 'remember_token', |
||
| 31 | ]; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * The attributes that should be cast to native types. |
||
| 35 | * |
||
| 36 | * @var array |
||
| 37 | */ |
||
| 38 | protected $casts = [ |
||
| 39 | 'email_verified_at' => 'datetime', |
||
| 40 | ]; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @var array |
||
| 44 | */ |
||
| 45 | protected $dates = [ |
||
| 46 | 'created_at', |
||
| 47 | 'updated_at' |
||
| 48 | ]; |
||
| 49 | |||
| 50 | public function thread() { |
||
| 51 | return $this->hasMany('App\Thread', 'user_id'); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return int |
||
| 56 | */ |
||
| 57 | public function threadAnswered() { |
||
| 58 | return count( |
||
| 59 | Thread::where('status', true) |
||
| 60 | ->where('user_id', Auth::guard('web') |
||
| 61 | ->user()->id) |
||
| 62 | ->get() |
||
| 63 | ); |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param string $str |
||
| 68 | * @return string |
||
| 69 | */ |
||
| 70 | public function trimStr(string $str) |
||
| 76 | } |
||
| 77 | } |
||
| 78 |