Git Product home page Git Product logo

filamentphp / filament Goto Github PK

View Code? Open in Web Editor NEW
14.1K 126.0 2.3K 344.18 MB

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.

Home Page: https://filamentphp.com

License: MIT License

PHP 82.18% JavaScript 5.09% CSS 0.57% Blade 12.15% Shell 0.01%
laravel tailwind-css alpine-js livewire admin forms tables builder tall-stack cms

filament's People

Contributors

adevade avatar archilex avatar awcodes avatar aymanalareqi avatar bernhardh avatar bezhansalleh avatar binaryfire avatar cheesegrits avatar danharrin avatar datlechin avatar dododedodonl avatar howdu avatar jacksleight avatar kamilst96 avatar maherelgamil avatar mohamedsabil83 avatar nuhel avatar pxlrbt avatar ralphjsmit avatar robertorinaldi-dev avatar ryangjchandler avatar ryanscherler avatar saade avatar shuvroroy avatar sumardi avatar tanthammar avatar titantwentyone avatar wychoong avatar z3d0x avatar zepfietje avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

filament's Issues

Uncaught TypeError: Cannot read property 'split' of null

Describe the bug
Im getting Uncaught TypeError error on the JavaScript console while swtiching filter.

To reproduce

  1. Create a resource for example UserResource
  2. Add a filter that matches with some records. for example Admins
  3. Add another filter that does not matches with any record. for example Members
  4. Go to resource page.
  5. Click Filter and select Members filter.
  6. Then select Admins filter.
  7. See the error on JavaScript console.

Expected behavior
Should not be any error there.

Statck Trace

LoadingStates.js:192 Uncaught TypeError: Cannot read property 'split' of null
    at LoadingStates.js:192
    at Array.forEach (<anonymous>)
    at startLoading (LoadingStates.js:190)
    at setLoading (LoadingStates.js:161)
    at LoadingStates.js:50
    at MessageBus.js:17
    at Array.forEach (<anonymous>)
    at MessageBus.value (MessageBus.js:16)
    at Object.call (HookManager.js:38)
    at Object.callHook (Store.js:120)
(anonymous) @ LoadingStates.js:192
startLoading @ LoadingStates.js:190
setLoading @ LoadingStates.js:161
(anonymous) @ LoadingStates.js:50
(anonymous) @ MessageBus.js:17
value @ MessageBus.js:16
call @ HookManager.js:38
callHook @ Store.js:120
sendMessage @ index.js:223
value @ index.js:231
later @ debounce.js:8
setTimeout (async)
(anonymous) @ debounce.js:12
value @ index.js:204
callback @ node_initializer.js:87

My Code

public static function table(Table $table): Table
{
    return $table
        ->columns([
            Text::make("id"),
            Text::make("name"),
            Text::make("email"),
            Text::make("role"),
        ])
        ->filters([
            Filter::make("admins", fn($query) => $query->where("role", "admin")),
            Filter::make("members", fn($query) => $query->where("role", "member")),
        ]);
}

Screenshots
Initial
image

Members filter selected.
image

Then Admins filter selected.
image

Context

  • Package version: 1.5.4
  • Livewire version: 2.4.0
  • Laravel version: 8.32.1
  • PHP version: 8.0.1
  • Browser: Chromium
  • Server OS: Arch Linux

RichEditor does not render in dependable group

Describe the bug
If you add the RichEditor field in a dependable group, you get this once you select the value to show the group.

At the same time the console also throws this error:

Uncaught TypeError: cyclic object value
    supportEntangle SupportAlpine.js:88
    value alpine.js:1545
    value alpine.js:1545
    valueMutated alpine.js:1425
    value alpine.js:1113
    value alpine.js:1793
    value alpine.js:1792
    value alpine.js:1787
    value alpine.js:1781
    e alpine.js:1520
    value alpine.js:1614
    value alpine.js:1596
    v alpine.js:90
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    v alpine.js:94
    value alpine.js:1590
    value alpine.js:1607
    e alpine.js:1517
    initializeComponent alpine.js:1911
    e alpine.js:1856
    discoverComponents alpine.js:1870
    discoverComponents alpine.js:1869
    e alpine.js:1855
    l runtime.js:63
    _invoke runtime.js:293
    E runtime.js:118
    f filament.js:1
    a filament.js:1
    promise callback*f filament.js:1
    a filament.js:1
    d filament.js:1
    d filament.js:1
    start alpine.js:1850
    i alpine.js:1940
    deferLoadingAlpine create:716
    dispatch dispatch.js:6
    value index.js:87
    <anonymous> create:721
    EventListener.handleEvent* create:720
SupportAlpine.js:88:37

To reproduce
Steps to reproduce the behavior:

  1. Make a new resource
  2. Add this in the form method
Select::make('type')
    ->placeholder('Select a type')
    ->options([
        'redirect' => 'Redirect',
        'article' => 'Article',
    ])
    ->dependable()
    ->required(),

Group::make([
    TextInput::make('redirect_url')
        ->required(),
])->when(fn ($record) => $record->type === 'redirect'),

Group::make([
    RichEditor::make('content')
        ->required(),
])->when(fn ($record) => $record->type === 'article')
  1. Create a new item for this resource in your browser
  2. Choose the article type

Expected behavior
The RichEditor that renders properly

Screenshots
image

Context

  • Package version: 1.6.4
  • Livewire version: 2.4.0
  • Laravel version: 8.33.0
  • Browser: Firefox
  • Server OS: PopOS 20.10
  • PHP version: 8.0.3
  • Database: MySQL 8.0.23

Multiple BelongsToSelect inside a form don't work

Describe the bug
When trying to add a form for a comments who belongs to both a User and a Post only the last item get there.

To reproduce
Steps to reproduce the behavior:
Having a table relation belongs_to with 2 table.

Expected behavior

  public static function form(Form $form)
    {
        return $form
            ->schema([
                Components\Textarea::make('body')->rows(10)->required(),
                Components\BelongsToSelect::make('post_id')->relationship('post', 'caption')->required(),
                Components\BelongsToSelect::make('user_id')->relationship('user', 'username')->required(),
            ]);
    }

If I do this because the user is the last one, my post select will also match the same argument

So finally what happen is the last item in the schema will take precedence on the other one.

Screenshots

Screen Shot 2021-03-05 at 10 46 25 AM

And if I inverse

Screen Shot 2021-03-05 at 11 25 12 AM

Context

  • Browser: Chrome
  • Server OS: Localhost MacOS
  • PHP version: 8.0
  • Database: Postgresql 12.3

Additional details

Class "Str" not found

Describe the bug

Class "Str" not found (View: /app/vendor/filament/filament/packages/forms/resources/views/components/field-group.blade.php)

A new Filament installation on an old/upgraded Laravel app.
It's Laravel 8.0 but it has been upgraded for a few years, and I'm suspecting I've missed some Laravel upgrade steps regarding the String helpers.

Anyway, it might be something you might want to fix.

Newly created resource Page fails to load with "InvalidArgumentException View [{{ view }}] not found."

I've spoken briefly to ryangjchandler about this in the Discord channel.
It looks like when the resource scaffold gets built, that it's including an invalid definition of $view in the page template.

Steps to reproduce:

  1. 'artisan make:filament-resource '
  2. Define a basic Form and Table schema in the main Resource php
  3. Try to load the menu item from the Filament Dashboard
  4. Error as per issue subject.

Workaround:
Either comment out the $view in the Pages/List.php file or (presumably) give it a valid custom view to use.

Rich Text Editor not rendering

Describe the bug
Rich text editor not rendering and throws error in console

To reproduce
Steps to reproduce the behavior:

  1. Create rich text editor
RichEditor::make('description')
                    ->attachmentDisk('public')
                    ->attachmentDirectory('richtext')
                    ->autofocus()
                    ->disableAllToolbarButtons()
                    ->disableToolbarButtons($buttons = [])
                    ->enableToolbarButtons($buttons = [])
                    ->placeholder('Description'),
  1. Check developer console for error
alpine.js:1907 Uncaught SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at SupportAlpine.js:70
    at Array.forEach (<anonymous>)
    at SupportAlpine.js:55
    at alpine.js:1498
    at Array.forEach (<anonymous>)
    at new qe (alpine.js:1498)
    at alpine.js:1607
    at alpine.js:1589
    at u (alpine.js:90)
(anonymous) @ SupportAlpine.js:70
(anonymous) @ SupportAlpine.js:55
(anonymous) @ alpine.js:1498
qe @ alpine.js:1498
(anonymous) @ alpine.js:1607
(anonymous) @ alpine.js:1589
u @ alpine.js:90
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
u @ alpine.js:94
walkAndSkipNestedComponents @ alpine.js:1583
initializeElements @ alpine.js:1600
qe @ alpine.js:1510
initializeComponent @ alpine.js:1904
(anonymous) @ alpine.js:1849
(anonymous) @ alpine.js:1863
discoverComponents @ alpine.js:1862
start @ alpine.js:1848
setTimeout (async)
initializeComponent @ alpine.js:1906
(anonymous) @ alpine.js:1849
(anonymous) @ alpine.js:1863
discoverComponents @ alpine.js:1862
start @ alpine.js:1848
async function (async)
start @ alpine.js:1845
(anonymous) @ alpine.js:1933
(anonymous) @ create:529
dispatch @ dispatch.js:6
value @ index.js:87
(anonymous) @ create:534

Expected behavior
Expects to see a Trix editor

Screenshots
If applicable, add screenshots to help explain your problem.

Context

  • Browser: Chrome
  • Server OS: MacOSX
  • PHP version: [e.g. 7.4]

Additional details
Appears to be cause by value: @entangle($formComponent->name).defer, found in rich-editor.blade.php line 42

Extra semicolons being produced in Column/Image image style attribute

Describe the bug
When using the new Column\Image there are extra semicolons being produced in the style attribute of the images

To reproduce
Steps to reproduce the behaviour:

  1. Add an Image column to a table
  2. Open browser inspector
  3. Find image tag
  4. See error

Expected behaviour
No extraneous markup should be present in the style attribute

Screenshots
Src Issue

Context

  • Package version: [1.4.5]
  • Livewire version: [e.g. 2.0.0]
  • Laravel version: [8.30]
  • Browser: [Chrome v 88.0.4324.19]
  • Server OS: [OSX 10.11.6]
  • PHP version: [7.4]
  • Database: [MySQL 8.0]

Additional details
The issue is caused by extra semicolons in the Column\Image view file

Extra Semi Colons

Call to undefined method Filament\Resources\Tables\Columns\View::url()

This problem occurs when using Columns\View.

Two working solutions that i've tried:

1 - Verify if url() method exists in column
Path: filament\filament\packages\tables\src\Table.php
method_exists($column, 'url') ? $column->url($url) : $column;

2 - Put Concerns\CanOpenUrl trait inside View column
Path: filament\filament\packages\tables\src\Columns\View.php

BadMethodCallException: Method Illuminate\Support\Stringable::markdown does not exist.

Hey,
i am trying your software on a fresh laravel installation (latest release) and i get the following error message when i try to open the login page.

BadMethodCallException
Method Illuminate\Support\Stringable::markdown does not exist. (View: vendor\filament\filament\packages\forms\resources\views\components\field-group.blade.php) 

There is nothing else installed in this testing installation. The only package installed is yours. I already did the database migration and created a new admin user.

Greetings
Leo

TALL = Tailwind CSS, Alpine.js, Laravel and Livewire

Honestly I just thought I would point that out because I was not familiar with the 4 icons personally and this seems to be mentioned nowhere.. it may seem like the most obvious thing to you and others but despite being relatively "in the loop" and active, I had no idea what TALL meant. I think you should be a bit more clear about that IMO.

Undefined variable: slot (View: /Users/.../filament/vendor/filament/filament/packages/forms/resources/views/components/textarea.blade.php)

Describe the bug
Using Textarea form input throws error

To reproduce
Steps to reproduce the behavior:

  1. Create a form
  2. add Text area input
    Textarea::make('description') ->placeholder('Description');

Expected behavior
Renders form with text area

Screenshots
If applicable, add screenshots to help explain your problem.

Context

  • Browser: Chrome
  • Server OS: Mac OSX
  • PHP version: [e.g. 7.4]

Additional details
ErrorException
Undefined variable: slot (View: /Users/.../filament/vendor/filament/filament/packages/forms/resources/views/components/textarea.blade.php)
Screen Shot 2021-03-01 at 7 15 58 PM

Modal hides part of DateTimePicker popup in RelationsManager

Modal hides part of DateTimePicker popup in RelationsManager

I have setup a relationship Project->hasMany(Item::class) and created an ItemsRelationManager to list all related items for a project.

In the ItemsRelationsManager I have defined the form as follows:

public static function form(Form $form)
    {
        return $form
            ->schema([
                Components\TextInput::make('category')->autofocus()->required(),
                Components\Textarea::make('description'),
                Components\DateTimePicker::make('start')->required(),
                Components\DateTimePicker::make('end'),
            ]);
    }

When clicking edit or new the modal pops up and shows all fields correctly.

The Problem

When opening the DateTimePicker is is partly outside of the modal and is unreachable.
(overflow-hidden class is set)

Expected behavior

DateTimePicker should be reachable.

Suggested quick fix

Change overflow-hidden to overflow-auto.

It's not pretty but it works :)

Screenshots

Bildschirmfoto 2021-03-06 um 07 09 36

Context

  • Browser: [Safari]

"Create & Create Another" does not set focus again

Hey,
i am a big fan of the Create & Create Another feature. Super helpful for adding a lot of records quickly. I noticed on thing with this feature. When i open up the create dialogue the first time it get the focus set correctly and i can start typing and use tab to get to the next field. But when i hit Create & Create Another i have to use my mouse to set the focus.

Maybe it would be usefull to set the focus automatically to the first input field.
Thanks and greetings
Leo

Alpine Errors

Describe the bug
Any inputs (BelongsToSelect, DateTimePicker) that require alpine result in javascript errors.

Alpine Error: "ReferenceError: dateTimePicker is not defined"

To reproduce
Steps to reproduce the behavior:

  1. Install Filament
  2. Create a Resource
  3. Add a DateTimePicker to the form schema
  4. Navigate to form
  5. View the errors in the browser console

Expected behavior
A usable input

Screenshots
image

Context

  • Package version: 1.6.4
  • Livewire version: 2.4.0
  • Laravel version: 8.32.1
  • Browser: Safari
  • Server OS: Laravel Homestead
  • PHP version: 7.4.4
  • Database: MySQL 8.0.20

Additional details
I don't see any instructions to setup Alpine although I already had it in my package.json

heredoc end issue with forms

ErrorException
syntax error, unexpected end of file, expecting variable (T_VARIABLE) or heredoc end (T_END_HEREDOC) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN)
(View: $project_path\vendor\filament\filament\resources\views\partials\user-actions.blade.php)
(View: $project_path\vendor\filament\filament\resources\views\partials\user-actions.blade.php)
(View: $project_path\vendor\filament\filament\resources\views\partials\user-actions.blade.php)

Accessor applies twice to TextInput field on Form

Describe the bug
Table with products list, one column is Text for price and it is displayed correctly with the accessor applied. The price field in the db is in pennies, so the accessor performs return round($value /100, 2);.

Click on product to edit screen which has a fieldset with price TextInput, it initially shows as fully pennies value (987), then flashes to .987, then displays .1 as the final value. If I disable the accessor or set it to multiply by 10, the correct 'price' is displayed on the edit form, but obviously not the list table.

Expected behavior
I expected the accessor to be applied once to the TextInput field and the correctly formatted price to be displayed.

Screenshots
If applicable, add screenshots to help explain your problem.

Context

  • Browser: Firefox
  • Server OS: Windows 10
  • PHP version: 7.4.10
  • Database: MariaDB 10.4.14

filament_bug_list
filament_bug_form

Create User - is_admin cannot be null

Describe the bug
If i don't check a new user as admin the following error is throw

To reproduce
Steps to reproduce the behavior:

  1. Go to 'Create User'
  2. Insert name, email and passwords
  3. Click 'Create'

image

Custom UserResource messes with package default UserResource

Describe the bug
Creating a custom UserResource messes with the default UserResource

To reproduce
Steps to reproduce the behavior:

  1. Create a resource called UserResource with a custom User in the $model property
  2. Customize the form() method to return only the name field
  3. Click on the authenticated user and go to Manage Users
  4. Click on Create
  5. See that the form shown is the one we just customized instead of the Filament user

Expected behavior
The package UserResource should be used for for internal admin users.

Screenshots
Screenshot from 2021-03-02 22-10-08

Context

  • Browser: Chrome
  • Server OS: Ubuntu 20.04
  • PHP version: 8.0

Dealing with S3 driver private files for FileUpload Field & Image Column

Describe the bug
I was not able to make the FileUpload form field (1 image) Field and Image table column (the same image) work properly with a private S3 filesystem driver, with private file visibility.

To reproduce
Steps to reproduce the behavior:

  1. Create a form with the following field : FileUpload::make('uri')->disk('s3')->directory('storage')->visibility('private')
  2. Go to this form & upload a photo, this will work, the temporary livewire upload pre-submittion and the final upload on form submittion will proceed.
  3. It'll redirect you to the entry "edit" page, where the image wont load, with the following network message from S3 (error code 403) :
    <Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>...</RequestId><HostId>...</HostId></Error>
  4. It's the same problem with the Image Column so I won't detail unless it's necessary
  5. What is happening is that the Field is trying to load the image from a public url, without using the built-in Laravel S3 driver feature to request a temporary public URL out of a private file on S3.

Expected behavior
The image should load as expected from S3, once it's privately stored.

Way to fix
I managed to get everything working properly by tweaking a little the forms/src/HasForm getUploadedFileUrl behavior, and the src/Columns/Image getPath method, but it need some improvement to be a PR, as I don't know how to make it conditionnal for the HasForm getUploadedFileUrl method (I made a private parameter for the Image Column).
You can check my commit here : https://github.com/tomheno/filament-with-s3-private-file-handling/commit/ddb0cd3f60e4c740c7349599b3e0f2918a9b9247.

Context

  • Package version: 1.4.5
  • Laravel version: 8.12
  • Browser: Chrome
  • Server OS: Windows
  • PHP version: 8

Additional details
Thanks in advance for your time and consideration on this issue ! ๐Ÿ˜€

Model should be resolved by resolveRouteBinding method

Describe the bug
Right now the model in \Filament\Resources\Pages\EditRecord::mount() is resolved with a custom query that doesn't behave the same like in application route binding.

$routeKeyName = (new $model())->getRouteKeyName();
$this->record = $model::where($routeKeyName, $record)->firstOrFail();

This current implementation will work in most cases but not if the user customizes resolveRouteBinding() method which is common to do if you want to use something like http://hashids.org

The better way would be to use the model resolveRouteBinding() method instead of a custom query.

$this->record = (new $model())->resolveRouteBinding($record) 
    ?? throw (new ModelNotFoundException())->setModel($model, [$record]);

Avatar component does not accept a full image URL

Describe the bug
If \App\Models\User::getFilamentAvatar() return s a full URL - for example a Gravatar, Unavatar or similar service URL - the avatar blade component prepends the already absolute URL with the app URL.

Expected behavior
It should render the <img/> tag with the given full URL.

Screenshots
Bildschirmfoto 2021-03-18 um 17 50 33

Fix

Add another condition to the \Filament\View\Components\Avatar::src() method.

if (Str::startsWith($avatar, ['http://', 'https://'])) {
    return $avatar;
}

hasOne relations don't work when building a table

Describe the bug
A clear and concise description of what the bug is.

To reproduce
Steps to reproduce the behavior:

  1. Create a model that has a hasOne relationship
  2. Create a table for that model
  3. Print the relation with Columns\Text::make('myHasOneRelation')
  4. You see nothing
  5. Change the relationship on the model to a hasMany and you'll see the array printed with one object

Expected behavior
Receive the hasOne object so I could print it with formatUsing()

Context

  • Package version: 1.4.7
  • Livewire version: 2.3
  • Laravel version: 8.32.1
  • Browser: Chrome & Safari
  • Server OS: local macOS
  • PHP version: 7.4.4
  • Database: MySQL 8.0.19

PostgreSQL search issues

Describe the bug
I have a BelongsToSelect form relation in my post model. Components\BelongsToSelect::make('user_id')->relationship('user', 'username')->required(),

I can search any user who have the username all lowercase. But for those Uppercase one this never match, even if I search with the Uppercase letter.

To reproduce
Having uppercase username in a table with a BelongsToSelect relation.

Expected behavior
I expected to see any user matching the search term.

Screenshots
Screen Shot 2021-03-04 at 9 22 41 AM
Screen Shot 2021-03-04 at 9 22 50 AM

Context

  • Browser: Chrome
  • Server OS: Localhost on MacOS Catalina 10.15.7
  • PHP version: 8.0

Additional details

As you can see, when I type e I get EQuimper there. But the reason is because of the er at the end. This never match the big E

FileUpload Field Issue within Tabs?

Seems there is an issue with using tabs and the FileUpload field. Causes runaway network calls (see network console screenshot).

To reproduce
Steps to reproduce the behavior:

Define the follow schema:

    public static function form(Form $form)
    {
        return $form
            ->schema([
                Components\Tabs::make('Page')
                    ->tabs([
                        Components\Tab::make(
                            'SEO',
                            [
                                Components\FileUpload::make('record.seo_image')
                                    ->image()
                                    ->maxSize(5000)
                            ]
                        ),
                    ]),
            ]);
    }

Watch the console.... it will be calling the Livewire page resource causing your fan to go wild!

Context

  • Package version: develop
  • Browser: All
  • Server OS: [e.g. Mac BigSur 11.2.3]
  • PHP version: [e.g. 7.4]
  • Database: [e.g. MySQL 8.0]

Additional details
Add any other details about the problem here.

Update localization strings to use short keys

Migration to using short translation keys instead of the default translation would be a good idea. They allows us to serve more contextual translations, and keep them separate from app translations.

For example, the login button's current translation:

__('Login')

could be appropriately moved to:

__('filament::auth.login.buttons.submit')

Can not use float values in numeric inputs

Describe the bug
Float values are not accepted on numeric input because default step value is 1. Ability to setting step can be nice and will solve the issue.

To reproduce

  1. Create a TextField and set it numeric
  2. Type a float value
  3. Click save button
  4. See error

Expected behavior
I should be able to write float value on numeric input.

Screenshots
image

Context

  • Package version: 1.5.5
  • Livewire version: 2.4.0
  • Laravel version: 8.32.1
  • Browser: Chromium
  • Server OS: Arch Linux
  • PHP version: 8.0.1

Additional Details

My Code

public static function form(Form $form): Form
{
    return $form
        ->schema([
            Components\Checkbox::make("is_active"),
            Components\TextInput::make("name"),
            Components\TextInput::make("price")
                ->numeric(),
            Components\TextInput::make("currency"),
        ]);
}

Cant Install Filament

filament/field-file requires token

- Installing filament/field-file (dev-master 37c654c): Cloning 37c654c4d9 Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos

Form state is lost if returning from an Error Modal (e.g. SQL Error)

Describe the bug
If an SQL error occurs when submitting a Filament Resource Create form, then this gets displayed as a modal dialog, which you can click away from to get back to the form, which looks like it is still filled in. However when you try to resubmit it, it fails validation claiming that the required fields are missing.

To reproduce
Steps to reproduce the behavior:

Causing an SQL error... There's plenty of ways to achieve the same

  1. Set up a simple table and make sure that one column is not Nullable and has no default value - e.g.:
    $table->string('required_text');
    $table->string('blah');
  2. Create a Filament form schema for 'required_text' but not for 'blah

Reproducing

  1. Fill in your required field(s) and click 'Create'
  2. Creation fails with an SQL error (e.g. 'column [blah] has no default value')
  3. Click outside of the model error dialog
  4. Note that your required fields look as if they are complete
  5. Fix the SQL in the background (e.g. modfiy column 'blah' to be nullable or to have a valid default)
  6. Click 'Create' again
  7. You'll get a validation error claiming that the Required fields must be completed.

Expected behavior
I'd expect the form to still contian its values but for them to be accepted when re-trying the 'create'

Screenshots
Probably unnecessary. Can provide on request.

Context

  • Package version: 1.5.5
  • Livewire version: 2.4.0
  • Laravel version: 8.31.1
  • Browser: Firefox Developer Edition
  • Server OS: Homestead (Ubuntu)
  • PHP version: 7.4
  • Database: MariaDB

Additional details
Add any other details about the problem here.

Clicking label closes modal

Describe the bug
I have an issue when clicking on a label within the edit modal popup, it seems to be closing the modal. Can anybody else replicate this as well?

To reproduce
Steps to reproduce the behavior:

  1. Create a relationship in resource
  2. Click on edit on a row within the resource
  3. Click on a label when the edit modal pops up

Expected behavior
Modal shouldn't close when clicking on a label

Context

  • Browser: Firefox
  • Server OS: MacOs
  • PHP version: 7.4
  • Database: MySQL 5.7.31

Table view showing raw array for many to many relationships

Describe the bug
I've got a many-to-many relationship via a pivot table which I can successfully manage using a Relationship Manager to Add/Attach related objects.
However when viewing my Resource's table, if I try to display the related object(s), I get a raw array instead.

To reproduce
Steps to reproduce the behavior:

  1. Create two models linked with a belongsToMany() relationship via a pivot table (e.g. Products and Orders)
  2. Build a filament resource for the Orders model.
  3. Either set up a relation manager and link some Products to Orders or seed a couple into the database
  4. Back in the Resource, define a table column of Columns\Text::make('products.title')

Expected behavior
A list of linked object titles (either delimited, or as a bullet list)

Screenshots
image

Context

  • Package version: 1.6.4

Additional details
Example resourse based on ZoomPolls model with a modules() definition defining the pivot relationship to Modules model:

class ZoomPollResource extends Resource
{
    public static $icon = 'heroicon-o-collection';

    public static function form(Form $form)
    {
        return $form
            ->schema([
                Components\TextInput::make('title'),
            ]);
    }

    public static function table(Table $table)
    {
        return $table
            ->columns([
                Columns\Text::make('title'),
                Columns\Text::make('modules.title') // THIS Results in a raw array of the whole object(s) in the table
            ])
            ->filters([
                //
            ]);
    }

Setup PHP-CS-Fixer GitHub Action

It would be great to get some code formatting setup for the PHP files. There's 2 approaches we could take here:

  1. Automatically run the formatting action when somebody pushes to a PR (annoying because you would have to pull down between each push if changes have been committed back).
  2. Automatically run the formatting action when a PR is merged into develop (can cause merge conflicts if develop's formatting is newer than the branches).
  3. Manually trigger the action using a comment on the PR, such as /format-php (good because we can still run on an individual branch just before merging in).

Would be interested in your thoughts @danharrin and @ryanscherler.

Property not found on component

Describe the bug
Installed fresh latest Laravel 8 and filament cms, created model, migration and resource, added title field and tried to save, got this error or sometimes - No property found for validation

Screenshots
If applicable, add screenshots to help explain your problem.
image
image

Context

  • Browser: Chrome
  • Server OS: Laradock on Windows
  • PHP version: 7.4
  • Database: MySQL 8.0

File Upload Field not showing uploaded image preview in Relation Manager

After uploading a file in a modal via the Relation Manager, the file preview does not show.

To reproduce
Steps to reproduce the behavior:

  1. Setup a relation manager that includes a file upload field.
  2. Upload a file via a relation manager modal and save the record.
  3. Re-open the attached relation, the file upload image preview will not appear even though the file has been uploaded and record updated with the new file path.

Expected behavior
After uploading an image via the relation manager, the image preview should show the uploaded file in the modal.

Screenshots
If applicable, add screenshots to help explain your problem.

Context

  • Package version: [e.g. 1.5.5]
  • PHP version: [e.g. 7.4]
  • Database: [e.g. MySQL 8.0]

Layout issue with multiple resource relationships

Describe the bug
When adding 2 or more relationships to a resource the layout is not as expected with one section per relationship. Instead an empty section is created and associated relationship table is displayed inside the previous relationship section.

To reproduce
Steps to reproduce the behaviour:

  1. Add 2 or more relationships to a resource
  2. Create a record
  3. Edit the record
  4. You will see 2 relationships within the one section and a blank section below it

Expected behaviour
Each relationship component would be inside its own section

Screenshots

How the edit page looks
Incorrect layout out of multiple relationships

Page source for this layout
Src of layout issue

Looking at the page src it looks like the 2nd relationship component is being added into the first's section and a new section is also created with a blank div with the 2nd relationship's component's live wire id as well.

Expected layout
Expected layout of multiple relationships

Expected page source
Src of expected layout

Context

  • Package version: [1.4.5]
  • Livewire version: [2.3.0]
  • Laravel version: [8.30]
  • Browser: [Chrome]
  • Server OS: [OSX 10.11.6]
  • PHP version: [7.4]
  • Database: [MySQL 8.0]

Additional details
Original order of the relationships is as below

Relationship order

** Update **
If more than 2 relationships are added, the subsequent sections appear to be correct but the initial 2 are as described

4 relationships

Syntax error or access violation

Hey!

Awesome package!
Although out of the box navigating to the 'permissions' tab (/filament/permissions) I'm presented with this error

SQLSTATE[42000]: Syntax error or access violation: 1055 'mcpro.permissions.name' isn't in GROUP BY (SQL: select count(*) as aggregate from (select `permissions`.* from `permissions` group by `permissions`.`id`) as `permissions`) (View: /Users/josh/code/mcpro/vendor/livewire/livewire/src/Macros/livewire-view.blade.php)

Not looked into it yet, if I grab a chance I'll see if I can chuck together a PR to fix this!

BelongsToSelect - All of the related records are loaded

First of all thank you guys for Filament. It's extreamly powerfull.

The documentation of BelongsToSelect says: "By default, options will only load when you start typing a search". This is not the case. All of the related records are loaded on pageload (thousands in my case).

When you type to search, it doesn't send ajax request to the server.

Context

  • Package version: v1.65

RelationManager not found by Livewire

Describe the bug
If you are registering a resource in a package using Filament\PluginServiceProvider you get the following error when your resource includes a RelationManager.

image

To reproduce
Steps to reproduce the behavior:

  1. Extend Filament\PluginServiceProvider in your package
  2. Create a resource with a RelationManager
  3. View the resource

Expected behavior
The relation manager should load correctly.

image

Screenshots
If applicable, add screenshots to help explain your problem.

Context

  • Package version: [e.g. 0.1.0] 1.5.5
  • Livewire version: [e.g. 2.0.0] 2.3.5
  • Laravel version: [e.g. 8.0.0] 8.32
  • Browser: [e.g. Chrome, Safari] Chrome
  • Server OS: [e.g. Ubuntu 18.04.4] Ubuntu 18.04.4
  • PHP version: [e.g. 7.4] 7.4
  • Database: [e.g. MySQL 8.0] N/A

Additional details
None

Column not found: SQLSTATE error

Roles route

SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'order clause' (SQL: select * from roles order by `` asc limit 12 offset 0) (View: $project_path\vendor\livewire\livewire\src\Macros\livewire-view.blade.php)

Permission route

SQLSTATE[42S22]: Column not found: 1054 Unknown column '' in 'order clause' (SQL: select * from (select permissions.* from permissions group by permissions.id) as permissions order by `` asc limit 12 offset 0) (View: $project_path\vendor\livewire\livewire\src\Macros\livewire-view.blade.php)

Reply if anyone got the solution

Unable to install

Describe the bug
Following the "Getting Started" guide, when I get to the third step I get an error.

To reproduce
did this:

composer require filament/filament
php artisan migrate

Then this, but get an error: Route [filament.auth.login] not defined

php artisan make:filament-user

I enter name, password and "yes" to create an administrator user.

Screenshots

Context
Fresh Laravel 8 Jetstream with Teams and Livewire.
php 8

$resource is undefined - @jetstreams

Describe the bug
when ejecute php artisan make:filament-page Settings trow $resource is undefined

To reproduce
Steps to reproduce the behavior:
ejecute php artisan make:filament-page Settings

Expected behavior
$resource is undefined

{

    $this->items = collect();



    $this->items->push(

        NavigationItem::make('filament::dashboard.title', route('filament.dashboard'))

            ->activeRule('filament.dashboard')

            ->icon('heroicon-o-home')

            ->sort(-1),

    );



    foreach (Filament::getResources() as $resource) {

        if ($resource::authorizationManager()->can()) {

            $this->items->push(...$resource::navigationItems());

        }

    }



    foreach (Filament::getPages() as $page) {

        if ($resource::authorizationManager()->can()) {

            $this->items->push(...$page::navigationItems());

        }

    }



    return $this->items->sortBy(fn ($item) => $item->sort);

}



public function render()

{

    return view('filament::components.nav');

}

}

Screenshots

error

Composer issue

Since filament package require php 7.2 as minimum requirement version of php but I got error.

driesvints/blade-icons 2.2.0 requires php ^7.4 -> your PHP version (7.2.*) does not satisfy that requirement.

Resource listing page deletion issue

Describe the bug
When selecting one or more items from a resource list page and trying to delete them an exception happens.

To reproduce
Steps to reproduce the behaviour:

  1. Install Filament version >= 1.50
  2. Go to a resource listing page
  3. Select 1 or more items to delete
  4. Click on the delete button
  5. Confirm the deletion from the modal
  6. The exception happens

Expected behaviour
The selected items in the resource list should be deleted from the database and the change reflected in the page

Screenshots

Deleting a single item
Single item delete result

Deleting multiple items - long numbers in query are fake id and sku values from a product record
Multi item select

Multiple item delete result

Context

  • Package version: [>= 1.5.0]
  • Livewire version: [2.3.0]
  • Laravel version: [>= 8.12.0]
  • Browser: [Chrome latest]
  • Server OS: [OSX 10.11.6]
  • PHP version: [7.4.14]
  • Database: [MySQL 8.0.23]

Additional details
Issue seems to be different for single and multiple selections - with multiple selections, the ids passed into the IN clause in the query do not reflect the record ids that should be selected. Instead they look like they contain the other field values from one of the selected records and not a sequence of integers as expected.

database entry

Delete buttons in the item edit pages still work as expected.

I rolled back my repo until I found the version were this began - version 1.4.8 worked as expected and no other packages etc have been updated, only filament version was increased. Happens in all versions from 1.5.0 upwards.

Also still happens if I then update all other packages to the current latest versions.

I have also cleared and rebuilt the database, rerun all migrations, reinstalled all vendor packages and cleared all caches etc

Component\BelongsToSelect - 'Create' fails (foreign id is null) yet Select is correcly populated and 'Update' works.

Describe the bug
I'm trying to build a form which uses the belongsTo() relationship from my model in order to populate a select list.
The select list contains the expected list of items in the create form, however when I press 'Create' to commit the data, the relevant foreign id in my table is null (which also causes an SQL exception unless that id is nullable).

Taking an existing item and changing the relationship using the select works as expected.

To reproduce
Steps to reproduce the behavior:

  1. Create a relationship between Thing and UsedThing where each UsedThing can relate back to exactly one Thing, but Thing's reverse relationship describes it as being used by Many Things..
    e.g. (Very roughly):
MIGRATIONS:
table things
     - int 'id' (not null)
     - string 'thing_name'
    
table used_things
     - int 'id' (not null)
     - foreign key 'thing_id' (not null) -> relates to 'id' on 'things' table.
     - string 'description'

MODELS:
Model Things 
   function usedThings() {  return $this->hasMany(UsedThing::class); }

Model UsedThing
   function thing() { return $this->belongsTo(Thing::class); }

SEEDERS:
Seed two or more Things into the 'things' table -e.g. 
['id' => 1, 'thing_name' => 'thing 1']
['id' => 2, 'thing_name' => 'thing 2']

Seed a good example into the 'used_things' table -e.g. 
['id' => 1, 'thing_id' => 1, 'description' => 'Working Relationship']

RESOURCES:
Resource UsedThingResource
 $form->schema([
    Components\BelongsToSelect::make('thing_id')->relationship('thing','thing_name')->preload(),
    Components\TextInput::make('description')->required(),
 ]);
  1. Try to use the Filament autogenerated form to Create a new UsedThing
  2. The select list should be correctly populated with all Things : Choose any option.
  3. When you click 'Create', you should expect to see an SQL error that [thing_id] can't be null and has no default value.
  4. From the main Filament List of 'Things' try using the Edit option
  5. Change the selected 'thing' and click 'Save'
  6. This should work as expected

Expected behavior
Using the BelongsToSelect should be able to create a UsedThing with 'thing_id' set to the 'id' of the Thing that was chosen in the select list.

Screenshots
Can provide on Request.

Context

Package version: 1.5.5
Livewire version: 2.4.0
Laravel version: 8.31.1
Browser: Firefox Developer Edition
Server OS: Homestead (Ubuntu)
PHP version: 7.4
Database: MariaDB

Additional details
Add any other details about the problem here.

Route [filament.users.index] not defined

I am getting an exception when I try to login to dashboard as an admin:
Symfony\Component\Routing\Exception\RouteNotFoundException Route [filament.users.index] not defined. (View: \www\projet\vendor\filament\filament\resources\views\components\layouts\app.blade.php)

This happens only to admin user. I am using laravel 8 and Jetstream, I tried to look for this route and I did not find it on vendor folder.

Let me know if you need any more details.

Unexpected behavior when overwriting edit action

Describe the bug
When you overwrite the openEdit() method on a relations manager table to redirect and navigate back the edit button doesn't work until je refresh the page.

Context, would like to edit a resource that is attached on it's own edit page vs the relations popup because the resource itself has a second layer deep relation which is not shown.

To reproduce
Steps to reproduce the behavior:

  1. Create a relationsManager for an object that has their own relationship
  2. Overwrite the openEdit method likte this:
    public function openEdit($record)
    {
        $this->redirect(UserResource::generateUrl('edit',[$record]));
    }
  1. Edit the record and press the back button in Chrome/Safari
  2. The edit button doesn't redirect anymore and you need to refresh the page

Context

  • Package version: Latest Dev
  • Livewire version: 2.3
  • Laravel version: 8.32.1
  • Browser: Chrome & Safari
  • Server OS: local macOS
  • PHP version: 7.4.4
  • Database: MySQL 8.0.19

Mismatch between documented behavior and actual behavior of disabled() on form field

Describe the bug
The documentation makes it look like you can pass a boolean to the disabled method on a form component, but the method doesn't actually accept a parameter. This means it's not possible to conditionally disable a field. The reason this is a bug rather than a feature request is simply that it doesn't behave the way the documentation looks like it should.

To reproduce

Attempt to use the disabled method as described in the documentation:

->disabled($disabled = false) // Make the field read-only.

Expected behavior

Screenshots
If applicable, add screenshots to help explain your problem.

Context

  • Package version: 1.5.5
  • Livewire version: 2.4.0
  • Laravel version: 8.32.1
  • Browser: N/A
  • Server OS: Mac
  • PHP version: 8.0
  • Database: [e.g. MySQL 8.0]

Additional details
Add any other details about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.