Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Accessing a model from a controller
  • this is most likely a simple answer that i have overlooked.. I am trying to create a customer controller that accesses a custom model in FuelPHP as follows: class Controller_Casting extends Controller
    {
    public function action_index()
    {
    Model_casting::author_get();
    }
    } class Model_casting
    {
    public function author_get()
    {
    $query = DB::query('SELECT * FROM youtube_author');
    $result = $query->execute();
    print_r($result);
    }
    }
    An error is generated by the controller: ErrorException [ Error ]: Class 'Model_casting' not found In code igniter i would have to load the model before using it.. How do you do the same thing in FuelPHP (which i presume is where the issue lies).. The docs though indicate that it should auto load? Thanks,
  • It appears i was being dumb.. I was prefixing the model file name with "Model"..

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion