Skip to content

Instantly share code, notes, and snippets.

@malikalichsan
Created June 25, 2019 07:51
Show Gist options
  • Save malikalichsan/b5dae0e7c2da46432ed88157cf01d7e3 to your computer and use it in GitHub Desktop.
Save malikalichsan/b5dae0e7c2da46432ed88157cf01d7e3 to your computer and use it in GitHub Desktop.
Sample Validation Code
<?php
namespace App\Http\Controllers\System;
use App\Http\Controllers\Controller;
use App\User;
Class SampleClass extends Controller {
public function store()
{
$this->validate(request(), [
'name' => 'required|string|max:191',
'email' => 'nullable|string|email|max:191|unique:users,email',
'phone' => 'required|regex:/(01)[0-9]{9}/'
]);
// ...
// ...
// ...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment