dev-resources.site
for different kinds of informations.
How to Use Searchable in Laravel 10 Filament v3
Published at
5/27/2024
Categories
laravel
php
filament
webdev
Author
saim_ansari
Author
11 person written this
saim_ansari
open
In this section, we will see how to implement search functionality in Laravel 10 with filamentphp v3.
You can utilize the searchable feature through the searchable() method.
use Filament\Tables\Columns\TextColumn;
TextColumn::make('title')
->searchable()
Additionally, we will demonstrate how to integrate the search feature into a Laravel 10 filament v3 CRUD application.
Laravel 10 Filament v3 CRUD Operation Example
Filament/Resources/BlogResource.php
<?php
namespace App\Filament\Resources;
use App\Filament\Resources\BlogResource\Pages;
use App\Filament\Resources\BlogResource\RelationManagers;
use App\Models\Blog;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Table;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Textarea;
use Filament\Tables\Columns\TextColumn;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\RichEditor;
use Filament\Tables\Columns\ImageColumn;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
class BlogResource extends Resource
{
protected static ?string $model = Blog::class;
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
public static function form(Form $form): Form
{
return $form
->schema([
Section::make()
->schema([
TextInput::make('title')->required(),
RichEditor::make('content')->required(),
])
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('id'),
TextColumn::make('title')->searchable(),
TextColumn::make('content')->limit(20)->markdown()->searchable(),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DeleteBulkAction::make(),
]),
])
->emptyStateActions([
Tables\Actions\CreateAction::make(),
]);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListBlogs::route('/'),
'create' => Pages\CreateBlog::route('/create'),
'edit' => Pages\EditBlog::route('/{record}/edit'),
];
}
}
See Also
āLaravel 10 Filament v3 Toggle Switch Example
āLaravel 10 Filament v3 CRUD Operation Example
āLaravel 10 Filamentphp v3 Multiple Images Example
āHow to Use DataTables in Laravel 10 Filament v3
filament Article's
30 articles in total
Multi select default selection i filament v3
read article
Filament: Image Color Picker component
read article
My First No-Code SaaS Took off - $8K in 40 days
read article
Add a sidebar with options in a Filament resource
read article
Filament: Modify login or logout response
read article
Filament Database Notification Sound
read article
Laravel Nova vs Filament: The Best Admin Panels
read article
Filament: Add icon to form buttons
read article
Filament Breezy: add new field to Personal Info component
read article
Filament: Delete Attachments when Deleting a Record
read article
Filament: Generate Resource from Existing DB Schema
read article
Filament Breezy: set storage disk for avatar
read article
Laravel Stats : Filament Charts.js pour faire les statistiques
read article
Filament How to redirect to list page after (create,update) using Trait
read article
How to solve Symfony\Component\Routing\Exception\RouteNotFoundException Route [filament.admin.resources.api-keys.index] not
read article
Apa itu Laravel Filament?
read article
Laravel Filament: get resource table data by authenticated id
read article
Change Default Colors in FilamentPHP
read article
How to Use Searchable in Laravel 10 Filament v3
currently reading
Filament: add a confirmation password field in a form
read article
TomatoPHP Filament Plugins
read article
Debug Filament Search Query
read article
Filament PHP Blade UI Components Visually Explained
read article
Filament Context Menu
read article
How to Extend a Filament Resource
read article
Linkeeper - Lesson 02 - Start playing with Filament
read article
Linkeeper - Lesson 01 - Installation
read article
Filament has SPA mode!
read article
Access parent component value from the Repeater in Filament
read article
Filament v3 - Multi-tenancy form component scoping
read article
Featured ones: