Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Commit cbbf092

Browse files
committed
more cleanup, fix migration error when changing column names
1 parent 4a09aad commit cbbf092

File tree

3 files changed

+39
-15
lines changed

3 files changed

+39
-15
lines changed

src/SimpleMenu.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ public function __construct()
1616
{
1717
$this->listFileDir = config('simpleMenu.routeListPath');
1818

19-
// create routes
20-
$this->createRoutes();
19+
if (!app()->runningInConsole()) {
20+
// create routes
21+
$this->createRoutes();
2122

22-
// create menu
23-
$this->createMenus();
23+
// create menu
24+
$this->createMenus();
25+
}
2426
}
2527
}

src/database/seeds/PagesTableSeeder.php

+25-3
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,33 @@ public function run()
1313
{
1414
$faker = Factory::create();
1515

16-
$heros = ['Home', 'About', 'Contact Us'];
16+
Page::create([
17+
'template' => 'hero',
18+
'route_name'=> str_slug('Home'),
19+
'action' => 'PageController@'.camel_case('Home'),
20+
'title' => [
21+
'en' => title_case('Home'),
22+
'fr' => title_case('Home'),
23+
],
24+
'body' => [
25+
'en' => $faker->text(),
26+
'fr' => $faker->text(),
27+
],
28+
'desc' => [
29+
'en' => $faker->text(),
30+
'fr' => $faker->text(),
31+
],
32+
'url' => [
33+
'en' => '/',
34+
'fr' => '/',
35+
],
36+
]);
37+
38+
$heros = ['About', 'Contact Us'];
1739
foreach ($heros as $one) {
1840
Page::create([
19-
'route_name'=> str_slug($one),
2041
'template' => 'hero',
42+
'route_name'=> str_slug($one),
2143
'action' => 'PageController@'.camel_case($one),
2244
'title' => [
2345
'en' => title_case($one),
@@ -44,8 +66,8 @@ public function run()
4466
$fr = $faker->unique()->city;
4567

4668
Page::create([
47-
'route_name'=> str_slug($en),
4869
'template' => 'hero',
70+
'route_name'=> str_slug($en),
4971
'title' => [
5072
'en' => title_case($en),
5173
'fr' => title_case($fr),

src/resources/views/pages/bulma/menus/index.blade.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
@lang('SimpleMenu::messages.menus.title') "{{ count($menus) }}"
77
<a href="{{ route('admin.menus.create') }}" class="button is-success">@lang('SimpleMenu::messages.app_add_new')</a>
88
</h3>
9-
9+
1010
<table class="table is-bordered">
1111
<thead>
1212
<tr>
1313
<th>@lang('SimpleMenu::messages.menus.fields.name')</th>
1414
<th>@lang('SimpleMenu::messages.ops')</th>
1515
</tr>
1616
</thead>
17-
17+
1818
<tbody>
1919
@if (count($menus) > 0)
20-
@foreach ($menus as $permission)
21-
<tr data-entry-id="{{ $permission->id }}">
22-
<td>{{ $permission->name }}</td>
20+
@foreach ($menus as $menu)
21+
<tr>
22+
<td>{{ $menu->name }}</td>
2323
<td>
24-
<a href="{{ route('admin.menus.edit',[$permission->id]) }}" class="button is-info is-inline-block">
24+
<a href="{{ route('admin.menus.edit',[$menu->id]) }}" class="button is-info is-inline-block">
2525
@lang('SimpleMenu::messages.app_edit')
2626
</a>
2727
<a class="is-inline-block">
28-
{{ Form::open(['method' => 'DELETE', 'route' => ['admin.menus.destroy', $permission->id]]) }}
28+
{{ Form::open(['method' => 'DELETE', 'route' => ['admin.menus.destroy', $menu->id]]) }}
2929
{{ Form::submit(trans('SimpleMenu::messages.app_delete'), ['class' => 'button is-danger']) }}
3030
{{ Form::close() }}
3131
</a>
@@ -39,4 +39,4 @@
3939
@endif
4040
</tbody>
4141
</table>
42-
@stop
42+
@stop

0 commit comments

Comments
 (0)