WEBMAS
WEBMAS
FFilament
Created by WEBMAS on 11/13/2024 in #❓┊help
Selecting and uploading a file via a modal window (file browser)
Hello everyone. I need a file field for a form. When I click the "Select" button, a modal window (file browser) will open with files already uploaded to the server. In this modal window, you can upload new ones, delete old ones, and select any for the current form. Are there ready-made plugins or solutions?
6 replies
FFilament
Created by WEBMAS on 9/27/2024 in #❓┊help
Prefetch 503 Service Unavailable (from prefetch cache)
Hello everyone. Why does the network write error 503 Service Unavailable (from prefetch cache) for the prefetch request? SPA mode is enabled. This error is only on production. There is no such error on the local machine.
11 replies
FFilament
Created by WEBMAS on 8/14/2024 in #❓┊help
How to sort the order of resources in the global search result?
Hello everyone. How to sort the order of resources in the global search result? By default, the order of resources is alphabetical. I want to set my own order of resources, because the first positions contain little-used resources that are distracting.
3 replies
FFilament
Created by WEBMAS on 8/11/2024 in #❓┊help
Reorderable is very slow (10+sec). How to speed it up?
Hello everyone. I have a table and it has 2000 records. I use ->reorderable('position') . But each sorting takes a very long time. About 10 seconds. This is very long. I looked at the network and there is a request update spa which weighs 20 MB. It turns out that each time a record is dragged, the table is updated and 20 MB of the table is downloaded again. How can this be optimized? Why download the entire html table if you can just send the positions to the request and get the positions. Has anyone solved a similar problem?
18 replies
FFilament
Created by WEBMAS on 8/2/2024 in #❓┊help
How to make my custom Prebuilt Actions?
Hello everyone. I want to make my own custom Prebuilt Actions. Here are the default ones https://filamentphp.com/docs/3.x/actions/prebuilt-actions/create I want to make my own, for example WatchAction. I can make a custom action with a form, but I want to use it on different resources without duplicating the full code. How can I do this? I don't see a command to create a custom action.
11 replies
FFilament
Created by WEBMAS on 7/23/2024 in #❓┊help
How to add analytics counters (Google, Yandex, LiveInternet)?
Hello everybody. How to add analytics counters to Laravel Filament such as Google Analytics, Yandex Metrika and LiveInternet. I use SPA mode.
5 replies
FFilament
Created by WEBMAS on 7/9/2024 in #❓┊help
How to make optional not only a parameter but also a separator in Route::get()?
Hello everybody. I have a route in routes/web.php:
...
Route::get('/account/{user}/course/{course?}/lesson/{lesson?}', 'index');
...
...
Route::get('/account/{user}/course/{course?}/lesson/{lesson?}', 'index');
...
?} - means that the parameter is optional Example links: /account/123/course/123/lesson/123 - correct /account/123/course/123/lesson - correct /account/123/course/123 - not correct How to make optional not only {lesson?} but also the entire part of it /lesson/{lesson?} including /lesson ? This is not a Filament question.
5 replies
FFilament
Created by WEBMAS on 7/6/2024 in #❓┊help
How to manage only your records (user_id)?
Hello everybody. How to manage only your records? I'm using filament shield. The table has a user_id field. How to link records to a user? If I uncheck "View Any" in the permissions settings, then the resource is 403. I expected that in this case the user would see only his own posts, but this is not the case. Why?
30 replies
FFilament
Created by WEBMAS on 7/4/2024 in #❓┊help
How to make such a multi input field?
No description
9 replies
FFilament
Created by WEBMAS on 4/27/2024 in #❓┊help
What is the optimal storage structure for custom classes in Laravel 11?
Hello. What is the optimal storage structure for custom classes in Laravel 11? I need to create a custom class for Laravel. Where is the best place to store it? Should I create an App\Services or App\Libraries folder? The class interacts with a third-party site via an API. Will only be used in Console\Commands
3 replies
FFilament
Created by WEBMAS on 4/12/2024 in #❓┊help
The default value is not set in the select field with any name
The default value is not set in the select field with any name when editing a record. I need to add a select field to a form. This field is not part of the model. I need it to substitute options in another field that belongs to the model. Select::make('my_custom_name_filed') ->options([ 'draft' => 'Draft', 'reviewing' => 'Reviewing', 'published' => 'Published', ]) ->default('reviewing') ->live(); Select::make('course_id') ->options(fn(Get $get): Collection => Course::query()->where('my_custom_name_filed', $get('my_custom_name_filed'))->orderBy('number')->pluck('number', 'id'));
11 replies
FFilament
Created by WEBMAS on 4/11/2024 in #❓┊help
How to make a custom titleAttribute in Select::make('course_id')->relationship ?
Hello I want to change titleAttribute. I need to display additional fields in the option names. Select::make('course_id') ->relationship('course', 'number') ->searchable() I want for example: ->relationship('course', 'number title year') How to do it? And the search also needs to work by full name.
15 replies
FFilament
Created by WEBMAS on 4/11/2024 in #❓┊help
How to hide/show a text field depending on the selected value in the select field?
Hello. I have a category table. The line contains the name and has_close_data fields. I have a table of courses. On the course creation page you can select a category and closing date. How to hide and show a field depending on the has_close_data category? Concept: Select::make('category_id') ->relationship('category', 'name') ->preload() ->searchable() >live() ->afterStateUpdated(function (?string $state) { // If the selected category_id select field value has_close_data is true, then we do not hide the close_date field; if it is false, then we hide the close_date field. }) ->required(), DatePicker::make('close_date'),
9 replies
FFilament
Created by WEBMAS on 4/8/2024 in #❓┊help
Multilingual field data is not saved
Hello. I installed and configured this plugin: https://filamentphp.com/plugins/filament-spatie-translatable Set up the model: class Category extends Model { use HasFactory, HasTranslations; public $translatable = ['name']; Configured Resource: public static function form(Form $form): Form { return $form ->schema([ TextInput::make('name.en') ->required(), TextInput::make('name.es') ->required() ... public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('name.en') ->searchable() ->sortable(), TextColumn::make('name.es') ->searchable() ->sortable(), When I create a new category I get the error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name.en' in 'where clause' SELECT count(*) AS aggregate FROM categories WHERE name.en = ....
How to fix it?
16 replies
FFilament
Created by WEBMAS on 4/5/2024 in #❓┊help
How to place a navigation element without a group between groups or after?
Hello. The $navigationSort variable does not work in the Cluster. Why? <?php namespace App\Filament\Clusters; use Filament\Clusters\Cluster; class Settings extends Cluster { protected static ?string $navigationIcon = 'heroicon-o-squares-2x2'; protected static ?int $navigationSort = 1; }
54 replies
FFilament
Created by WEBMAS on 4/4/2024 in #❓┊help
How to make a third level menu in navigation?
Hi all. How to make a third level menu in navigation? I have a group that contains a lot of resources. I want to make a third-level element “More” and transfer little-used resources to it. How to do it?
8 replies
FFilament
Created by WEBMAS on 3/24/2024 in #❓┊help
How to display fields with different languages in one form without a language switcher?
Hello. I use this plugin https://filamentphp.com/plugins/filament-spatie-translatable How to display fields with different languages in one form without a language switcher? return $form ->schema([ Forms\Components\Section::make() ->schema([ Forms\Components\TextInput::make('title') ->label('(English) Title') ->required() ->maxLength(255), Forms\Components\TextInput::make('title') ->label('(Hindi) Title') ->required() ->maxLength(255), Forms\Components\TextInput::make('title') ->label('(Spanish) Title') ->required() ->maxLength(255), ...
18 replies
FFilament
Created by WEBMAS on 3/23/2024 in #❓┊help
Help with database table names and model, resource folder structure
Hello everybody. Sorry, this is completely off topic, but I need help now. I think there are people here who are good at this. Thank you. I need to add a blog to my project. What structure will be generally accepted and ideal? The project will not consist only of a blog. There will be various modules for users, blog, video, etc. Help with names of database tables. Option 1: posts categories tags files comments Option 2: posts post_categories post_tags post_files post_comments Option 3: blog_posts blog_categories blog_tags blog_files blog_comments Help with model folder structure. Option 1: app/Models/Post.php app/Models/Category.php app/Models/Tag.php app/Models/File.php app/Models/Comment.php Option 2: app/Models/Post/Post.php app/Models/Post/Category.php app/Models/Post/Tag.php app/Models/Post/File.php app/Models/Post/Comment.php Option 3: app/Models/Blog/Post.php app/Models/Blog/Category.php app/Models/Blog/Tag.php app/Models/Blog/File.php app/Models/Blog/Comment.php Help with resource folder structure. Option 1: app/Filament/Resources/PostResource.php app/Filament/Resources/CategoryResource.php app/Filament/Resources/TagResource.php app/Filament/Resources/FileResource.php app/Filament/Resources/CommentResource.php Option 2: app/Filament/Resources/Post/PostResource.php app/Filament/Resources/Post/CategoryResource.php app/Filament/Resources/Post/TagResource.php app/Filament/Resources/Post/FileResource.php app/Filament/Resources/Post/CommentResource.php Option 3: app/Filament/Resources/Blog/PostResource.php app/Filament/Resources/Blog/CategoryResource.php app/Filament/Resources/Blog/TagResource.php app/Filament/Resources/Blog/FileResource.php app/Filament/Resources/Blog/CommentResource.php
9 replies
FFilament
Created by WEBMAS on 3/21/2024 in #❓┊help
How to add an avatar as a result of a user search in the topbar?
No description
4 replies
FFilament
Created by WEBMAS on 3/21/2024 in #❓┊help
How to move the search field to the left side of the topbar?
Hello How to move the search field to the left side of the topbar? I know there are hooks https://filamentphp.com/docs/3.x/support/render-hooks But how and where to apply them to move the search field?
4 replies