This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Troiscent
Troiscent

Hello,

For ajax filtering purpose, somewhere in the code tab of my page I have the following line :

Post::Filter->orderBy('title', 'asc')->paginate(8, 1);

It works perfectly well, but the next step is to use a variable instead of "Post", something like that :

$model::Filter->orderBy('title', 'asc')->paginate(8, 1);

But it doesn't work, it display a popup saying "Post" is not found. Probably because my variable contain a "Post" string instead of a model reference, but I don't know the right syntax to convert my string variable to do what I need ?

Maybe it's a question related to laravel, or even standard PHP, I'm not sure, that's why I posted here, maybe october CMS have some helper function for that...

Thanks for your help

Asinox
Asinox

$model = '\\user\Plugin.Name\Models\\' . $variable;

Troiscent
Troiscent

Cool, thanks !

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.