Skip to content
Discussion options

You must be logged in to vote

In the latest version you can pass variables through mount just like you would expect. Here is an extreme example 🤯

    public ?string $dbTableName;

    public function mount($dbTableName = null)
    {
        $this->dbTableName = $dbTableName;
    }

    /**
    * The base query.
    */
    public function builder() : Builder
    {
        if(!isset($this->dbTableName)) {
            return parent::builder();
        }
        
       $model = new class extends \Illuminate\Database\Eloquent\Model {
       };

       $model->setTable($this->dbTableName);

       return $model->getQuery();
    }

Keep in mind that that only certain types of properties can be persisted on re-render as per L…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by AndMe2
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants