Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
onestartup-blog
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Angel Martin
onestartup-blog
Commits
312e39db
Commit
312e39db
authored
Jul 17, 2018
by
Francisco Salazar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
validate slug
parent
2155fd4e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
RequestCategory.php
src/requests/RequestCategory.php
+9
-2
RequestEntry.php
src/requests/RequestEntry.php
+9
-2
No files found.
src/requests/RequestCategory.php
View file @
312e39db
...
...
@@ -23,11 +23,17 @@ class RequestCategory extends FormRequest
*/
public
function
rules
()
{
if
(
$this
->
get
(
"_method"
)
==
"PUT"
||
$this
->
get
(
"_method"
)
==
"PATCH"
){
$slug
=
'required|max:255|unique:entry_categories,slug,'
.
$this
->
route
(
"category"
);
}
else
{
$slug
=
'required|max:255|unique:entry_categories,slug'
;
}
return
[
'name'
=>
'required|max:355'
,
'slug'
=>
'required|max:255'
,
'slug'
=>
$slug
,
'description'
=>
'max:455'
,
'active'
=>
'required'
'active'
=>
'required'
,
'portada'
=>
'image'
];
}
}
\ No newline at end of file
src/requests/RequestEntry.php
View file @
312e39db
...
...
@@ -23,14 +23,21 @@ class RequestEntry extends FormRequest
*/
public
function
rules
()
{
if
(
$this
->
get
(
"_method"
)
==
"PUT"
||
$this
->
get
(
"_method"
)
==
"PATCH"
){
$slug
=
'required|max:255|unique:entries,slug,'
.
$this
->
route
(
"entry"
);
}
else
{
$slug
=
'required|max:255|unique:entries,slug'
;
}
return
[
'title'
=>
'required|max:355'
,
'slug'
=>
'required|max:255'
,
'slug'
=>
$slug
,
'status'
=>
'required|numeric'
,
'tags'
=>
'required|max:800'
,
'publication_date'
=>
'required'
,
'category_id'
=>
'required'
,
'body'
=>
'required'
'body'
=>
'required'
,
'cover'
=>
'image'
];
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment