Closed eugenem closed 6 months ago
Is it supposed to work?
I get this error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'workers' in 'field list' (SQL: insert into extra_jobs (date, workers_number, workers, approved_by, work_done, materials, notes, project_id) values (2023-12-11 00:00:00, 12, ?, 3123, 123, 22, 123, 18))
extra_jobs
date
workers_number
workers
approved_by
work_done
materials
notes
project_id
So basically instead of filling relation, it's trying to fill the column...
$tabs->appendTab(AdminForm::elements([ AdminFormElement::hasMany( 'extra_jobs', [AdminFormElement::columns([[ AdminFormElement::date( 'date', 'תאריך' ), AdminFormElement::number('workers_number', 'כמות עובדים')],[ AdminFormElement::multiselect('workers', 'עובדים') ->setOptions(\App\Models\Worker::pluck('name','id')->toArray()), AdminFormElement::text('approved_by', 'שם מאשר')],[ AdminFormElement::text('work_done', 'עבודה שבוצעה'), AdminFormElement::text('materials', 'חומרים')],[ AdminFormElement::textarea('notes', 'הערה')],[ ]])]), ]), 'עבודות נוספות (חריגים)'); class ExtraJob extends \Eloquent { public $timestamps = false; protected $guarded = ['id']; protected $dates = ['date']; public function project() { return $this->belongsTo('\App\Models\Project'); } public function workers() { return $this->belongsToMany('\App\Models\Worker'); } }
this error has been fixed
Is it supposed to work?
I get this error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'workers' in 'field list' (SQL: insert into
extra_jobs
(date
,workers_number
,workers
,approved_by
,work_done
,materials
,notes
,project_id
) values (2023-12-11 00:00:00, 12, ?, 3123, 123, 22, 123, 18))So basically instead of filling relation, it's trying to fill the column...