KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

I cann't access custom model attribute in the blade file #2758

Open Abdulrahman opened this topic on on Jul 18, 2022 - 1 comments

Abdulrahman commented on Jul 18, 2022

I have model called Media and has custom attribute called url like below:

class Media extends BaseMedia
{
  
    public function getUrlAttribute(): string
    {
        return $this->getUrl();
    }

This attribute get url value from any place of the project well unless the report blade file and here is my code:

Get Method

function get_media_url_by_uuid(string $uuid)
{
    return \App\Models\Media::where('uuid', $uuid)->first();
}

Access in the blade file:

get_media_url_by_uuid('282f0523-7ab2-4dcb-829e-d082868225a8')->getUrl()

The error:

Target class [filesystem] does not exist. (View: /home/project-path/resources/views/reports/sheets/sheet-report.blade.php)

Thanks in advance

Abdulrahman commented on Jul 19, 2022

I found if I did called the same helper function from report class I get the same error.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
bug
help needed

None