Skip to content

Commit

Permalink
Issues krayin#272, krayin#270 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jitendra-webkul committed Sep 22, 2021
1 parent 85af824 commit 1cba227
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public function run()
'validation' => NULL,
'sort_order' => '1',
'is_required' => '1',
'is_unique' => '0',
'is_unique' => '1',
'quick_add' => '1',
'is_user_defined' => '0',
'created_at' => $now,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function create()
public function store()
{
$this->validate(request(), [
'name' => 'required',
'name' => 'required|unique:groups,name',
]);

Event::dispatch('settings.group.create.before');
Expand Down Expand Up @@ -95,7 +95,7 @@ public function edit($id)
public function update($id)
{
$this->validate(request(), [
'name' => 'required',
'name' => 'required|unique:groups,name,' . $id,
]);

Event::dispatch('settings.group.update.before', $id);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddUniqueIndexToNameInOrganizationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('organizations', function (Blueprint $table) {
$table->unique('name');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('organizations', function (Blueprint $table) {
$table->dropUnique('organizations_name_unique');
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddUniqueIndexToNameInGroupsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('groups', function (Blueprint $table) {
$table->unique('name');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('groups', function (Blueprint $table) {
$table->dropUnique('groups_name_unique');
});
}
}

0 comments on commit 1cba227

Please sign in to comment.