public function insertimages($sid, $fullpath, $name) { $images = new Image(); $images->path = $fullpath; $images->alt = $name; $images->name = $name; $images->save(); $imageid = $images->id; $its = new Images_to_slider(); $its->s_id = $sid; $its->t_id = $imageid; $its->save(); return true; }