How Add Table on Database When Installation Package
Permalink 1 user found helpful
Hi all,
I wanna add table when Installation package. This is my code:
can anyone give me information for that?
thank you
I wanna add table when Installation package. This is my code:
public function install() { $pkg = parent::install(); // Install the Dashboard Screens // Loader::model('single_page'); // In version 5.6, bootstrap icons can be used in the dashboard! // $cak = CollectionAttributeKey::getByHandle('icon_dashboard'); $p = SinglePage::add('/dashboard/warna_produk/', $pkg); if (is_object($p) && $p->isError() !== false) { $p->update(array('cName' => t('Warna Produk'), 'cDescription' => 'Manage Warna Produk')); } $p = SinglePage::add('/dashboard/warna_produk/tambah', $pkg); if (is_object($p) && $p->isError() !== false) {
Viewing 15 lines of 21 lines. View entire code block.
can anyone give me information for that?
thank you
You don't need any code. Just define it in db.xml in the package directory (same place as the controller.php) and c5 will automatically pick it up and create tables when the package is installed.
thank you sk01 for reference database...
thank you JohntheFish, you solved my problem.
thank you JohntheFish, you solved my problem.
maybe this will help you:
http://www.concrete5.org/documentation/how-tos/developers/creating-...
cheers