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

Commit 2ac1539

Browse files
committed
add validation for action
1 parent 31d0aee commit 2ac1539

File tree

5 files changed

+54
-36
lines changed

5 files changed

+54
-36
lines changed

src/Controllers/Admin/Traits/PageOps.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ trait PageOps
1818
protected function sT_uP_Validaiton($request, $id = null)
1919
{
2020
$customMessages = [
21+
'action.regex' => trans('SimpleMenu::messages.regex', ['attribute' => trans('SimpleMenu::messages.action')]),
2122
'template.required_without' => trans('validation.required_without', [
2223
'attribute' => trans('SimpleMenu::messages.template'),
2324
'values' => trans('SimpleMenu::messages.action'),
@@ -31,6 +32,7 @@ protected function sT_uP_Validaiton($request, $id = null)
3132

3233
// main
3334
$validator = Validator::make($request->all(), [
35+
'action' => 'nullable|regex:/@/ius',
3436
'template' => 'required_without:action',
3537
'route_name' => 'required|unique:pages,route_name,' . $id ?: '',
3638
'url.*' => 'unique_translation:pages,url,' . $id ?: '',

src/resources/assets/sass/style.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ div.mce-edit-area {
6666
}
6767

6868
.notification > .delete {
69-
top: 0.45em;
69+
top: 0.5rem;
70+
right: 0.5rem;
7071
}
7172

7273
.ghost {

src/resources/lang/en/messages.php

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
11
<?php
22

33
return [
4-
'app_save' => 'Save',
5-
'app_update' => 'Update',
6-
'app_edit' => 'Edit',
7-
'app_add_new' => 'Add new',
8-
'app_delete' => 'Delete',
9-
'go_back' => 'Go Back',
10-
'app_no_entries' => 'No entries in table',
11-
'ops' => 'Operations',
12-
'title' => 'Title',
13-
'url' => 'Url',
14-
'template' => 'Template',
15-
'action' => 'Action',
16-
'route_name' => 'Route Name',
17-
'pages' => 'Pages',
18-
'permissions' => 'Permissions',
19-
'roles' => 'Roles',
20-
'menus' => 'Menus',
21-
'name' => 'Name',
22-
'route' => 'Route Name',
23-
'locals' => 'Title Available In',
24-
'users' => 'Users',
25-
'email' => 'Email',
26-
'meta' => 'Meta Keywords',
27-
'control' => 'Control',
28-
'content' => 'Content',
29-
'access' => 'Access',
30-
'guards' => 'Guards',
31-
'cover' => 'Cover',
32-
'avatar' => 'Avatar',
33-
'body' => 'Body',
34-
'desc' => 'Description',
35-
'url_prefix' => 'Url Prefix',
36-
'create_new' => 'Create new',
37-
'account' => 'Account',
38-
'password' => 'Password',
4+
'app_save' => 'Save',
5+
'app_update' => 'Update',
6+
'app_edit' => 'Edit',
7+
'app_add_new' => 'Add new',
8+
'app_delete' => 'Delete',
9+
'go_back' => 'Go Back',
10+
'ops' => 'Operations',
11+
'title' => 'Title',
12+
'url' => 'Url',
13+
'template' => 'Template',
14+
'action' => 'Action',
15+
'route_name' => 'Route Name',
16+
'pages' => 'Pages',
17+
'permissions' => 'Permissions',
18+
'roles' => 'Roles',
19+
'action' => 'Action',
20+
'menus' => 'Menus',
21+
'name' => 'Name',
22+
'route' => 'Route Name',
23+
'locals' => 'Title Available In',
24+
'users' => 'Users',
25+
'email' => 'Email',
26+
'meta' => 'Meta Keywords',
27+
'control' => 'Control',
28+
'content' => 'Content',
29+
'access' => 'Access',
30+
'guards' => 'Guards',
31+
'cover' => 'Cover',
32+
'avatar' => 'Avatar',
33+
'body' => 'Body',
34+
'desc' => 'Description',
35+
'url_prefix' => 'Url Prefix',
36+
'create_new' => 'Create new',
37+
'account' => 'Account',
38+
'background' => 'Background',
39+
'bio' => 'Bio',
40+
'password' => 'Password',
41+
'app_no_entries' => 'No entries in table',
42+
'status' => 'Status',
43+
'regex' => 'The :attribute must have an "@"',
3944
];

src/resources/views/admin/bulma/pages/create.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class="input toggle-pad"
5858
<div class="control">
5959
{{ Form::text('action', null, ['class' => 'input', 'placeholder'=>"SomeController@index"]) }}
6060
</div>
61+
@if($errors->has('action'))
62+
<p class="help is-danger">
63+
{{ $errors->first('action') }}
64+
</p>
65+
@endif
6166
</div>
6267

6368
{{-- template --}}

src/resources/views/admin/bulma/pages/edit.blade.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ class="input toggle-pad"
7373
'placeholder'=>"SomeController@index"])
7474
}}
7575
</div>
76+
@if($errors->has('action'))
77+
<p class="help is-danger">
78+
{{ $errors->first('action') }}
79+
</p>
80+
@endif
7681
</div>
7782

7883
{{-- template --}}

0 commit comments

Comments
 (0)