multiple() fields on /create return null
Full Disclosure: very inexperienced with Filament and php in general.
Began this project a while ago in my free time with V2+Companies plugin and plan to finish it before going for V3.
Trying to save an array of tag IDs as JSON, fields not registered (first time implementing Multiple() Filament logic). Any advice would be much appreciated
Error:
Migration
Model
Began this project a while ago in my free time with V2+Companies plugin and plan to finish it before going for V3.
Trying to save an array of tag IDs as JSON, fields not registered (first time implementing Multiple() Filament logic). Any advice would be much appreciated
Error:
SQLSTATE[HY000]: General error: 1364 Field 'tenyi' doesn't have a default value
insert into
company_interiors (
shiyou_henkou,
company_id,
updated_at,
created_at
)
values
(1, 2, 2023 -08 -29 07: 18: 37, 2023 -08 -29 07: 18: 37)SQLSTATE[HY000]: General error: 1364 Field 'tenyi' doesn't have a default value
insert into
company_interiors (
shiyou_henkou,
company_id,
updated_at,
created_at
)
values
(1, 2, 2023 -08 -29 07: 18: 37, 2023 -08 -29 07: 18: 37)Migration
Schema::create('company_interiors', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Company::class, 'company_id');
$table->json('tenyi');
$table->json('yuka');
$table->json('kabe');
$table->json('kengu');
$table->boolean('shiyou_henkou');
$table->timestamps(); Schema::create('company_interiors', function (Blueprint $table) {
$table->id();
$table->foreignIdFor(\App\Models\Company::class, 'company_id');
$table->json('tenyi');
$table->json('yuka');
$table->json('kabe');
$table->json('kengu');
$table->boolean('shiyou_henkou');
$table->timestamps();Model
Model
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class CompanyInterior extends Model
{
use HasFactory;
protected $table = 'company_interiors';
protected $casts = [
'tenyi' => 'array',
'yuka' => 'array',
'kabe' => 'array',
'kengu' => 'array',
'shiyou_henkou' => 'boolean'
];
protected $fillable = [
'company_id',
'tenyi',
'yuka',
'kabe',
'kengu',
'shiyou_henkou'
];
public function types(): BelongsToMany
{
return $this->belongsToMany(InteriorProvider::class);
}
}Model
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class CompanyInterior extends Model
{
use HasFactory;
protected $table = 'company_interiors';
protected $casts = [
'tenyi' => 'array',
'yuka' => 'array',
'kabe' => 'array',
'kengu' => 'array',
'shiyou_henkou' => 'boolean'
];
protected $fillable = [
'company_id',
'tenyi',
'yuka',
'kabe',
'kengu',
'shiyou_henkou'
];
public function types(): BelongsToMany
{
return $this->belongsToMany(InteriorProvider::class);
}
}