orchidsoftware / platform

Orchid is a @laravel package that allows for rapid application development of back-office applications, admin/user panels, and dashboards.
https://orchid.software
MIT License
4.26k stars 631 forks source link

Quickstart example throws exception #2712

Open Liburia opened 9 months ago

Liburia commented 9 months ago

https://orchid.software/en/docs/quickstart-crud/

When trying to create a post, I get an exception Call to a member function fill() on null at line $this->post->fill($request->get('post'))->save();

surajtiwari06 commented 9 months ago

try instead $post->fill($request->get('post'))->save();

Liburia commented 9 months ago

There is no $post anywhere in the scope, therefore, it understandably gives an undefined variable exception.

tabuna commented 9 months ago

Hello, I'm sorry to inform you that the issue has been poorly documented and lacks the necessary data that could be of assistance, such as the package version.

In case the value of $post is null, it is highly probable that you have either not defined a public property or are using previous versions of the package.

Liburia commented 9 months ago

Hello.

I am using "orchid/platform": "^14.0" and the Screen's content is a straight copy-paste from the docs page.

public $post; is defined. Moreover, the post injection works properly in the name method.

    public function name(): ?string
    {
        return $this->post->exists ? 'Edit post' : 'Creating a new post';
    }