Skip to content

Commit

Permalink
cleanup README
Browse files Browse the repository at this point in the history
  • Loading branch information
romaninsh committed Aug 16, 2018
1 parent 09c8965 commit 4d07424
Showing 1 changed file with 1 addition and 85 deletions.
86 changes: 1 addition & 85 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,90 +97,6 @@ Now you will be able to jump from `Invoice->allocation` to `Payment` and other w

### Installation

Install through composer (`composer require atk4\mastercrud`).













----------

OLD DOCS







![step1](docs/images/step1.png)

Selecting client shows a detailed view:

![step2](docs/images/step2.png)

Although not shown in this reference screenshot, but certain values (such as currency, payee, article, etc) may be configured to be clickable. Next if you open Payments tab, then `$client->ref('Payments')` will be set up for the CRUD:

![step3](docs/images/step3.png)

This can go as deep as necessary.

**CRUDCeption** can also be used with recursive models (which reference themselves)

### Installation and Use

Install through composer (`composer require atk4\crudception`) then use this code:

``` php
$app->add('\atk4\crudception\CRUD');
$app->setModel(
new Client($app->db),
[
'Payment'=>[
'Payments',
'contact_id'=>'/',
'Allocation'=>[
// empty means this is just a crud
]

],
'PayAcc'=>[
// seeding CRUD / View
['\atk4\crudception\CRUD', 'Payments on Account', ['name'], ['name', 'surname']],
]
]
);
```

If it's unclear from the example above, then `setModel` second argument is passed an array in format: `relation => definition`.

The element with index `0` can be a seed for populating a `atk4\crudception\CRUD`. Other keys must match existing reference within the model. `hasOne` references can be passed a "Path", where '/' refers to the top-most node and then you can specify reference, e.g. `/Payment/Allocation`. All the entity arguments will be passed along: `payment_id=123&allocation_id=234234`. You can make link to a different page by passing array: `['otherpage', 'id'=>'payment_id']`; in which case values of `id` will be mapped to `123`.

For `hasMany` relation, you have to specify an Array or a Callback. If you specify an Array, then it should also contain same definition. You can also specify a path here.

### How does it work

CRUD uses a Callback with 3 triggers - browsing, editing and deleting. CRUDception\CRUD implements another state called `detail` which will be linked to the Title column.

In this state, Tabs are added and the first column displays a selected model detail with a links to `hasOne` relations. Other tabs will contain `hasMany` relations.





See `demos/` for example usage. The above will have no impact, but will enable you to use other components.

## Roadmap

Generally we wish to keep this add-on clean, but very extensible, with various tutorials on how to implement various scenarios.

Install through composer (`composer require atk4/mastercrud`).


0 comments on commit 4d07424

Please sign in to comment.