Answers for "how to make unique request in laravel"

PHP
1

get unique values in laravel

$users = User::select('name')->distinct()->get();
Posted by: Guest on February-19-2021
1

set unique value validation for laravel form request

use Illuminate\Validation\Rule;

public function rules()
{
    return [
	    'title' => [
		    'required',
		    Rule::unique('posts', 'title')->ignore($this->post)
	    ]
    ]; 
}
Posted by: Guest on January-03-2021

Code answers related to "how to make unique request in laravel"

Browse Popular Code Answers by Language