leeb98
Multi Tenancy
Got all my edit functions running for a typically club situation (ie User / membership ) I have added an additional table/class call Club, Ie there are +20 Clubs, The membership table key attributes are ClubID and UserID. Therefore the ER would look like : club 1: m (Membership) M:1 User ( ie a many to many relationship. Therefore it is possible for a User to belong to many Clubs
I have followed a few youtube videos but they are always 'one to many' . By following some of the videos , i was successfully able to logon to a user with a 1:1 and was redirected to /admin/{ClubID} . error : page not found , this is the correct URL i was expecting , but my understanding was Multitenant would handle this .. or is this another issue
IF you know of any examples of a many to many Please forard Thanks 🙂
2 replies
if ImageColumn working ?
Hi ... can not seem to get an image to display , the resulting HTML has an <AREF> but no <SRC> So i can click a blank column and the image is displayed, but the actual image in not display in the resulting table
any ideas ?
Ta Lee
3 replies
Combine two fields on a form!
Spinning the wheels on this simple one , behind the scenes i have extended the User table to include first and surname, All I'm trying to do is combine the first + surname into .. Currently have the field on an input form ..Yes i can manually type in name and the process work , But need to be smart about this refer below for form definition . any ideas ? BIG THANKS 🙂
Section::make('Person')->schema([
TextInput::make('name')->hidden(),
TextInput::make('First')
->required(),
TextInput::make('Surname')
->required(),
TextInput::make('email')
->required()
->email(),
TextInput::make('Password')
->required()
->password(),
])->columns(3)
5 replies
Display a field/column based upon a foreign key - help
using filament v3 and display a table which lists select records from a DB table, A foreign key include in the display row . would like to Read the associated DB table for the foreign key , for example Key could be ProductID and i want to display the Product Description.
1 replies
Foreign Key issue when Updating record for first time
Here is the SQL that is generated and causing the error :
update
Club
set post_code_PostCodeID
= 16392 where ClubID
= 4
Very Simple .. But the actual column name is PostCodeID the post_code is the class/table of the foreignkey . which is added as part of the save process to the column name
the Stupid thing is i had this working , i was in the process of copy the functionality to another table (Person) and got this error , went back to my original table (Club) same error
The editing and the selection/searching of the foreign ID (PostCode)works great
Its just the SQL that is generated ..
Please Help ... major headache from this lol
Thanks
-------------------------
Laravel +10 : filament 3
Table /class with Foreign Key
Schema::create('Club', function (Blueprint $table) {
$table->id('ClubID')->startingValue(1); // need to make this unique over all site !! Central
$table->string('ClubCode',10)->unique()->index();
$table->string('ClubName',50);
$table->string('Address',100)->nullable();
$table->foreignIdFor(PostCode::class,'PostCodeID')->nullable(); *** HERE
$table->string('Email')->unique()->nullable();
$table->string('WebSite',100)->nullable();
});
class Club extends Model
{
use HasFactory;
protected $table = 'Club';
protected $primaryKey = 'ClubID'; // Set the custom primary key
public $incrementing = true; // Set to true for auto-incrementing primary key
public $timestamps = false;
protected $fillable = ['ClubCode','ClubName','Email','Website','Address','PostCodeID'];
Public function PostCode(){
return $this->belongsTo(PostCode::class);
}
}3 replies
Restricting Selected Drop Down in a many to many relationship ?
I have a requirement to select a user (standard user table, +800 records) for a new entity ( ie Competition) . One of the attributes on this entity is JudgeID. (ie UserID). There is an additional table (UserRole - M2M ) , which list all the roles that all the users have. Rather than list ALL the users with all their roles , I only want to list the users with a specific role. in this case 'Judge' . Currently i only have 10 judges out of the 800 user records , I have not developed this code as yet , but have a similar development using Checkboxlist function using >belongsToMany etc , but displays all 6 records. I only need 4 records to be display in one case and 2 in another.
Read through the doco , but can not find anything that looks like a 'where = ' . Have also looked at Multi-tenancy (doco) looks over complex for this simple requirement. if anyone can point me in the right direction , would be appreciated LeeB
Read through the doco , but can not find anything that looks like a 'where = ' . Have also looked at Multi-tenancy (doco) looks over complex for this simple requirement. if anyone can point me in the right direction , would be appreciated LeeB
4 replies