Dakaa
Dakaa
Explore posts from servers
FFilament
Created by Dakaa on 1/13/2024 in #❓┊help
Any tips on to handle Many to Many (Polymorphic) using Filament?
2 replies
FFilament
Created by Dakaa on 10/11/2023 in #❓┊help
Is there a Select field for saving morphToMany relationship?
using this relationship: https://laravel.com/docs/10.x/eloquent-relationships#many-to-many-polymorphic-relations schemas defined:
Schema::create('ad_categories', function (Blueprint $table) {
$table->id();
$table->string('name');
});

Schema::create('ad_categorisables', function (Blueprint $table) {
$table->foreignId('ad_category_id');
$table->integer('ad_categorisable_id');
$table->string('ad_categorisable_type');
});

Schema::create('magazine_ads', function (Blueprint $table) {
$table->id();
$table->string('name');
});
Schema::create('ad_categories', function (Blueprint $table) {
$table->id();
$table->string('name');
});

Schema::create('ad_categorisables', function (Blueprint $table) {
$table->foreignId('ad_category_id');
$table->integer('ad_categorisable_id');
$table->string('ad_categorisable_type');
});

Schema::create('magazine_ads', function (Blueprint $table) {
$table->id();
$table->string('name');
});
models defined:
class AdCategory extends BaseModel
{
public function magazineAds(): MorphToMany
{
return $this->morphedByMany(MagazineAd::class, 'ad_categorisable');
}
}

class MagazineAd
{
public function adCategories(): MorphToMany
{
return $this->morphToMany(AdCategory::class, 'ad_categorisable');
}
}
class AdCategory extends BaseModel
{
public function magazineAds(): MorphToMany
{
return $this->morphedByMany(MagazineAd::class, 'ad_categorisable');
}
}

class MagazineAd
{
public function adCategories(): MorphToMany
{
return $this->morphToMany(AdCategory::class, 'ad_categorisable');
}
}
On MagazineAdResource, I want to attach one AdCategory to MagazineAd without using Relation Manager:
$magazineAd = MagazineAd::first(); // example
$adCategory = AdCategory::first();; // example


$magazineAd->adCategories()->attach($adCategory->id); // trying to achieve this part
$magazineAd = MagazineAd::first(); // example
$adCategory = AdCategory::first();; // example


$magazineAd->adCategories()->attach($adCategory->id); // trying to achieve this part
1 replies
FFilament
Created by Dakaa on 10/5/2023 in #❓┊help
How to translate the relationship name in relation manager?
for example the relationship is blogPosts so the relation manager's table header automatically named as Blog Posts, but how do I make it translatable?
8 replies
FFilament
Created by Dakaa on 10/4/2023 in #❓┊help
How to translate a resource's names?
page title buttons
3 replies
FFilament
Created by Dakaa on 9/19/2023 in #❓┊help
Is there a way to replace plugin's navigation icon?
As titled.
6 replies
FFilament
Created by Dakaa on 8/30/2023 in #❓┊help
How to change the logo size?
How to change the logo size? <img src="{{ asset('/images/logo.svg') }}" alt="Logo" class="h-10"> Anything other than h-10 doesn't work?
10 replies
FFilament
Created by Dakaa on 4/21/2023 in #❓┊help
My changes on Filament namespace are not showing on production server
As titled.
1 replies