Rizky Anfasa F M
Rizky Anfasa F M
FFilament
Created by Rizky Anfasa F M on 7/29/2024 in #❓┊help
Associate Action doesn't work
I have 2 table, there is schools and students table. School Model
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class School extends Model
{
use HasFactory;

protected $fillable = [
'name',
];

public function students(): HasMany
{
return $this->hasMany(Student::class);
}
}
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;

class School extends Model
{
use HasFactory;

protected $fillable = [
'name',
];

public function students(): HasMany
{
return $this->hasMany(Student::class);
}
}
Student Model
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Student extends Model
{
use HasFactory;

protected $fillable = [
'name',
'school_id',
];

public function school(): BelongsTo
{
return $this->belongsTo(School::class);
}
}
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Student extends Model
{
use HasFactory;

protected $fillable = [
'name',
'school_id',
];

public function school(): BelongsTo
{
return $this->belongsTo(School::class);
}
}
I'am implement student relation manager with associate action in school resource, but i got error like this
Call to undefined method App\Models\Student::schools()
Call to undefined method App\Models\Student::schools()
is my scenario true or false? that associate action must implement for has many relationship. one school has many student, one student belongs to school
2 replies
FFilament
Created by Rizky Anfasa F M on 7/10/2023 in #❓┊help
Can I am using searchable method, in SelectColumn?
In table i am using SelectColumn and using searchable method too. but, search input does'nt appear SelectColumn::make('team_bank_account_id') ->label('Nomor Rekening Tim') ->extraAttributes(['class' => 'text-sm']) ->searchable() ->hidden(fn () => auth()->user()->cannot('update_bank_account_transaction::waiting::transaction')) ->options(function ($record) { $teamBanks = TeamBankAccount::where('team_id', $record->team_id) ->whereState('account_status', Active::class)->get(); return $teamBanks->mapWithKeys(fn ($item) => [$item->id => "{$item->bank->name} - " . \Str::limit($item->account_number . ' ' . "($item->account_holder)", 20)]); }),
3 replies
FFilament
Created by Rizky Anfasa F M on 6/6/2023 in #❓┊help
Calculate Repeater
2 replies