public create ([mixed $data], [mixed $whiteList])
Inserts a model instance. If the instance already exists in the persistence it will throw an exception Returning true on success or false otherwise.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | //Creating a new robot $robot = new Robots(); $robot ->type = 'mechanical' ; $robot ->name = 'Astro Boy' ; $robot ->year = 1952; $robot ->create(); //Passing an array to create $robot = new Robots(); $robot ->create( array ( 'type' => 'mechanical' , 'name' => 'Astro Boy' , 'year' => 1952 )); |
Please login to continue.