When I build an Eloquent relationship it makes problem here I show my code I use tinker to see relation but it doesn't build
pass.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class pass extends Model
{
public function salman()
{
return $this->belongsTo(salman::class);
}
}
salman.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class salman extends Model
{
public function passport()
{
return $this->hasOne(pass::class);
}
}
Illuminate \ Database \ QueryException (42S22) SQLSTATE[42S22]: Column not found: 1054 Unknown column 'passes.salman_id' in 'where clause' (SQL: select * from
passes
wherepasses
.salman_id
= 1 andpasses
.salman_id
is not null limit 1)
Previous exceptions
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'passes.salman_id' in 'where clause' (42S22)