Killersea
Killersea
FFilament
Created by Killersea on 12/13/2023 in #❓┊help
Problem using Many to Many relationship, using filament v2.
if i change both models relationship to has many it gives me this error Filament\Forms\Components\Select::getRelationship(): Return value must be of type Illuminate\Database\Eloquent\Relations\BelongsTo|Illuminate\Database\Eloquent\Relations\BelongsToMany|Znck\Eloquent\Relations\BelongsToThrough|null, Illuminate\Database\Eloquent\Relations\HasMany returned
7 replies
FFilament
Created by Killersea on 12/13/2023 in #❓┊help
Problem using Many to Many relationship, using filament v2.
here is the migration file
public function up()
{
Schema::create('books', function (Blueprint $table) {
$table->id();
$table->foreignId('author_id')->constrained()->cascadeOnDelete();
$table->foreignId('category_id')->constrained()->cascadeOnDelete();
$table->string('image');
$table->string('title');
$table->string('publication_date');
$table->string('copies');
$table->timestamps();
});
}
public function up()
{
Schema::create('books', function (Blueprint $table) {
$table->id();
$table->foreignId('author_id')->constrained()->cascadeOnDelete();
$table->foreignId('category_id')->constrained()->cascadeOnDelete();
$table->string('image');
$table->string('title');
$table->string('publication_date');
$table->string('copies');
$table->timestamps();
});
}
7 replies
FFilament
Created by Killersea on 12/13/2023 in #❓┊help
Problem using Many to Many relationship, using filament v2.
this is the data shown in the debug
{
"image": {
"c41f8d48-1a70-4805-8a01-df8e0c133302": "livewire-file:gpdZM3zQJ7DfHqNPkjDZ61iVKtPuFu-metaYm9va19ub3VuXzAwMV8wMTY3OS5qcGc=-.jpg"
},
"title": "as",
"author_id": "1",
"category_id": [
"1",
"3",
"2"
],
"publication_date": "as",
"copies": "as"
}
{
"image": {
"c41f8d48-1a70-4805-8a01-df8e0c133302": "livewire-file:gpdZM3zQJ7DfHqNPkjDZ61iVKtPuFu-metaYm9va19ub3VuXzAwMV8wMTY3OS5qcGc=-.jpg"
},
"title": "as",
"author_id": "1",
"category_id": [
"1",
"3",
"2"
],
"publication_date": "as",
"copies": "as"
}
but why is the category_id is not inserting to the category_id or it cant find it
7 replies
FFilament
Created by Killersea on 12/13/2023 in #❓┊help
Problem using Many to Many relationship, using filament v2.
Im creating a LMS for my project badly need help for this been debugging for hours thank you in advance
7 replies