ericmp #2
ericmp #2
FFilament
Created by ericmp #2 on 1/19/2024 in #❓┊help
How to use ->requiresConfirmation() in Repeater
Is it possible? Im having an issue where users delete stuff from repeaters without wanting to. I want them to confirm it as a normal action
3 replies
FFilament
Created by ericmp #2 on 1/19/2024 in #❓┊help
Is possible to set the panel with brand name + brand logo?
app/Providers/Filament/AdminPanelProvider.php if i set brandLogo, the brand name doesnt appear, can i make them to appear both somehow???
->brandName('test')
->brandLogo('myPath.png')
->brandName('test')
->brandLogo('myPath.png')
8 replies
FFilament
Created by ericmp #2 on 1/9/2024 in #❓┊help
How to dig in `ColumnDefinition::nullable` vendor method?
I was in this migration:
...
`$table->string('example')->nullable()->unique();`
...
...
`$table->string('example')->nullable()->unique();`
...
And I was curious about what nullable actually does. So i clicked it. Now I am here, but I don't know how to continue diggin till finding the actual method:
<?php

namespace Illuminate\Database\Schema;

use Illuminate\Support\Fluent;

/**
* @method $this after(string $column) Place the column "after" another column (MySQL)
* @method $this always(bool $value = true) Used as a modifier for generatedAs() (PostgreSQL)
* @method $this autoIncrement() Set INTEGER columns as auto-increment (primary key)
* @method $this change() Change the column
* @method $this charset(string $charset) Specify a character set for the column (MySQL)
* @method $this collation(string $collation) Specify a collation for the column (MySQL/PostgreSQL/SQL Server)
* @method $this comment(string $comment) Add a comment to the column (MySQL/PostgreSQL)
* @method $this default(mixed $value) Specify a "default" value for the column
* @method $this first() Place the column "first" in the table (MySQL)
* @method $this from(int $startingValue) Set the starting value of an auto-incrementing field (MySQL / PostgreSQL)
* @method $this generatedAs(string|Expression $expression = null) Create a SQL compliant identity column (PostgreSQL)
* @method $this index(string $indexName = null) Add an index
* @method $this invisible() Specify that the column should be invisible to "SELECT *" (MySQL)
* @method $this nullable(bool $value = true) Allow NULL values to be inserted into the column
* @method $this persisted() Mark the computed generated column as persistent (SQL Server)
...
*/
class ColumnDefinition extends Fluent
{
//
}
<?php

namespace Illuminate\Database\Schema;

use Illuminate\Support\Fluent;

/**
* @method $this after(string $column) Place the column "after" another column (MySQL)
* @method $this always(bool $value = true) Used as a modifier for generatedAs() (PostgreSQL)
* @method $this autoIncrement() Set INTEGER columns as auto-increment (primary key)
* @method $this change() Change the column
* @method $this charset(string $charset) Specify a character set for the column (MySQL)
* @method $this collation(string $collation) Specify a collation for the column (MySQL/PostgreSQL/SQL Server)
* @method $this comment(string $comment) Add a comment to the column (MySQL/PostgreSQL)
* @method $this default(mixed $value) Specify a "default" value for the column
* @method $this first() Place the column "first" in the table (MySQL)
* @method $this from(int $startingValue) Set the starting value of an auto-incrementing field (MySQL / PostgreSQL)
* @method $this generatedAs(string|Expression $expression = null) Create a SQL compliant identity column (PostgreSQL)
* @method $this index(string $indexName = null) Add an index
* @method $this invisible() Specify that the column should be invisible to "SELECT *" (MySQL)
* @method $this nullable(bool $value = true) Allow NULL values to be inserted into the column
* @method $this persisted() Mark the computed generated column as persistent (SQL Server)
...
*/
class ColumnDefinition extends Fluent
{
//
}
Is there any way to do it?
2 replies
FFilament
Created by ericmp #2 on 12/20/2023 in #❓┊help
How to make table searchable?
I'm in the admin panel, trying to apply a custom search to the table, but im unable to show the search input :/ this is what im trying:
<?php

namespace App\Filament\Resources\ResponseResource\Pages;

use App\Enums\FormFieldTypeEnum;
use App\Filament\Resources\ResponseResource;
use App\Filament\Resources\ResponseResource\Widgets\RadioChart;
use App\Filament\Resources\ResponseResource\Widgets\RangeChart;
use App\Filament\Traits\HasParentResource;
use App\Models\Form;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
use Filament\Support\Enums\MaxWidth;
use Illuminate\Database\Eloquent\Builder;

class ListResponses extends ListRecords
{
use HasParentResource;

protected static string $resource = ResponseResource::class;

// protected function search
public function isTableSearchable(): bool
{
return true;
}

// public function hasTableSearch(): bool
// {
// return true;
// }

protected function applySearchToTableQuery(Builder $query): Builder
{
if (filled($search = $this->getTableSearch())) {
// dd($search);
// $query->saerch
}
return $query;
}
}
<?php

namespace App\Filament\Resources\ResponseResource\Pages;

use App\Enums\FormFieldTypeEnum;
use App\Filament\Resources\ResponseResource;
use App\Filament\Resources\ResponseResource\Widgets\RadioChart;
use App\Filament\Resources\ResponseResource\Widgets\RangeChart;
use App\Filament\Traits\HasParentResource;
use App\Models\Form;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
use Filament\Support\Enums\MaxWidth;
use Illuminate\Database\Eloquent\Builder;

class ListResponses extends ListRecords
{
use HasParentResource;

protected static string $resource = ResponseResource::class;

// protected function search
public function isTableSearchable(): bool
{
return true;
}

// public function hasTableSearch(): bool
// {
// return true;
// }

protected function applySearchToTableQuery(Builder $query): Builder
{
if (filled($search = $this->getTableSearch())) {
// dd($search);
// $query->saerch
}
return $query;
}
}
27 replies
FFilament
Created by ericmp #2 on 12/20/2023 in #❓┊help
Filament blade icons
these are the only icons installed with filamentphp or there is more that arent appearing in the list??
https://blade-ui-kit.com/blade-icons?set=1#search
4 replies
FFilament
Created by ericmp #2 on 12/19/2023 in #❓┊help
How to explain to the user why the button is disabled
No description
4 replies
FFilament
Created by ericmp #2 on 12/18/2023 in #❓┊help
Does Filament provide a way to let users recover their accounts?
https://filamentphp.com/docs/3.x/panels/users im trying to find a similar feature as jetstream or breeze, where users can easily recover their accounts. is possible in filament too?
7 replies
FFilament
Created by ericmp #2 on 12/15/2023 in #❓┊help
How to cast properties of array recursively in a Laravel Model
inside my model i have this:
protected $casts = [
'fields' => 'array',
];
protected $casts = [
'fields' => 'array',
];
where fields is an array like, stored in database as a json array:
[
'type' => 3,
...
]
[
'type' => 3,
...
]
where the type is an integer. this integer is a value from an enum so i try:
protected $casts = [
'fields' => 'array',
'fields.*.type' => FormFieldTypeEnum::class,
];
protected $casts = [
'fields' => 'array',
'fields.*.type' => FormFieldTypeEnum::class,
];
but it doesnt work also tried:
protected $casts = [
'fields' => 'array',
'fields.type' => FormFieldTypeEnum::class,
];
protected $casts = [
'fields' => 'array',
'fields.type' => FormFieldTypeEnum::class,
];
u know how to achieve it? also trying to understand it from the docs but not quite getting it - https://laravel.com/docs/10.x/eloquent-mutators#enum-casting
2 replies
FFilament
Created by ericmp #2 on 12/15/2023 in #❓┊help
How to make Repeater unique fields name
No description
6 replies
FFilament
Created by ericmp #2 on 12/12/2023 in #❓┊help
How to increase table max width layout?
I have a large screen. I want to be able to see all the table rows without scrolling horizontally. Using the admin panel, how to change the main css: <main class="fi-main mx-auto h-full w-full px-4 md:px-6 lg:px-8 max-w-7xl sticky-theme-default"> i need to change the max-w-7xl and increase it. (ive tested it in the browser and yeah, that makes the trick, so yeah that is what i need) any "clean" way, or i just override the css somehow? i tried to find how to do it in the docs
47 replies
FFilament
Created by ericmp #2 on 12/12/2023 in #❓┊help
Set min value dinamically
i have 2 integer values to fill first one must be not greather than the 2nd one and 2nd one must be not smaller than 1st one This is what im trying, but im missing something and idk what it is :/
Forms\Components\TextInput::make('min_int')
->live()
->numeric()
->rule('integer')
->inputMode('numeric')
,
Forms\Components\TextInput::make('max_int')
->live()
->numeric()
->rule('integer')
->inputMode('numeric')
->maxValue(function (Get $get) {
return $get('min_int');
})
,
Forms\Components\TextInput::make('min_int')
->live()
->numeric()
->rule('integer')
->inputMode('numeric')
,
Forms\Components\TextInput::make('max_int')
->live()
->numeric()
->rule('integer')
->inputMode('numeric')
->maxValue(function (Get $get) {
return $get('min_int');
})
,
7 replies
FFilament
Created by ericmp #2 on 12/12/2023 in #❓┊help
How to place form actions on header actions
this is what i've tried, the problem is that when i click save in the header action save btn, it doesnt do anything
<?php

namespace App\Filament\Resources\FormResource\Pages;

use App\Filament\Resources\FormResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Filament\Support\Colors\Color;

class CreateForm extends CreateRecord
{
protected static string $resource = FormResource::class;

protected static bool $canCreateAnother = false;

protected function getHeaderActions(): array
{
return [
Actions\Action::make('cancel')
->label(__('filament-panels::resources/pages/create-record.form.actions.cancel.label'))
->color('gray')
->url(route('filament.admin.resources.forms.index'))
->icon('heroicon-o-backspace')
,
$this->getCreateFormAction()->icon('heroicon-m-cloud-arrow-down')->color(Color::Teal),
];
}

protected function getFormActions(): array
{
return [
$this->getCreateFormAction()->icon('heroicon-m-cloud-arrow-down')->color(Color::Teal), // ⚠️ this should be deleted, as we use it in header actions. but the one in header actions doesnt work, why?
//
];
}

protected function getCreateFormAction(): Actions\Action
{
return Actions\Action::make('create')
->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'))
->submit('create')
->keyBindings(['mod+s'])
;
}
}
<?php

namespace App\Filament\Resources\FormResource\Pages;

use App\Filament\Resources\FormResource;
use Filament\Actions;
use Filament\Resources\Pages\CreateRecord;
use Filament\Support\Colors\Color;

class CreateForm extends CreateRecord
{
protected static string $resource = FormResource::class;

protected static bool $canCreateAnother = false;

protected function getHeaderActions(): array
{
return [
Actions\Action::make('cancel')
->label(__('filament-panels::resources/pages/create-record.form.actions.cancel.label'))
->color('gray')
->url(route('filament.admin.resources.forms.index'))
->icon('heroicon-o-backspace')
,
$this->getCreateFormAction()->icon('heroicon-m-cloud-arrow-down')->color(Color::Teal),
];
}

protected function getFormActions(): array
{
return [
$this->getCreateFormAction()->icon('heroicon-m-cloud-arrow-down')->color(Color::Teal), // ⚠️ this should be deleted, as we use it in header actions. but the one in header actions doesnt work, why?
//
];
}

protected function getCreateFormAction(): Actions\Action
{
return Actions\Action::make('create')
->label(__('filament-panels::resources/pages/create-record.form.actions.create.label'))
->submit('create')
->keyBindings(['mod+s'])
;
}
}
41 replies
FFilament
Created by ericmp #2 on 12/12/2023 in #❓┊help
How to get record in `columns` fn
i need to generate the columns dinamically.
public static function table(Table $table): Table
{
return $table
->query(Response::latest())
->columns((function (): array {
// here i need to retrieve the record to be able to costumize the columns
$record = ??
...
public static function table(Table $table): Table
{
return $table
->query(Response::latest())
->columns((function (): array {
// here i need to retrieve the record to be able to costumize the columns
$record = ??
...
is this possible?
4 replies
FFilament
Created by ericmp #2 on 12/1/2023 in #❓┊help
How to make EditRecord header actions sticky (css)!?
<?php

namespace App\Filament\Resources\FormResource\Pages;

use App\Filament\Resources\FormResource;
use App\Models\Form;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Colors\Color;

class EditForm extends EditRecord
{
protected static string $resource = FormResource::class;

protected function getHeaderActions(): array
{
return [
$this->getCancelFormAction()->icon('heroicon-o-backspace'),
Actions\DeleteAction::make()->icon('heroicon-m-trash'),
];
}
}
<?php

namespace App\Filament\Resources\FormResource\Pages;

use App\Filament\Resources\FormResource;
use App\Models\Form;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Colors\Color;

class EditForm extends EditRecord
{
protected static string $resource = FormResource::class;

protected function getHeaderActions(): array
{
return [
$this->getCancelFormAction()->icon('heroicon-o-backspace'),
Actions\DeleteAction::make()->icon('heroicon-m-trash'),
];
}
}
so yeah basically i want the header actions to be sticky but im not finding how to do it. is possible using filament, or not?
8 replies
FFilament
Created by ericmp #2 on 12/1/2023 in #❓┊help
EditForm - can't submit form action on set on form header actions
<?php

namespace App\Filament\Resources\FormResource\Pages;

use App\Filament\Resources\FormResource;
use App\Models\Form;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Colors\Color;

class EditForm extends EditRecord
{
protected static string $resource = FormResource::class;

protected function getHeaderActions(): array
{
return [
$this->getCancelFormAction()->icon('heroicon-o-backspace'),
Actions\DeleteAction::make()->icon('heroicon-m-trash'),
$this->getSaveFormAction()->icon('heroicon-m-cloud-arrow-down')->color(Color::Teal), // ⚠️ here doesnt save??? what
];
}

protected function getFormActions(): array
{
return [
$this->getSubmitFormAction()->icon('heroicon-m-cloud-arrow-down')->color(Color::Teal), // ⚠️ here yes
//
];
}
}
<?php

namespace App\Filament\Resources\FormResource\Pages;

use App\Filament\Resources\FormResource;
use App\Models\Form;
use Filament\Actions;
use Filament\Resources\Pages\EditRecord;
use Filament\Support\Colors\Color;

class EditForm extends EditRecord
{
protected static string $resource = FormResource::class;

protected function getHeaderActions(): array
{
return [
$this->getCancelFormAction()->icon('heroicon-o-backspace'),
Actions\DeleteAction::make()->icon('heroicon-m-trash'),
$this->getSaveFormAction()->icon('heroicon-m-cloud-arrow-down')->color(Color::Teal), // ⚠️ here doesnt save??? what
];
}

protected function getFormActions(): array
{
return [
$this->getSubmitFormAction()->icon('heroicon-m-cloud-arrow-down')->color(Color::Teal), // ⚠️ here yes
//
];
}
}
if i click on the submit form action (form action) it saves the data if i click on the submit form action (header action) it does nothing objective: save the data in the header actions too
15 replies
FFilament
Created by ericmp #2 on 11/30/2023 in #❓┊help
FileUpload not working when app locale is 'ca'
No description
7 replies
FFilament
Created by ericmp #2 on 11/29/2023 in #❓┊help
Count relationship quantity via pivot
models: ProductPack Product ProductPackPivot (n n table): pivot extra field -> product_quantity for each ProductPack i want to know how many products it has. at the moment im doing it like this, but this only counts the relationships:
ProductPack::query()
->withCount('products')
...
ProductPack::query()
->withCount('products')
...
and i need to go to the pivot, and get the product_quantity field instead of counting the relation im kinda lost on how to achieve it. example: lets say i have a product pack that has 2 products: 4 waters 2 forks the product pack has 2 products, but really has 4+2 products, so i need to get 6 instead of 2
6 replies
FFilament
Created by ericmp #2 on 11/28/2023 in #❓┊help
Disable createAnother in form footer
No description
9 replies
FFilament
Created by ericmp #2 on 11/28/2023 in #❓┊help
Setting table columns based on model's json column
No description
17 replies
FFilament
Created by ericmp #2 on 11/28/2023 in #❓┊help
How to translate Resource model name?
My model is called Form. But the application is in Spanish. all seems well translated except for the resources model names. Form should be Formulario. Is there any way to translate it? now i see it all like this: left admin panel sidebar: Forms -> should be Formularios "Crear form" -> should be "Crear formulario" etc im trying to find how to do it in the docs, but so far havent found it
13 replies