Completed
Push — master ( 81034a...b50ff0 )
by Faiq
20s queued 11s
created

User::thread()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App;
4
5
use Illuminate\Notifications\Notifiable;
6
use Illuminate\Contracts\Auth\MustVerifyEmail;
7
use Carbon\Carbon;
8
use Illuminate\Foundation\Auth\User as Authenticatable;
9
10
class User extends Authenticatable
11
{
12
    use Notifiable;
0 ignored issues
show
introduced by
The trait Illuminate\Notifications\Notifiable requires some properties which are not provided by App\User: $email, $phone_number
Loading history...
13
14
    /**
15
     * The attributes that are mass assignable.
16
     *
17
     * @var array
18
     */
19
    protected $fillable = [
20
        'name', 'biography', 'profile_picture', 'email', 'password', 'provider', 'provider_id'
21
    ];
22
23
    /**
24
     * The attributes that should be hidden for arrays.
25
     *
26
     * @var array
27
     */
28
    protected $hidden = [
29
        'password', 'remember_token',
30
    ];
31
32
    /**
33
     * The attributes that should be cast to native types.
34
     *
35
     * @var array
36
     */
37
    protected $casts = [
38
        'email_verified_at' => 'datetime',
39
    ];
40
41
    /**
42
     * @var array
43
     */
44
    protected $dates = [
45
        'created_at',
46
        'updated_at'
47
    ];
48
49
    public function thread() {
50
        return $this->hasMany('App\Thread', 'user_id');
51
    }
52
53
    /**
54
     * @param string $str
55
     */
56
    public function trimStr(string $str)
57
    {
58
        if(strlen($str) > 50) {
59
            return substr($str, '0', '50')."...";
60
        }
61
        return $str;
62
    }
63
}
64