Answer the question
In order to leave comments, you need to log in
Why is the simple :string method of the Eloquent model called as a relation in laravel?
Good afternoon,
There is a misunderstanding when calling the method of the Edition model .
namespace App\Entity\Vehicle;
use Illuminate\Database\Eloquent\Model;
class Edition extends Model
{
public function brand()
{
return $this->belongsTo(Brand::class);
}
public function joke() :string
{
return 'hello';
}
}
$edition = Edition::findOrFail(1);
dd($edition->joke());
dd($edition->brand());
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question