Shift bindings
PHP 5.5.9+ adds the new static `class` property which provides the fully qualified class name. This is preferred over using strings for class names since the `class` property references are checked by PHP.
This commit is contained in:
parent
b1dc4d4a41
commit
297c2bb30f
5 changed files with 11 additions and 11 deletions
|
@ -43,7 +43,7 @@ class Application extends Model
|
|||
$name = $this->name;
|
||||
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
|
||||
|
||||
$class = '\App\SupportedApps\\'.$name.'\\'.$name;
|
||||
$class = \App\SupportedApps::class.$name.'\\'.$name;
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ class Application extends Model
|
|||
{
|
||||
$name = preg_replace('/[^\p{L}\p{N}]/u', '', $name);
|
||||
|
||||
$class = '\App\SupportedApps\\'.$name.'\\'.$name;
|
||||
$class = \App\SupportedApps::class.$name.'\\'.$name;
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ class Application extends Model
|
|||
return null;
|
||||
}
|
||||
$classname = preg_replace('/[^\p{L}\p{N}]/u', '', $app->name);
|
||||
$app->class = '\App\SupportedApps\\'.$classname.'\\'.$classname;
|
||||
$app->class = \App\SupportedApps::class.$classname.'\\'.$classname;
|
||||
|
||||
return $app;
|
||||
}
|
||||
|
|
|
@ -84,12 +84,12 @@ class Item extends Model
|
|||
|
||||
public function parents()
|
||||
{
|
||||
return $this->belongsToMany('App\Item', 'item_tag', 'item_id', 'tag_id');
|
||||
return $this->belongsToMany(\App\Item::class, 'item_tag', 'item_id', 'tag_id');
|
||||
}
|
||||
|
||||
public function children()
|
||||
{
|
||||
return $this->belongsToMany('App\Item', 'item_tag', 'tag_id', 'item_id');
|
||||
return $this->belongsToMany(\App\Item::class, 'item_tag', 'tag_id', 'item_id');
|
||||
}
|
||||
|
||||
public function getLinkAttribute()
|
||||
|
@ -257,6 +257,6 @@ class Item extends Model
|
|||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
return $this->belongsTo(\App\User::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ class Setting extends Model
|
|||
|
||||
public function group()
|
||||
{
|
||||
return $this->belongsTo('App\SettingGroup', 'group_id');
|
||||
return $this->belongsTo(\App\SettingGroup::class, 'group_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -232,7 +232,7 @@ class Setting extends Model
|
|||
*/
|
||||
public function users()
|
||||
{
|
||||
return $this->belongsToMany('App\User')->using('App\SettingUser')->withPivot('uservalue');
|
||||
return $this->belongsToMany(\App\User::class)->using(\App\SettingUser::class)->withPivot('uservalue');
|
||||
}
|
||||
|
||||
public static function user()
|
||||
|
|
|
@ -22,6 +22,6 @@ class SettingGroup extends Model
|
|||
|
||||
public function settings()
|
||||
{
|
||||
return $this->hasMany('App\Setting', 'group_id');
|
||||
return $this->hasMany(\App\Setting::class, 'group_id');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class User extends Authenticatable
|
|||
*/
|
||||
public function items()
|
||||
{
|
||||
return $this->hasMany('App\Item');
|
||||
return $this->hasMany(\App\Item::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,7 @@ class User extends Authenticatable
|
|||
*/
|
||||
public function settings()
|
||||
{
|
||||
return $this->belongsToMany('App\Setting')->withPivot('uservalue');
|
||||
return $this->belongsToMany(\App\Setting::class)->withPivot('uservalue');
|
||||
}
|
||||
|
||||
public static function currentUser()
|
||||
|
|
Loading…
Reference in a new issue