Skip to content

Commit 160235b

Browse files
committed
♻️ Refactoring code: updated to use FQCL
1 parent 05c021e commit 160235b

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

app/Answer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ class Answer extends Model
1313

1414
public function user()
1515
{
16-
return $this->belongsTo('App\User');
16+
return $this->belongsTo(User::class);
1717
}
1818

1919
public function question()
2020
{
21-
return $this->belongsTo('App\Question');
21+
return $this->belongsTo(Question::class);
2222
}
2323

2424
public function votes()
2525
{
26-
return $this->hasMany('App\Vote');
26+
return $this->hasMany(Vote::class);
2727
}
2828

2929
/**

app/Question.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ class Question extends Model
1414
// Create the relationship to users
1515
public function user()
1616
{
17-
return $this->belongsTo('App\User');
17+
return $this->belongsTo(User::class);
1818
}
1919

2020
// Create the relationship to answers
2121
public function answers()
2222
{
23-
return $this->hasMany('App\Answer');
23+
return $this->hasMany(Answer::class);
2424
}
2525

2626
// Create the relationship to votes
2727
public function votes()
2828
{
29-
return $this->hasMany('App\Vote');
29+
return $this->hasMany(Vote::class);
3030
}
3131

3232
// Using a relationship table or a 'pivot' table.

app/Vote.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ class Vote extends Model
2424

2525
public function user()
2626
{
27-
return $this->belongsTo('App\User');
27+
return $this->belongsTo(User::class);
2828
}
2929

3030
public function answer()
3131
{
32-
return $this->belongsTo('App\Answer');
32+
return $this->belongsTo(Answer::class);
3333
}
3434

3535
/**

0 commit comments

Comments
 (0)