D2RTECH
D2RTECH
FFilament
Created by D2RTECH on 10/5/2024 in #❓┊help
Trying to call a view of another resource from a table
I am trying to call laptop assignment view from laptop table action. Tables\Actions\ViewAction::make() ->url(fn ($record) => route('filament.resources.laptop-assignments.create', ['record' => $record])) ]) But i always get that the route is not defined. How can i make it work?
5 replies
FFilament
Created by D2RTECH on 10/3/2024 in #❓┊help
Add a query with a join
I am trying to get some options. I have laptop assignment table which contains all laptops assigned to employee. We have two separate tables for laptop and employee. Now when i am adding a laptop assignment, i only want laptop who meets the following conditions to be showin the dropdown 1. Laptop should not have entry in laptop assignment 2. if it exist in laptop assignment table, pick the latest entry and see if the returned date shall is non-null and date is less than todays date i have tried adding query parameter, tried query builder, but for some reason nothing seems to work Select::make('laptop_id') ->label('Laptop') ->options( Laptop::all() ->pluck('asset_id', 'asset_id') )
->searchable(), Need some help
6 replies
FFilament
Created by D2RTECH on 5/4/2024 in #❓┊help
issue with fillrecordusing
I am trying to ensure that nothing other than "Yes" or "No" goes through my importer class, and i am doing that using the below code. But the value is passed in DB as it comes and is not changed as per the logic below. ImportColumn::make('item_loaned') ->requiredMapping() ->fillRecordUsing(function (Inventory $record, string $state): void { if(strtolower($state) === 'yes') { $record->item_loaned = 'Yes'; } elseif (strtolower($state) === 'no') { $record->item_loaned = 'No'; } }) ->rules(['required', 'max:255'])
3 replies
FFilament
Created by D2RTECH on 2/12/2024 in #❓┊help
Getting a 403 when deployed on hosted server on hostinger
I have seen multiple folks getting this issue, but have not find a complete solution. env is set to local no logs in storage/logs/laravel.logs Here is my user model file Kindly HELP!!! <?php namespace App\Models; use Filament\Models\Contracts\FilamentUser; use Filament\Panel; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable implements FilamentUser { use HasApiTokens, HasFactory, Notifiable; public function canAccessPanel(Panel $panel): bool {
return str_ends_with($this->email, '@d2rtech.com'); }
protected $fillable = [ 'name', 'email', 'password', 'isactive', 'isadmin', ];
protected $hidden = [ 'password', 'remember_token', ]; protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; public function userskills(): BelongsTo { return $this->belongsTo(Userskill::class); } }
10 replies
FFilament
Created by D2RTECH on 1/9/2024 in #❓┊help
Checkbox - Dont want to save it in database
The use case is simple, i am creating a form where Shipping Address and Billing Address would be different when a checkbox is not checked, but when checked both will be same. we are using different fields for billing and shipping address in the Address Model. Kindly help!!!
2 replies
FFilament
Created by D2RTECH on 1/9/2024 in #❓┊help
file upload error 422 on local machine
I am uploading a file using fileupload component and i am getting the error message POST http://127.0.0.1:8000/livewire/upload-file?expires=1704820544&signature=35096e049295cc2d0c02f40b2975ba9e924763f0344058a77926082ffd0ff279 422 (Unprocessable Content) I am sure i am missing some setting which could be causing the file not uploaded on the local storage itelf. Kindly help!!!
6 replies
FFilament
Created by D2RTECH on 1/8/2024 in #❓┊help
how to show the mobile number with country code
I want to combine values of two table columns and show them in the one column. how do i acheive that?
8 replies
FFilament
Created by D2RTECH on 1/8/2024 in #❓┊help
in Filament v3.x how to show city Name when city ID is saved in the table
I am new to the filament. in the below code I need to show the city name, but because in the table, we have stored just the city ID. Now I can query the city table with the city_id to fetch the city name, but i am not sure how to show that. public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('city_id') ->searchable() ->sortable(), I did not used the relationships to get the city data. here is the code in the forms to get the city ID Forms\Components\Select::make('city_id') ->options(fn (Get $get): Collection => City::query() ->where('state_id', $get('state_id')) ->pluck('name', 'id')) ->searchable() ->preload(),
14 replies