отношения в модели JobLaravel "внешнего ключа не выполняется"
public function account()
{
return $this->belongsTo(EbayAccount::class, 'id', 'account_id');
}
отношения в EbayAccount
public function jobs()
{
return $this->hasMany(Job::class, 'account_id', 'id');
}
основной код // что работа
$job = new Job();
$job->account_id = $acc->id;
$job->action = 'getOrders';
$job->days = 30;
$job->save();
// что не работает
Job::create([
'account_id' => $acc->id,
'action' => 'getOrders',
'days' => 30
]);
// ошибка 'account_ID' ограничение внешнего ключа не удается
создать таблицу заданий
$table->integer('account_id')->unsigned()->index();
$table->foreign('account_id')->references('id')->on('ebay_accounts')->onDelete('cascade');
writed
protected $fillable = [
'account_id','action', 'priority', 'pagination', 'p2', 'p3', 'days','day_start', 'day_end', 'done'
];
Дайте схему ваших столов! – BeS