I have a table with columns id
, nome
, descricao
and tipo
. In my Request I have:
'nome' => 'required|unique:edificacoes'
So far so good, I can not register anything with the same name, but how would I not be able to register with the same name only only of the same type?
Ex: I have the record 01 | NomeTeste | Tipo1
, if I try to register 02 | NomeTeste | Tipo2
I can not. How can I make it check the name and type to lock only if the 2 are the same?
Creating the table:
Schema::create('edificacoes', function (Blueprint $table) {
$table->engine = 'InnoDB';
$table->increments('id');
$table->longText('nome');
$table->longText('descricao')->nullable();
$table->char('tipo', 4);
$table->timestamps();
});