Sarthak Garg
Multi-use form section??
Yes it's possible to do.
Create the Form Component:
Open your terminal or command prompt.
Navigate to your Laravel project directory.
Run the following command to generate a new Filament component:
php artisan make:filament-component CommonFormComponent
Then edit the component created
// app/Filament/Components/CommonFormComponent.php
namespace App\Filament\Components;
use Filament\Forms\Component;
use Filament\Forms\Components\TextInput;
class CommonFormComponent extends Component
{
public function fields()
{
return [
TextInput::make('name')
->label('Name'),
TextInput::make('email')
->label('Email'),
TextInput::make('phone')
->label('Phone Number'),
];
}
}
Then, use it in your resource page
// app/Filament/Pages/UserPage.php
namespace App\Filament\Pages;
use App\Filament\Components\CommonFormComponent;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Tab;
class UserPage extends Page
{
public function form()
{
return Grid::make()
->columns(
Tab::make('Details', [
CommonFormComponent::make(),
// Other form components specific to this page
]),
);
}
}
Then, register inside the filament service provider
// app/Providers/FilamentServiceProvider.php
use App\Filament\Components\CommonFormComponent;
protected $components = [
CommonFormComponent::class,
// Other custom components
];
2 replies
php artisan storage:link
as mentioned in document of livewire. I put all files outside public-html. And all public folder files as per laravel directory I put in public-html, when I am running the command of php artisan storage link. It is throwing an error,
Even I tried it manually. But still it won't worked using this command @Tally
26 replies