Created
June 25, 2019 07:51
-
-
Save malikalichsan/b5dae0e7c2da46432ed88157cf01d7e3 to your computer and use it in GitHub Desktop.
Sample Validation Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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