This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
JimRed
Hello Guys,
Could you please help me?
My question is that how can I use models in pages?
I've created a model called Firm and I've tried to print the firm name of the 2nd record to the page so I wrote the following code:
function onStart(){
$firm = Firm::find(2);
$this['firm'] = $firm->firm_name;
}
But it says that Firm class does not exist.
Could you please help me how should I do this?
Thank you guys!
Last updated
Daniel81
<?php
use Path/To/Firm;
function onStart() {
$firm = Firm::find(2);
$this['firm'] = $firm->firm_name;
}
?>
1-3 of 3