php - Where to put model code in ORM ? (Eloquent) -


i dont quite understand code goes orm.

class brand_model extends my_model {  public function add_brand($name, $size) { //goal: //        $sql = "insert brand (name, size_id) values (?,?)"; //        $query = $this->db->query($sql, array($name, $size));      $brand = new self();     $brand->name=$name;     $brand->size=$size;     $brand->save();   } 

this produces new row in database, in appropriate table, no data inside of it. sure variables filled. ideas?

my design pattern pre orm put in model. way if multiple controllers need same data structure, call function once , handles validation/etc.

thanks!

please find link eloquent , codeigniter integration

http://mannyisles.com/using-eloquent-orm-inside-codeigniter.html


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -