Skip to content

Commit acb96cb

Browse files
committed
updated readme for shorthand methods
1 parent 673d057 commit acb96cb

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,10 @@ See [Examples](https://github.com/tipsyphp/tipsy/wiki/Examples) for more detaile
2020

2121
###### index.php
2222
```php
23-
$tipsy->router()
24-
->home(function($Scope, $View) {
25-
$Scope->user = 'Mai Tai';
26-
$View->display('hello');
27-
});
23+
$app->home(function($Scope, $View) {
24+
$Scope->user = 'Mai Tai';
25+
$View->display('hello');
26+
});
2827
```
2928

3029
###### hello.phtml
@@ -37,15 +36,18 @@ $tipsy->router()
3736
###### index.php
3837

3938
```php
40-
$tipsy->router()
41-
->delete('api/maitai/:id', function($Params) {
42-
echo json_encode([message => $Params->id]);
39+
$app->post('drink/:id', function($Params, $Request, $Maitai) {
40+
$Maitai
41+
->load($Params->id)
42+
->serialize($Request->request())
43+
->save();
44+
echo $Maitai->json()
4345
});
4446
```
4547

46-
###### DELETE /api/maitai/1
48+
###### POST /drink/1?rating=5&name=maitai
4749
```
48-
{"message": 1}
50+
{"id": 1, "name": "maitai", "rating": 5}
4951
```
5052

5153
---

0 commit comments

Comments
 (0)