Welcome Guest, Not a member yet? Register   Sign In
How to access CI model in a plain php file?
#5

(10-16-2018, 09:26 AM)donpwinston Wrote: If ratings.php is a class make it Ratings.php and put it in the Libraries folder and namespace it like:

<?php namespace App\Libraries;
use App\Models\StarModel;

class Ratings {
   protected $starModel;

   public function __construct() {
       $starmodel = new StarModel();
   }
}

No - It's not a class but just contains very little code. The problem with moving to inside Application folder is I won't be able to access it directly e.g mydomain/star/ratings.php. I can easily duplicate the methods inside my model but that's what I am trying to avoid if possible.
Reply


Messages In This Thread
RE: How to access CI model in a plain php file? - by happyape - 10-16-2018, 09:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB