PHP code example of johnvict / error-format
1. Go to this page and download the library: Download johnvict/error-format library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
johnvict / error-format example snippets
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Johnvict\ErrorFormat\Services\ErrorFormat;
class ExampleController extends Controller
{
/**
* Add the ErrorFormat trait to your controller to enable the use of validate request as part of the controller class
*/
use ErrorFormat;
public function home(Request $request) {
// You can define an array of your validation rule
$errorRule = [
"name" => "