Courses

Laravel Filament Admin v2: Practical Course

HasMany Relationship: Use withCount in Table

Previous: Validation Unique and Input Type Number
avatar

user table have role column, role is user and admin, login user then redirect admin/dashboard, and login user redirect user/dashboard, it's posible?

avatar

In Filament 2, it is solved this way

In Filament 3, it is solved with multiple panels, this way: course tutorial or YouTube video

avatar
You can use Markdown
avatar

i think this didn't work with me: in my case

My $table resource:

Tables\Columns\TextColumn::make('total_shipments')->counts('shipment')

Shipments Model:

    public function company()
    {
        return $this->belongsTo(Company::class);
    }

Company Model:

    public function shipment()
    {
        return $this->hasMany(Shipment::class);
    }

shipment Database schema:

Schema::create('shipments', function (Blueprint $table) {
 $table->id();
 $table->foreignId('vehicle_id')->constrained('vehicles');
 $table->foreignId('driver_id')->constrained('drivers');
 $table->foreignId('customer_id')->constrained('customers');
 $table->foreignId('company_id')->constrained('companies');
 $table->string('shipment_number')->unique()->nullable();
 $table->string('status');
 $table->string('from');
 $table->string('to');
 $table->text('description')->nullable();
 $table->date('shipment_date');
 $table->timestamps();
});

and returning empty values

avatar
You can use Markdown
avatar
You can use Markdown