PHP code example of atk4 / mastercrud
1. Go to this page and download the library: Download atk4/mastercrud library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
atk4 / mastercrud example snippets
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client');
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', ['Invoices' => []]);
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', ['Invoices' => ['Lines' => []]]);
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', ['Invoices' => ['Lines' => []], 'Payments' => []]);
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', [
'Invoices' => [
'Lines' => [],
],
'Payments' => [],
]);
$app->layout->add(new \Atk4\MasterCrud\MasterCrud())
->setModel(new \Saasty\Model\App($app->db),
[
'columnActions' => [
'repair' => ['icon' => 'wrench'],
],
'Models' => [
'columnActions' => [
'migrate' => ['icon' => 'database'],
],
'Fields' => [
'ValidationRules' => [],
],
'Relations' => [
'ImportedFields' => [],
],
],
[
'columnActions' => [
'sendEmail' => ['icon' => 'wrench', 'email' => 'string'],
]
]
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', [
'Invoices' => [
'Lines' => [],
'Allocations' => [],
],
'Payments' => [
'Allocations' => [],
],
]);
$crud = \Atk4\MasterCrud\MasterCrud::addTo($app);
$crud->setModel('Client', [
'Invoices' => [
'Lines' => [],
'Allocations' => [
'payment_id' => ['path' => 'Payments', 'payment_id' => 'payment_id'],
],
],
'Payments' => [
'Allocations' => [
'invoice_id' => ['path' => 'Invoices', 'invoice_id' => 'invoice_id'],
],
],
]);