Laravel, how to validate an enum columnLaravel - Eloquent or Fluent random rowLaravel requires the Mcrypt PHP extensionLaravel 4 Eloquent Query Using WHERE with OR AND OR?How to Use Order By for Multiple Columns in Laravel 4?Laravel Eloquent: Ordering results of all()Laravel 4: how to “order by” using Eloquent ORMHow to Create Multiple Where Clause Query Using Laravel Eloquent?Get Specific Columns Using “With()” Function in Laravel EloquentGet the Last Inserted Id Using Laravel EloquentLaravel Migration Change to Make a Column Nullable
What is realistic quality of computer blueprints quickly backed up before apocalypse and their impact on future design?
Does KNN have a loss function?
Should 2FA be enabled on service accounts?
Went to a big 4 but got fired for underperformance in a year recently - Now every one thinks I'm pro - How to balance expectations?
Misrepresentation on DS-160
Can I say "Gesundheit" if someone is coughing?
Feedback diagram
Why is “deal 6 damage” a legit phrase?
Were there any unmanned expeditions to the moon that returned to Earth prior to Apollo?
Backpacking with incontinence
Ernie and the Superconducting Boxes
Is it moral to remove/hide certain parts of a photo, as a photographer?
Partial Fractions: Why does this shortcut method work?
Python π = 1 + (1/2) + (1/3) + (1/4) - (1/5) + (1/6) + (1/7) + (1/8) + (1/9) - (1/10) ...1748 Euler
If I buy and download a game through second Nintendo account do I own it on my main account too?
What is the reason behind water not falling from a bucket at the top of loop?
A way of getting tenure for a non-creative person
Is Illustrator accurate for business card sizes?
Reasons for using monsters as bioweapons
Could flaps be raised upward to serve as spoilers / lift dumpers?
How to trick a fairly simplistic kill-counter?
Should I take up a Creative Writing online course?
Does the problem of P vs NP come under the category of Operational Research?
Can birds evolve without trees?
Laravel, how to validate an enum column
Laravel - Eloquent or Fluent random rowLaravel requires the Mcrypt PHP extensionLaravel 4 Eloquent Query Using WHERE with OR AND OR?How to Use Order By for Multiple Columns in Laravel 4?Laravel Eloquent: Ordering results of all()Laravel 4: how to “order by” using Eloquent ORMHow to Create Multiple Where Clause Query Using Laravel Eloquent?Get Specific Columns Using “With()” Function in Laravel EloquentGet the Last Inserted Id Using Laravel EloquentLaravel Migration Change to Make a Column Nullable
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to make an enum column validation in laravel. This is the code of my validator.
/**
* Returns the rules and messages for validating this creation
*/
public static function ValidationBook($except = [], $append = []) string',
'concert.user_id' => 'required
The enum column is the type
column. Also I've tried to do 'concert.type' => 'required|in:public,private'
Then I create my Validator using the following code:
$vb = Concert::ValidationBook($except, $append);
$validator = Validator::make($data, $vb['rules'], $vb['messages']);
But for some reason, when I send the post via Postman, i got "detail": "Undefined index: concert.type"
.
Even when my data is:
"concert":
"title": "Title",
"type": "novalidtype",
"status": "open"
Thanks in advance
laravel eloquent laravel-validation
add a comment |
I'm trying to make an enum column validation in laravel. This is the code of my validator.
/**
* Returns the rules and messages for validating this creation
*/
public static function ValidationBook($except = [], $append = []) string',
'concert.user_id' => 'required
The enum column is the type
column. Also I've tried to do 'concert.type' => 'required|in:public,private'
Then I create my Validator using the following code:
$vb = Concert::ValidationBook($except, $append);
$validator = Validator::make($data, $vb['rules'], $vb['messages']);
But for some reason, when I send the post via Postman, i got "detail": "Undefined index: concert.type"
.
Even when my data is:
"concert":
"title": "Title",
"type": "novalidtype",
"status": "open"
Thanks in advance
laravel eloquent laravel-validation
add a comment |
I'm trying to make an enum column validation in laravel. This is the code of my validator.
/**
* Returns the rules and messages for validating this creation
*/
public static function ValidationBook($except = [], $append = []) string',
'concert.user_id' => 'required
The enum column is the type
column. Also I've tried to do 'concert.type' => 'required|in:public,private'
Then I create my Validator using the following code:
$vb = Concert::ValidationBook($except, $append);
$validator = Validator::make($data, $vb['rules'], $vb['messages']);
But for some reason, when I send the post via Postman, i got "detail": "Undefined index: concert.type"
.
Even when my data is:
"concert":
"title": "Title",
"type": "novalidtype",
"status": "open"
Thanks in advance
laravel eloquent laravel-validation
I'm trying to make an enum column validation in laravel. This is the code of my validator.
/**
* Returns the rules and messages for validating this creation
*/
public static function ValidationBook($except = [], $append = []) string',
'concert.user_id' => 'required
The enum column is the type
column. Also I've tried to do 'concert.type' => 'required|in:public,private'
Then I create my Validator using the following code:
$vb = Concert::ValidationBook($except, $append);
$validator = Validator::make($data, $vb['rules'], $vb['messages']);
But for some reason, when I send the post via Postman, i got "detail": "Undefined index: concert.type"
.
Even when my data is:
"concert":
"title": "Title",
"type": "novalidtype",
"status": "open"
Thanks in advance
laravel eloquent laravel-validation
laravel eloquent laravel-validation
edited Mar 27 at 0:29
Jacobo Tapia
asked Mar 27 at 0:23
Jacobo TapiaJacobo Tapia
4081 gold badge2 silver badges13 bronze badges
4081 gold badge2 silver badges13 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Normally enum will be set in database like, and front end will be a drop down list
$table->enum('concert_type', ['public', 'private']);
However you can try out this solution
'concert_type' => 'in:public,private',
// Public or Private values
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368058%2flaravel-how-to-validate-an-enum-column%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Normally enum will be set in database like, and front end will be a drop down list
$table->enum('concert_type', ['public', 'private']);
However you can try out this solution
'concert_type' => 'in:public,private',
// Public or Private values
add a comment |
Normally enum will be set in database like, and front end will be a drop down list
$table->enum('concert_type', ['public', 'private']);
However you can try out this solution
'concert_type' => 'in:public,private',
// Public or Private values
add a comment |
Normally enum will be set in database like, and front end will be a drop down list
$table->enum('concert_type', ['public', 'private']);
However you can try out this solution
'concert_type' => 'in:public,private',
// Public or Private values
Normally enum will be set in database like, and front end will be a drop down list
$table->enum('concert_type', ['public', 'private']);
However you can try out this solution
'concert_type' => 'in:public,private',
// Public or Private values
answered Mar 27 at 2:10
Lim Kean PhangLim Kean Phang
4003 silver badges6 bronze badges
4003 silver badges6 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368058%2flaravel-how-to-validate-an-enum-column%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown