AsuranDex
AsuranDex
FFilament
Created by AsuranDex on 11/5/2023 in #❓┊help
Issue with Pivot relation on Repeater
Hello i've been following the steps in the documentation: https://filamentphp.com/docs/3.x/forms/fields/repeater#integrating-with-an-eloquent-relationship In order to save a pivot relationship in a repeater field. However as soon as i add the "->relationship()" chain to the repeater field i get the following error: https://flareapp.io/share/v5pKjbM7 Repeater field code:
Forms\Components\Repeater::make('requestTravellers')
->relationship()
->columnSpanFull()
->reorderable(0)
->addActionLabel('Select another Traveller')
->simple(
Forms\Components\Select::make('traveller_id')
->relationship(
name: 'travellers',
titleAttribute: 'first_name',
modifyQueryUsing: fn(Builder $query) => $query->where('company_id', Auth::user()->company_id)
)
->getOptionLabelFromRecordUsing(fn(Model $record) => "{$record->full_name} | {$record->email}")
->createOptionForm(fn(Form $form) => TravellerResource::form($form))
->required(),
)
->grid(2),
Forms\Components\Repeater::make('requestTravellers')
->relationship()
->columnSpanFull()
->reorderable(0)
->addActionLabel('Select another Traveller')
->simple(
Forms\Components\Select::make('traveller_id')
->relationship(
name: 'travellers',
titleAttribute: 'first_name',
modifyQueryUsing: fn(Builder $query) => $query->where('company_id', Auth::user()->company_id)
)
->getOptionLabelFromRecordUsing(fn(Model $record) => "{$record->full_name} | {$record->email}")
->createOptionForm(fn(Form $form) => TravellerResource::form($form))
->required(),
)
->grid(2),
Let me know if you need any more info and thanks in advance!
8 replies
FFilament
Created by AsuranDex on 9/6/2023 in #❓┊help
Error in production - file_put_contents
Heya, Getting the following error message after i have deployed to the server. I have googled the error and getting some mixed responses, not sure if this is something that is known? I've replaced the url in the error with XXX. production.ERROR: file_put_contents(/home/forge/XXX/storage/framework/cache/data/85/5f/855f92484c8c414d36c1b25cb24876e30229cbbf): Failed to open stream: Permission denied {"userId":"9a116f8e-fd7f-4874-8138-5e4c6916a88a","exception":"[object] (ErrorException(code: 0): file_put_contents(/home/forge/XXX/storage/framework/cache/data/85/5f/855f92484c8c414d36c1b25cb24876e30229cbbf): Failed to open stream: Permission denied at /home/forge/XXX/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:205)
6 replies
FFilament
Created by AsuranDex on 8/29/2023 in #❓┊help
Component not found after changing a ->live() element
Hello, i have created a full page component which uses a form and a select live field to conditionally show a section, however when i change the select field, i get a "Component not found" error. Here is the error: https://flareapp.io/share/lm2K0O0P Here is the code:
<?php

namespace App\Http\Livewire;

use App\Enum\TransportEnum;
use App\Models\Booking;
use App\Models\RoomDetail;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Livewire\Component;

class TransportDetails extends Component implements HasForms
{
use InteractsWithForms;

public $data = [];
public Booking $booking;

public function mount($id)
{
$this->booking = RoomDetail::find($id)->room->booking;
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->statePath('data')
->schema([
Section::make('Transport Details')
->schema([
Select::make('transport_method')
->live()
->options(TransportEnum::class)
->required(),
]),

Section::make('Car Details')
->visible(fn(Get $get) => $get('transport_method') == TransportEnum::DRIVING->value)
->schema([
TextInput::make('car_make_model')
->required(),
TextInput::make('car_numberplate')
->required(),
Select::make('driving_to_campus')
->options([
'yes' => 'Yes',
'no' => 'No',
])
->required(),
Select::make('requires_transport_from_campus')
->options([
'yes' => 'Yes',
'no' => 'No',
])
->required(),
])
]);
}
public function render()
{
return view('livewire.transport_details');
}
}
<?php

namespace App\Http\Livewire;

use App\Enum\TransportEnum;
use App\Models\Booking;
use App\Models\RoomDetail;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Form;
use Filament\Forms\Get;
use Livewire\Component;

class TransportDetails extends Component implements HasForms
{
use InteractsWithForms;

public $data = [];
public Booking $booking;

public function mount($id)
{
$this->booking = RoomDetail::find($id)->room->booking;
$this->form->fill();
}

public function form(Form $form): Form
{
return $form
->statePath('data')
->schema([
Section::make('Transport Details')
->schema([
Select::make('transport_method')
->live()
->options(TransportEnum::class)
->required(),
]),

Section::make('Car Details')
->visible(fn(Get $get) => $get('transport_method') == TransportEnum::DRIVING->value)
->schema([
TextInput::make('car_make_model')
->required(),
TextInput::make('car_numberplate')
->required(),
Select::make('driving_to_campus')
->options([
'yes' => 'Yes',
'no' => 'No',
])
->required(),
Select::make('requires_transport_from_campus')
->options([
'yes' => 'Yes',
'no' => 'No',
])
->required(),
])
]);
}
public function render()
{
return view('livewire.transport_details');
}
}
6 replies
FFilament
Created by AsuranDex on 8/7/2023 in #❓┊help
Method Filament\Panel::getDomain does not exist error after composer update
Hello, i just did a composer update and im now getting the following error on the console and when i attempt to load any page: https://flareapp.io/share/dmk8EEYP
6 replies