Skip to content

Commit d16a142

Browse files
authored
Merge pull request #20 from muhlisabdi/master
Add show method to controller.stub
2 parents cd87681 + 1c4564f commit d16a142

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"require": {
1515
"php": ">=7.0.0",
1616
"laravel/framework": "~5.5",
17-
"encore/laravel-admin": "~1.5"
17+
"encore/laravel-admin": "~1.6"
1818
},
1919
"require-dev": {
2020
"phpunit/phpunit": "~6.0"

src/Scaffold/stubs/controller.stub

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use Encore\Admin\Facades\Admin;
1010
use Encore\Admin\Layout\Content;
1111
use App\Http\Controllers\Controller;
1212
use Encore\Admin\Controllers\ModelForm;
13+
use Encore\Admin\Show;
1314

1415
class DummyClass extends Controller
1516
{
@@ -31,6 +32,29 @@ class DummyClass extends Controller
3132
});
3233
}
3334

35+
/**
36+
* Show interface.
37+
*
38+
* @param mixed $id
39+
* @param Content $content
40+
*
41+
* @return Content
42+
*/
43+
public function show($id)
44+
{
45+
return Admin::content(function (Content $content) use ($id) {
46+
47+
$content->header('Header');
48+
$content->description('Description');
49+
50+
$content->body(Admin::show(DummyModel::findOrFail($id), function (Show $show) {
51+
52+
$show->id('ID');
53+
54+
}));
55+
});
56+
}
57+
3458
/**
3559
* Edit interface.
3660
*

0 commit comments

Comments
 (0)