Added vendor/ directory for Composer's installed files
This commit is contained in:
21
vendor/alexgarrett/violin/examples/errors/errors_all.php
vendored
Executable file
21
vendor/alexgarrett/violin/examples/errors/errors_all.php
vendored
Executable file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Violin example. All errors.
|
||||
*
|
||||
* Simply getting a list of errors that occured while trying
|
||||
* to validate the data passed in against the rules given.
|
||||
*/
|
||||
|
||||
require '../../vendor/autoload.php';
|
||||
|
||||
use Violin\Violin;
|
||||
|
||||
$v = new Violin;
|
||||
|
||||
$v->validate([
|
||||
'username' => ['dalegarrett1234567890', 'required|alpha|min(3)|max(20)'],
|
||||
'email' => ['dale.codecourse.com', 'required|email']
|
||||
]);
|
||||
|
||||
var_dump($v->errors()->all()); // Array of all errors.
|
22
vendor/alexgarrett/violin/examples/errors/errors_field.php
vendored
Executable file
22
vendor/alexgarrett/violin/examples/errors/errors_field.php
vendored
Executable file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Violin example. Errors for a specific field.
|
||||
*
|
||||
* Simply getting a list of errors for a specific field that
|
||||
* occured while trying to validate the data passed in
|
||||
* against the rules given.
|
||||
*/
|
||||
|
||||
require '../../vendor/autoload.php';
|
||||
|
||||
use Violin\Violin;
|
||||
|
||||
$v = new Violin;
|
||||
|
||||
$v->validate([
|
||||
'username' => ['dalegarrett1234567890', 'required|alpha|min(3)|max(20)'],
|
||||
'email' => ['dale.codecourse.com', 'required|email']
|
||||
]);
|
||||
|
||||
var_dump($v->errors()->get('username')); // Array of all 'username' errors.
|
25
vendor/alexgarrett/violin/examples/errors/errors_first.php
vendored
Executable file
25
vendor/alexgarrett/violin/examples/errors/errors_first.php
vendored
Executable file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Violin example. Checking and getting first error.
|
||||
*
|
||||
* This checks a specific field has an error, and then outputs
|
||||
* the first error that occured for that field. This is most
|
||||
* likely what you'd use in a real life situation within
|
||||
* your HTML form.
|
||||
*/
|
||||
|
||||
require '../../vendor/autoload.php';
|
||||
|
||||
use Violin\Violin;
|
||||
|
||||
$v = new Violin;
|
||||
|
||||
$v->validate([
|
||||
'username' => ['dalegarrett1234567890', 'required|alpha|min(3)|max(20)'],
|
||||
'email' => ['dale.codecourse.com', 'required|email']
|
||||
]);
|
||||
|
||||
if ($v->errors()->has('email')) { // Check if any errors exist for 'email'.
|
||||
echo $v->errors()->first('email'); // First 'email' error (string).
|
||||
}
|
Reference in New Issue
Block a user