app/Http/Livewire/CrudPost.php
/**
     * Can't store a eloquent model in a public property without significant side effects. That is why we are deconstrucing.
     * Side effects include:
     * 1. Mainly: 404 error on requests when this class is updated on livewire requests.
     * 2. Poor performance when editing. The post gets hydrated from the database with each update.
     */
Can't store a eloquent model in a public property without significant side effects. That is why we are deconstrucing.
Side effects include:
1. Mainly: 404 error on requests when this class is updated on livewire requests.
2. Poor performance when editing. The post gets hydrated from the database with each update.
Can ' t store a eloquent model in a public property without significant side effects . That is why we are deconstrucing . Side effects include : 1 . Mainly : 404 error on requests when this class is updated on livewire requests . 2 . Poor performance when editing . The post gets hydrated from the database with each update .
public function mount(?Post $post)
    {
        $post = $post ?? new Post();
        $this->postId = $post->id;
        $this->title = $post->title;
        $this->description = $post->description;
        $this->markdown = $post->markdown;
        $this->public = $post->public;
    }
public function mount ( ? Post $ post ) { $ post = $ post ?? new Post ( ) ; $ this -> postId = $ post -> id ; $ this -> title = $ post -> title ; $ this -> description = $ post -> description ; $ this -> markdown = $ post -> markdown ; $ this -> public = $ post -> public ; }
Can't store a eloquent model in a public property without significant side effects.
Can ' t store a eloquent model in a public property without significant side effects .