Skip to content

Commit 8e62c3f

Browse files
committed
Shift bindings
PHP 5.5.9+ adds the new static `class` property which provides the fully qualified class name. This is preferred over using class name strings as these references are checked by the parser.
1 parent 34f0a3b commit 8e62c3f

File tree

7 files changed

+13
-13
lines changed

7 files changed

+13
-13
lines changed

app/Models/Activation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ class Activation extends Model
7878
*/
7979
public function user()
8080
{
81-
return $this->belongsTo('App\Models\User');
81+
return $this->belongsTo(\App\Models\User::class);
8282
}
8383
}

app/Models/Profile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Profile extends Model
4949
*/
5050
public function user()
5151
{
52-
return $this->belongsTo('App\Models\User');
52+
return $this->belongsTo(\App\Models\User::class);
5353
}
5454

5555
/**
@@ -59,6 +59,6 @@ public function user()
5959
*/
6060
public function theme()
6161
{
62-
return $this->hasOne('App\Models\Theme');
62+
return $this->hasOne(\App\Models\Theme::class);
6363
}
6464
}

app/Models/Social.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ class Social extends Model
7474
*/
7575
public function user()
7676
{
77-
return $this->belongsTo('App\Models\User');
77+
return $this->belongsTo(\App\Models\User::class);
7878
}
7979
}

app/Models/Theme.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ public static function rules($id = 0, $merge = [])
106106
*/
107107
public function profile()
108108
{
109-
return $this->hasMany('App\Models\Profile');
109+
return $this->hasMany(\App\Models\Profile::class);
110110
}
111111
}

app/Models/User.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,23 +107,23 @@ class User extends Authenticatable
107107
*/
108108
public function social()
109109
{
110-
return $this->hasMany('App\Models\Social');
110+
return $this->hasMany(\App\Models\Social::class);
111111
}
112112

113113
/**
114114
* Get the profile associated with the user.
115115
*/
116116
public function profile()
117117
{
118-
return $this->hasOne('App\Models\Profile');
118+
return $this->hasOne(\App\Models\Profile::class);
119119
}
120120

121121
/**
122122
* The profiles that belong to the user.
123123
*/
124124
public function profiles()
125125
{
126-
return $this->belongsToMany('App\Models\Profile')->withTimestamps();
126+
return $this->belongsToMany(\App\Models\Profile::class)->withTimestamps();
127127
}
128128

129129
/**

app/Providers/ComposerServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function boot()
1616
{
1717
View::composer(
1818
'layouts.app',
19-
'App\Http\ViewComposers\ThemeComposer'
19+
\App\Http\ViewComposers\ThemeComposer::class
2020
);
2121
}
2222

routes/web.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
// User Profile and Account Routes
7070
Route::resource(
7171
'profile',
72-
'App\Http\Controllers\ProfilesController',
72+
\App\Http\Controllers\ProfilesController::class,
7373
[
7474
'only' => [
7575
'show',
@@ -103,13 +103,13 @@
103103

104104
// Registered, activated, and is admin routes.
105105
Route::group(['middleware' => ['auth', 'activated', 'role:admin', 'activity', 'twostep', 'checkblocked']], function () {
106-
Route::resource('/users/deleted', 'App\Http\Controllers\SoftDeletesController', [
106+
Route::resource('/users/deleted', \App\Http\Controllers\SoftDeletesController::class, [
107107
'only' => [
108108
'index', 'show', 'update', 'destroy',
109109
],
110110
]);
111111

112-
Route::resource('users', 'App\Http\Controllers\UsersManagementController', [
112+
Route::resource('users', \App\Http\Controllers\UsersManagementController::class, [
113113
'names' => [
114114
'index' => 'users',
115115
'destroy' => 'user.destroy',
@@ -120,7 +120,7 @@
120120
]);
121121
Route::post('search-users', 'App\Http\Controllers\UsersManagementController@search')->name('search-users');
122122

123-
Route::resource('themes', 'App\Http\Controllers\ThemesManagementController', [
123+
Route::resource('themes', \App\Http\Controllers\ThemesManagementController::class, [
124124
'names' => [
125125
'index' => 'themes',
126126
'destroy' => 'themes.destroy',

0 commit comments

Comments
 (0)