1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* rmarchiv.tk |
5
|
|
|
* (c) 2016-2017 by Marcel 'ryg' Hering |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace App\Models; |
9
|
|
|
|
10
|
|
|
use GeneaLabs\LaravelModelCaching\Traits\Cachable; |
11
|
|
|
use Illuminate\Database\Eloquent\Model; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class News. |
15
|
|
|
* |
16
|
|
|
* @property int $id |
17
|
|
|
* @property string $title |
18
|
|
|
* @property string $news_md |
19
|
|
|
* @property string $news_html |
20
|
|
|
* @property string $news_category |
21
|
|
|
* @property int $user_id |
22
|
|
|
* @property string $deleted_at |
23
|
|
|
* @property \Carbon\Carbon $created_at |
24
|
|
|
* @property \Carbon\Carbon $updated_at |
25
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereId($value) |
26
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereTitle($value) |
27
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereNewsMd($value) |
28
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereNewsHtml($value) |
29
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereNewsCategory($value) |
30
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereUserId($value) |
31
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereDeletedAt($value) |
32
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereCreatedAt($value) |
33
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereUpdatedAt($value) |
34
|
|
|
* @mixin \Eloquent |
35
|
|
|
* @property-read \App\Models\User $user |
36
|
|
|
* @property int $approved |
37
|
|
|
* @method static \Illuminate\Database\Query\Builder|\App\Models\News whereApproved($value) |
38
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Comment[] $comments |
39
|
|
|
* @property-read \Illuminate\Database\Eloquent\Collection|\Venturecraft\Revisionable\Revision[] $revisionHistory |
40
|
|
|
*/ |
41
|
|
|
class News extends Model |
42
|
|
|
{ |
43
|
|
|
use \Venturecraft\Revisionable\RevisionableTrait; |
44
|
|
|
public $timestamps = true; |
|
|
|
|
45
|
|
|
protected $table = 'news'; |
|
|
|
|
46
|
|
|
protected $fillable = [ |
47
|
|
|
'title', |
48
|
|
|
'news_md', |
49
|
|
|
'news_html', |
50
|
|
|
'news_category', |
51
|
|
|
'user_id', |
52
|
|
|
'approved', |
53
|
|
|
]; |
54
|
|
|
|
55
|
|
|
protected $guarded = []; |
56
|
|
|
|
57
|
|
|
public function user() |
58
|
|
|
{ |
59
|
|
|
return $this->hasOne('App\Models\User', 'id', 'user_id'); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
public function comments() |
|
|
|
|
63
|
|
|
{ |
64
|
|
|
return $this->hasMany('App\Models\Comment', 'content_id', 'id') |
65
|
|
|
->Where('content_type', '=', \DB::raw("'news'")) |
66
|
|
|
->with('user'); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.