We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
@@ 11-71 (lines=61) @@ | ||
8 | use DoeSangue\Models\Comment; |
|
9 | use Webpatser\Uuid\Uuid; |
|
10 | ||
11 | class Campaign extends Model |
|
12 | { |
|
13 | ||
14 | use SoftDeletes; |
|
15 | ||
16 | /** |
|
17 | * The table associated with the model. |
|
18 | * |
|
19 | * @var string |
|
20 | */ |
|
21 | protected $table = 'campaigns'; |
|
22 | ||
23 | /** |
|
24 | * Indicates if the IDs are auto-incrementing. |
|
25 | * |
|
26 | * @var bool |
|
27 | */ |
|
28 | public $incrementing = false; |
|
29 | ||
30 | /** |
|
31 | * The attributes that are mass assignable. |
|
32 | * |
|
33 | * @var array |
|
34 | */ |
|
35 | protected $filliable = [ 'title', 'description', 'image', 'expires', 'user_id' ]; |
|
36 | ||
37 | protected $hidden = [ 'created_at', 'updated_at', 'deleted_at', 'user_id' ]; |
|
38 | ||
39 | protected $dates = [ |
|
40 | 'created_at', 'updated_at', 'deleted_at' |
|
41 | ]; |
|
42 | ||
43 | /** |
|
44 | * Return the owner of campaign |
|
45 | */ |
|
46 | public function owner() |
|
47 | { |
|
48 | return $this->belongsTo(User::class, 'user_id'); |
|
49 | } |
|
50 | ||
51 | public function comments() |
|
52 | { |
|
53 | return $this->hasMany(Comment::class); |
|
54 | } |
|
55 | ||
56 | /** |
|
57 | * Generate automaticaly the Campaign id(uuid). |
|
58 | * |
|
59 | * @return void |
|
60 | */ |
|
61 | public static function boot() |
|
62 | { |
|
63 | parent::boot(); |
|
64 | self::creating( |
|
65 | function ($model) { |
|
66 | // Generate a version 4 Uuid. |
|
67 | $model->id = (string) Uuid::generate(4)->string; |
|
68 | } |
|
69 | ); |
|
70 | } |
|
71 | } |
|
72 |
@@ 11-84 (lines=74) @@ | ||
8 | use DoeSangue\Models\Campaign; |
|
9 | use Webpatser\Uuid\Uuid; |
|
10 | ||
11 | class Comment extends Model |
|
12 | { |
|
13 | ||
14 | use SoftDeletes; |
|
15 | ||
16 | /** |
|
17 | * The table associated with the model. |
|
18 | * |
|
19 | * @var string |
|
20 | */ |
|
21 | protected $table = 'comments'; |
|
22 | ||
23 | /** |
|
24 | * Indicates if the IDs are auto-incrementing. |
|
25 | * |
|
26 | * @var bool |
|
27 | */ |
|
28 | public $incrementing = false; |
|
29 | ||
30 | /** |
|
31 | * The attributes that are mass assignable. |
|
32 | * |
|
33 | * @var array |
|
34 | */ |
|
35 | protected $filliable = [ |
|
36 | 'comment_id', |
|
37 | 'id', |
|
38 | 'comment', |
|
39 | 'campaign_id', |
|
40 | 'user_id' |
|
41 | ]; |
|
42 | ||
43 | protected $primaryKey = 'comment_id'; |
|
44 | ||
45 | protected $dates = [ |
|
46 | 'created_at', |
|
47 | 'updated_at' |
|
48 | ]; |
|
49 | ||
50 | protected $hidden = [ |
|
51 | 'created_at', |
|
52 | 'updated_at', |
|
53 | 'user_id', |
|
54 | 'campaign_id' |
|
55 | ]; |
|
56 | ||
57 | // protected $casts = [ 'commentator', 'campaign' ]; |
|
58 | ||
59 | public function commentator() |
|
60 | { |
|
61 | return $this->belongsTo(User::class, 'user_id'); |
|
62 | } |
|
63 | ||
64 | public function campaign() |
|
65 | { |
|
66 | return $this->belongsTo(Campaign::class); |
|
67 | } |
|
68 | ||
69 | /** |
|
70 | * Generate automaticaly the Comment id(uuid). |
|
71 | * |
|
72 | * @return void |
|
73 | */ |
|
74 | public static function boot() |
|
75 | { |
|
76 | parent::boot(); |
|
77 | self::creating( |
|
78 | function ($model) { |
|
79 | // Generate a version 4 Uuid. |
|
80 | $model->id = (string) Uuid::generate(4)->string; |
|
81 | } |
|
82 | ); |
|
83 | } |
|
84 | } |
|
85 |