remove the where condition for index items query and add enable column to labels table.

This commit is contained in:
Moradi
2025-03-11 12:21:36 +03:30
parent 8046611c01
commit 0170cb1258
2 changed files with 29 additions and 1 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ class ItemController extends Controller
if ( $user->hasRole( 'User' ) ) {
$Items = $Items->whereHas( 'user' , function ( $query ) use ( $user ) {
$query->where( 'medical_center_id' , $user->medical_center_id );
} )->where( "status" , StatusTypeEnum::APPROVED );
} );
} elseif ( $user->hasRole( 'Supervisor' ) ) {
$Items = $Items->whereHas( 'user' , function ( $query ) use ( $user ) {
$query->where( 'medical_center_id' , $user->medical_center_id );
@@ -0,0 +1,28 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('labels', function (Blueprint $table) {
$table->boolean('enable')->default(true);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('labels', function (Blueprint $table) {
$table->dropColumn('enable');
});
}
};