© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
17 replies
Avriant

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:
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);
    }
}
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

All fields are null :(
FilamentFFilament / ❓┊help
3y ago
Livewire Component return null
FilamentFFilament / ❓┊help
2y ago
Multiple dependant fields / clearing on change
FilamentFFilament / ❓┊help
2y ago
Create & create another - reuse fields
FilamentFFilament / ❓┊help
3y ago