Laravel-Backpack /
CRUD
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||||
| 2 | |||||
| 3 | namespace Backpack\CRUD\Tests\Config\Models; |
||||
| 4 | |||||
| 5 | use Backpack\CRUD\app\Models\Traits\CrudTrait; |
||||
| 6 | use Illuminate\Database\Eloquent\Model; |
||||
| 7 | |||||
| 8 | class User extends Model |
||||
| 9 | { |
||||
| 10 | use CrudTrait; |
||||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||||
| 11 | |||||
| 12 | protected $table = 'users'; |
||||
| 13 | |||||
| 14 | protected $fillable = ['name', 'email', 'password', 'extras', 'bang_relation_field']; |
||||
| 15 | |||||
| 16 | public function identifiableAttribute() |
||||
| 17 | { |
||||
| 18 | return 'name'; |
||||
| 19 | } |
||||
| 20 | |||||
| 21 | /** |
||||
| 22 | * Get the account details associated with the user. |
||||
| 23 | */ |
||||
| 24 | public function accountDetails() |
||||
| 25 | { |
||||
| 26 | return $this->hasOne('Backpack\CRUD\Tests\config\Models\AccountDetails'); |
||||
| 27 | } |
||||
| 28 | |||||
| 29 | /** |
||||
| 30 | * Get the articles for this user. |
||||
| 31 | */ |
||||
| 32 | public function articles() |
||||
| 33 | { |
||||
| 34 | return $this->hasMany('Backpack\CRUD\Tests\config\Models\Article'); |
||||
| 35 | } |
||||
| 36 | |||||
| 37 | /** |
||||
| 38 | * Get the user roles. |
||||
| 39 | */ |
||||
| 40 | public function roles() |
||||
| 41 | { |
||||
| 42 | return $this->belongsToMany('Backpack\CRUD\Tests\config\Models\Role', 'user_role'); |
||||
| 43 | } |
||||
| 44 | |||||
| 45 | public function getNameComposedAttribute() |
||||
| 46 | { |
||||
| 47 | return $this->name.'++'; |
||||
| 48 | } |
||||
| 49 | |||||
| 50 | public function comment() |
||||
| 51 | { |
||||
| 52 | return $this->morphOne('Backpack\CRUD\Tests\config\Models\Comment', 'commentable'); |
||||
| 53 | } |
||||
| 54 | |||||
| 55 | public function recommends() |
||||
| 56 | { |
||||
| 57 | return $this->morphToMany('Backpack\CRUD\Tests\config\Models\Recommend', 'recommendable')->withPivot('text'); |
||||
| 58 | } |
||||
| 59 | |||||
| 60 | public function recommendsDuplicate() |
||||
| 61 | { |
||||
| 62 | return $this->morphToMany('Backpack\CRUD\Tests\config\Models\Recommend', 'recommendable')->withPivot(['text', 'id']); |
||||
| 63 | } |
||||
| 64 | |||||
| 65 | public function bills() |
||||
| 66 | { |
||||
| 67 | return $this->morphToMany('Backpack\CRUD\Tests\config\Models\Bill', 'billable'); |
||||
| 68 | } |
||||
| 69 | |||||
| 70 | public function stars() |
||||
| 71 | { |
||||
| 72 | return $this->morphMany('Backpack\CRUD\Tests\config\Models\Star', 'starable'); |
||||
| 73 | } |
||||
| 74 | |||||
| 75 | public function superArticles() |
||||
| 76 | { |
||||
| 77 | return $this->belongsToMany('Backpack\CRUD\Tests\config\Models\Article', 'articles_user')->withPivot(['notes', 'start_date', 'end_date']); |
||||
| 78 | } |
||||
| 79 | |||||
| 80 | public function superArticlesDuplicates() |
||||
| 81 | { |
||||
| 82 | return $this->belongsToMany('Backpack\CRUD\Tests\config\Models\Article', 'articles_user') |
||||
| 83 | ->withPivot(['notes', 'start_date', 'end_date', 'id']) |
||||
| 84 | ->using('Backpack\CRUD\Tests\config\Models\SuperArticlePivot'); |
||||
| 85 | } |
||||
| 86 | |||||
| 87 | public function universes() |
||||
| 88 | { |
||||
| 89 | return $this->hasMany('Backpack\CRUD\Tests\config\Models\Universe'); |
||||
| 90 | } |
||||
| 91 | |||||
| 92 | public function planets() |
||||
| 93 | { |
||||
| 94 | return $this->hasMany('Backpack\CRUD\Tests\config\Models\Planet'); |
||||
| 95 | } |
||||
| 96 | |||||
| 97 | public function planetsNonNullable() |
||||
| 98 | { |
||||
| 99 | return $this->hasMany('Backpack\CRUD\Tests\config\Models\PlanetNonNullable'); |
||||
| 100 | } |
||||
| 101 | |||||
| 102 | public function comets() |
||||
| 103 | { |
||||
| 104 | return $this->hasMany('Backpack\CRUD\Tests\config\Models\Comet'); |
||||
| 105 | } |
||||
| 106 | |||||
| 107 | public function bang() |
||||
| 108 | { |
||||
| 109 | return $this->belongsTo('Backpack\CRUD\Tests\config\Models\Bang', 'bang_relation_field'); |
||||
| 110 | } |
||||
| 111 | |||||
| 112 | public function incomes() |
||||
| 113 | { |
||||
| 114 | return $this->hasMany('Backpack\CRUD\Tests\config\Models\Transaction')->ofType('income'); |
||||
| 115 | } |
||||
| 116 | |||||
| 117 | public function expenses() |
||||
| 118 | { |
||||
| 119 | return $this->hasMany('Backpack\CRUD\Tests\config\Models\Transaction')->ofType('expense'); |
||||
| 120 | } |
||||
| 121 | |||||
| 122 | protected function isNotRelation() |
||||
| 123 | { |
||||
| 124 | return false; |
||||
| 125 | } |
||||
| 126 | |||||
| 127 | public function isNotRelationPublic($arg) |
||||
|
0 ignored issues
–
show
The parameter
$arg is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||
| 128 | { |
||||
| 129 | return false; |
||||
| 130 | } |
||||
| 131 | } |
||||
| 132 |