D2RTECH
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
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); } }
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
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
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
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