z-song / laravel-admin

Build a full-featured administrative interface in ten minutes
https://laravel-admin.org
MIT License
11.14k stars 2.81k forks source link

From setting Laravel9 Attribute . Error #5620

Open kkkreset opened 2 years ago

kkkreset commented 2 years ago

Description:

Error using attribute for form field.

Steps To Reproduce:

` $form->image('pic', __('pic'))->required()->name(function($file) { return md5('product_pic'.time().rand(0, 10000)).'.'.$file->guessExtension(); })->setElementClass(md5(microtime(true)));

public function pic(): Attribute
{
    return new Attribute(
        get: function($value) {
            return  $value;
        }
    );
}`

ERRIR: ` Call to undefined method Illuminate\Database\Eloquent\Casts\Attribute::addEagerConstraints()

`

technilogics commented 2 years ago

I updated form,grid and show classes as updated here https://github.com/z-song/laravel-admin/pull/5611

kkkreset commented 2 years ago

我在此处更新了表单、网格和显示类#5611

How do I update, or replace to your Git?

technilogics commented 2 years ago

I manual updated, just open #5611 click Update Grid.php open in your local project src/Grid.php

Carefully Add + lines and remove lines starts with - (Minus Sign)

I hope it will help you.

Repeat the process for other 3 files