mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 19:51:07 +03:30
Merge branch 'master' of https://gitlab.com/Saeid74/cssd
This commit is contained in:
+3
-3
@@ -6,14 +6,14 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Cycle extends Model
|
||||
{
|
||||
public $fillable = ['name', 'unique_id', 'user_id', 'result', 'description'];
|
||||
public $fillable = ['name', 'date', 'user_id', 'sterilizer_id', 'note', 'verified'];
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
public function packages()
|
||||
public function packes()
|
||||
{
|
||||
return $this->belongsToMany('App\Package', 'cycle_package');
|
||||
return $this->belongsToMany('App\Pack', 'cycle_pack');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,11 +13,8 @@ class CycleController extends Controller
|
||||
$Cycles = Cycle::when($request->has('name') && $request->name, function($query) use($request){
|
||||
$query->where('name', 'LIKE', '%'.$request->name.'%');
|
||||
})
|
||||
->when($request->has('result') && $request->result, function($query) use($request){
|
||||
$query->where('result', $request->result);
|
||||
})
|
||||
->when($request->has('unique_id') && $request->unique_id, function($query) use($request){
|
||||
$query->where('unique_id', $request->unique_id);
|
||||
->when($request->has('sterilizer_id') && $request->sterilizer_id, function($query) use($request){
|
||||
$query->where('date', $request->sterilizer_id);
|
||||
})
|
||||
->with('user')->paginate(10);
|
||||
return \MessageResponse::data($Cycles);
|
||||
@@ -28,34 +25,33 @@ class CycleController extends Controller
|
||||
}
|
||||
public function show(Cycle $Cycle)
|
||||
{
|
||||
$Cycle->load('user', 'packages');
|
||||
$Cycle->load('user', 'packes');
|
||||
return \MessageResponse::data($Cycle);
|
||||
}
|
||||
public function store(StoreCycleRequest $request)
|
||||
{
|
||||
$UniqueID = substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, 10);
|
||||
$CycleData = [
|
||||
'name' => $request->name,
|
||||
'unique_id' => $UniqueID,
|
||||
'result' => $request->result,
|
||||
'description' => $request->description,
|
||||
'date' => $request->date,
|
||||
'sterilizer_id' => $request->sterilizer_id,
|
||||
'note' => $request->note,
|
||||
'user_id' => auth('api')->user()->id,
|
||||
'verified' => 'NotVerified',
|
||||
];
|
||||
$CycleObj = Cycle::create($CycleData);
|
||||
$CycleObj->packages()->attach($request->packages);
|
||||
$CycleObj->packes()->attach($request->packes);
|
||||
return \MessageResponse::success(trans('messages.success'));
|
||||
}
|
||||
public function edit(Cycle $Cycle)
|
||||
{
|
||||
$Cycle->load('user', 'packages');
|
||||
$Cycle->load('user', 'packes');
|
||||
return \MessageResponse::data($Cycle);
|
||||
}
|
||||
|
||||
|
||||
public function update(StoreCycleRequest $request, Cycle $Cycle)
|
||||
{
|
||||
$Cycle->update($request->except(['packages']));
|
||||
$Cycle->packages()->sync($request->packages);
|
||||
$Cycle->update($request->except(['packes']));
|
||||
$Cycle->packes()->sync($request->packes);
|
||||
return \MessageResponse::success(trans('messages.success'));
|
||||
}
|
||||
public function destroy(Cycle $Cycle)
|
||||
@@ -63,9 +59,9 @@ class CycleController extends Controller
|
||||
if (auth('api')->user()->cant('delete', $Cycle)) {
|
||||
return \MessageResponse::error(trans('messages.access_denied'));
|
||||
}
|
||||
if(count($Cycle->packages))
|
||||
if(count($Cycle->packes))
|
||||
{
|
||||
$Cycle->packages()->detach();
|
||||
$Cycle->packes()->detach();
|
||||
}
|
||||
$Cycle->delete();
|
||||
return \MessageResponse::success(trans('messages.success'));
|
||||
|
||||
@@ -11,12 +11,19 @@ class ItemController extends Controller
|
||||
public function index(Request $request)
|
||||
{
|
||||
$Items = Item::with('user')
|
||||
->when($request->has('name') && $request->name, function($query) use($request){
|
||||
->when($request->has('name') && $request->name != '', function($query) use($request){
|
||||
$query->where('name', 'LIKE', '%'.$request->name.'%');
|
||||
})
|
||||
->when($request->has('result') && $request->result, function($query) use($request){
|
||||
$query->where('result', $request->result);
|
||||
})->paginate(10);
|
||||
->when($request->has('size') && $request->size != '', function($query) use($request){
|
||||
$query->where('size', $request->size);
|
||||
})
|
||||
->when($request->has('unique_id') && $request->unique_id != '', function($query) use($request){
|
||||
$query->where('unique_id', $request->unique_id);
|
||||
})
|
||||
->when($request->has('specific') && $request->specific != '', function($query) use($request){
|
||||
$query->where('specific', $request->specific);
|
||||
})
|
||||
->paginate(10);
|
||||
return \MessageResponse::data($Items);
|
||||
}
|
||||
|
||||
@@ -33,8 +40,10 @@ class ItemController extends Controller
|
||||
{
|
||||
$ItemData = [
|
||||
'name' => $request->name,
|
||||
'result' => $request->result,
|
||||
'description' => $request->description,
|
||||
'size' => $request->size,
|
||||
'unique_id' => $request->unique_id,
|
||||
'specific' => $request->specific,
|
||||
'note' => $request->note,
|
||||
'user_id' => auth('api')->user()->id,
|
||||
];
|
||||
$ItemObj = Item::create($ItemData);
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\StorePackRequest;
|
||||
use App\Pack;
|
||||
|
||||
class PackController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$Packes = Pack::when($request->has('name') && $request->name != '', function($query) use($request){
|
||||
$query->where('name', 'LIKE', '%'.$request->name.'%');
|
||||
})
|
||||
->when($request->has('sterilizer_id') && $request->sterilizer_id != '', function($query) use($request){
|
||||
$query->where('sterilizer_id', $request->sterilizer_id);
|
||||
})
|
||||
->when($request->has('unique_id') && $request->unique_id != '', function($query) use($request){
|
||||
$query->where('unique_id', $request->unique_id);
|
||||
})
|
||||
->when($request->has('cycle_number') && $request->cycle_number != '', function($query) use($request){
|
||||
$query->where('cycle_number', $request->cycle_number);
|
||||
})
|
||||
->when($request->has('lot_number') && $request->lot_number != '', function($query) use($request){
|
||||
$query->where('lot_number', $request->lot_number);
|
||||
})
|
||||
->when($request->has('department') && $request->department != '', function($query) use($request){
|
||||
$query->where('department', 'LIKE', '%'.$request->department.'%');
|
||||
})
|
||||
->with('user')->paginate(10);
|
||||
return \MessageResponse::data($Packes);
|
||||
}
|
||||
public function create()
|
||||
{
|
||||
|
||||
}
|
||||
public function show(Pack $Pack)
|
||||
{
|
||||
$Pack->load('user', 'packages');
|
||||
return \MessageResponse::data($Pack);
|
||||
}
|
||||
public function store(StorePackRequest $request)
|
||||
{
|
||||
$UniqueID = substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, 10);
|
||||
$PackData = [
|
||||
'name' => $request->name,
|
||||
'unique_id' => $UniqueID,
|
||||
'sterile_date' => $request->sterile_date,
|
||||
'expire_date' => $request->expire_date,
|
||||
'sterilizer_id' => $request->sterilizer_id,
|
||||
'cycle_number' => $request->cycle_number,
|
||||
'lot_number' => $request->lot_number,
|
||||
'department' => $request->department,
|
||||
'note' => $request->note,
|
||||
'user_id' => auth('api')->user()->id,
|
||||
];
|
||||
$PackObj = Pack::create($PackData);
|
||||
$PackObj->packages()->attach($request->packages);
|
||||
return \MessageResponse::success(trans('messages.success'));
|
||||
}
|
||||
public function edit(Pack $Pack)
|
||||
{
|
||||
$Pack->load('user', 'packages');
|
||||
return \MessageResponse::data($Pack);
|
||||
}
|
||||
|
||||
public function update(StorePackRequest $request, Pack $Pack)
|
||||
{
|
||||
$Pack->update($request->except(['packages']));
|
||||
$Pack->packages()->sync($request->packages);
|
||||
return \MessageResponse::success(trans('messages.success'));
|
||||
}
|
||||
public function destroy(Pack $Pack)
|
||||
{
|
||||
if (auth('api')->user()->cant('delete', $Pack)) {
|
||||
return \MessageResponse::error(trans('messages.access_denied'));
|
||||
}
|
||||
if(count($Pack->packages))
|
||||
{
|
||||
$Pack->packages()->detach();
|
||||
}
|
||||
if(count($Pack->cycles))
|
||||
{
|
||||
$Pack->cycles()->detach();
|
||||
}
|
||||
$Pack->delete();
|
||||
return \MessageResponse::success(trans('messages.success'));
|
||||
}
|
||||
public function getPackes()
|
||||
{
|
||||
$Packes = Pack::with('user')->get();
|
||||
return \MessageResponse::data($Packes);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,13 +10,10 @@ class PackageController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$Packages = Package::when($request->has('name') && $request->name, function($query) use($request){
|
||||
$Packages = Package::when($request->has('name') && $request->name != '', function($query) use($request){
|
||||
$query->where('name', 'LIKE', '%'.$request->name.'%');
|
||||
})
|
||||
->when($request->has('result') && $request->result, function($query) use($request){
|
||||
$query->where('result', $request->result);
|
||||
})
|
||||
->when($request->has('unique_id') && $request->unique_id, function($query) use($request){
|
||||
->when($request->has('unique_id') && $request->unique_id != '', function($query) use($request){
|
||||
$query->where('unique_id', $request->unique_id);
|
||||
})
|
||||
->with('user')->paginate(10);
|
||||
@@ -37,8 +34,7 @@ class PackageController extends Controller
|
||||
$PackageData = [
|
||||
'name' => $request->name,
|
||||
'unique_id' => $UniqueID,
|
||||
'result' => $request->result,
|
||||
'description' => $request->description,
|
||||
'note' => $request->note,
|
||||
'user_id' => auth('api')->user()->id,
|
||||
'verified' => 'NotVerified',
|
||||
];
|
||||
@@ -66,9 +62,9 @@ class PackageController extends Controller
|
||||
{
|
||||
$Package->items()->detach();
|
||||
}
|
||||
if(count($Package->cycles))
|
||||
if(count($Package->packes))
|
||||
{
|
||||
$Package->cycles()->detach();
|
||||
$Package->packes()->detach();
|
||||
}
|
||||
$Package->delete();
|
||||
return \MessageResponse::success(trans('messages.success'));
|
||||
|
||||
@@ -26,8 +26,10 @@ class StoreCycleRequest extends FormRequest
|
||||
case 'POST': {
|
||||
return [
|
||||
'name' => 'required|max:100|unique:cycles',
|
||||
'result' => 'required',
|
||||
'packages' => 'required',
|
||||
'date' => 'required',
|
||||
'sterilizer_id' => 'required',
|
||||
'note' => 'nullable',
|
||||
'packes' => 'required',
|
||||
];
|
||||
break;
|
||||
}
|
||||
@@ -36,9 +38,10 @@ class StoreCycleRequest extends FormRequest
|
||||
$Cycle = $this->route('Cycle');
|
||||
return [
|
||||
'name' => 'required|max:100|unique:cycles,id,'.$Cycle->id,
|
||||
// 'unique_id' => 'required|max:100|unique:cycles,id,'.$Cycle->id,
|
||||
'result' => 'required',
|
||||
'packages' => 'required',
|
||||
'date' => 'required',
|
||||
'sterilizer_id' => 'required',
|
||||
'note' => 'nullable',
|
||||
'packes' => 'required',
|
||||
];
|
||||
break;
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ class StoreItemRequest extends FormRequest
|
||||
case 'POST': {
|
||||
return [
|
||||
'name' => 'required|max:100|unique:items',
|
||||
'result' => 'required',
|
||||
// 'description' => 'required',
|
||||
'unique_id' => 'required|max:100|unique:items',
|
||||
'size' => 'required',
|
||||
'specific' => 'required',
|
||||
'note' => 'nullable',
|
||||
];
|
||||
break;
|
||||
}
|
||||
@@ -36,8 +38,10 @@ class StoreItemRequest extends FormRequest
|
||||
$Item = $this->route('Item');
|
||||
return [
|
||||
'name' => 'required|max:100|unique:items,id,'.$Item->id,
|
||||
'result' => 'required',
|
||||
// 'description' => 'required',
|
||||
'unique_id' => 'required|max:100|unique:items,id,'.$Item->id,
|
||||
'size' => 'required',
|
||||
'specific' => 'required',
|
||||
'note' => 'nullable',
|
||||
];
|
||||
break;
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Pack;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
|
||||
|
||||
class StorePackRequest extends FormRequest
|
||||
{
|
||||
public function authorize()
|
||||
{
|
||||
if ($this->method() == 'POST') {
|
||||
return auth('api')->check() && auth('api')->user()->can('store', Pack::class);
|
||||
} else {
|
||||
$Pack = $this->route('Pack');
|
||||
return auth('api')->check() && $Pack && auth('api')->user()->can('update', $Pack);
|
||||
}
|
||||
}
|
||||
|
||||
public function rules()
|
||||
{
|
||||
switch ($this->method()) {
|
||||
case 'POST': {
|
||||
return [
|
||||
'name' => 'required|max:100|unique:packs',
|
||||
'sterile_date' => 'required',
|
||||
'expire_date' => 'required',
|
||||
'sterilizer_id' => 'required',
|
||||
'cycle_number' => 'required',
|
||||
'lot_number' => 'required',
|
||||
'department' => 'required',
|
||||
'note' => 'nullable',
|
||||
'packages' => 'required',
|
||||
];
|
||||
break;
|
||||
}
|
||||
case 'PUT':
|
||||
case 'PATCH': {
|
||||
$Pack = $this->route('Pack');
|
||||
return [
|
||||
'name' => 'required|max:100|unique:packs,id,'.$Pack->id,
|
||||
'sterile_date' => 'required',
|
||||
'expire_date' => 'required',
|
||||
'sterilizer_id' => 'required',
|
||||
'cycle_number' => 'required',
|
||||
'lot_number' => 'required',
|
||||
'department' => 'required',
|
||||
'note' => 'nullable',
|
||||
'packages' => 'required',
|
||||
];
|
||||
break;
|
||||
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class StorePackageRequest extends FormRequest
|
||||
case 'POST': {
|
||||
return [
|
||||
'name' => 'required|max:100|unique:packages',
|
||||
'result' => 'required',
|
||||
'note' => 'nullable',
|
||||
'items' => 'required',
|
||||
];
|
||||
break;
|
||||
@@ -37,7 +37,7 @@ class StorePackageRequest extends FormRequest
|
||||
return [
|
||||
'name' => 'required|max:100|unique:packages,id,'.$Package->id,
|
||||
'unique_id' => 'required|max:100|unique:packages,id,'.$Package->id,
|
||||
'result' => 'required',
|
||||
'note' => 'nullable',
|
||||
'items' => 'required',
|
||||
];
|
||||
break;
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Item extends Model
|
||||
{
|
||||
public $fillable = ['name', 'result', 'description', 'user_id'];
|
||||
public $fillable = ['name', 'size', 'unique_id', 'specific', 'note', 'user_id'];
|
||||
public function packages()
|
||||
{
|
||||
return $this->belongsToMany('App\Package', 'item_package');
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Pack extends Model
|
||||
{
|
||||
public $fillable = ['name', 'sterile_date', 'expire_date', 'sterilizer_id', 'cycle_number', 'lot_number', 'department', 'user_id', 'note'];
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
}
|
||||
public function packages()
|
||||
{
|
||||
return $this->belongsToMany('App\Package', 'pack_package');
|
||||
}
|
||||
public function cycles()
|
||||
{
|
||||
return $this->belongsToMany('App\Cycle', 'cycle_pack');
|
||||
}
|
||||
|
||||
}
|
||||
+3
-3
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Package extends Model
|
||||
{
|
||||
public $fillable = ['name', 'unique_id', 'user_id', 'result', 'description'];
|
||||
public $fillable = ['name', 'unique_id', 'user_id', 'note', 'verified'];
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('App\User');
|
||||
@@ -15,9 +15,9 @@ class Package extends Model
|
||||
{
|
||||
return $this->belongsToMany('App\Item', 'item_package');
|
||||
}
|
||||
public function cycles()
|
||||
public function packes()
|
||||
{
|
||||
return $this->belongsToMany('App\Cycle', 'cycle_package');
|
||||
return $this->belongsToMany('App\Pack', 'pack_package');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use App\User;
|
||||
use App\Pack;
|
||||
use Doctrine\Tests\Common\Inflector\InflectorTest;
|
||||
|
||||
class PackPolicy
|
||||
{
|
||||
public function delete(User $User, Pack $Pack)
|
||||
{
|
||||
// if($User->hasRole('Admin') && $Pack->users->count() == 0)
|
||||
return true;
|
||||
}
|
||||
|
||||
public function update(User $User, Pack $Pack)
|
||||
{
|
||||
// if($User->hasRole('Admin'))
|
||||
return true;
|
||||
}
|
||||
|
||||
public function store(User $User)
|
||||
{
|
||||
// if($User->hasRole('Admin'))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class CreateUsersTable extends Migration
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->nullable();
|
||||
$table->string('country_code');
|
||||
$table->string('country_code')->default('0098');;
|
||||
$table->string('cell_number');
|
||||
$table->enum('gender', ['Male','FeMale'])->default('Male');
|
||||
$table->enum('verified', ['Verified','NotVerified'])->default('NotVerified');
|
||||
|
||||
+1
@@ -17,6 +17,7 @@ class CreateTestResultsTable extends Migration
|
||||
$table->bigIncrements('id');
|
||||
$table->string('info');
|
||||
$table->string('cycle_number');
|
||||
$table->date('date')->nullable();
|
||||
$table->string('result');
|
||||
$table->text('description');
|
||||
$table->smallInteger('verified');
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreatePackagesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('packages', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('unique_id');
|
||||
$table->text('note')->nullable();
|
||||
$table->enum('verified', ['Verified', 'NotVerified']);
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('packages');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateItemsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('items', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('size');
|
||||
$table->string('unique_id');
|
||||
$table->string('specific');
|
||||
$table->text('note')->nullable();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('items');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateItemPackageTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('item_package', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('item_id');
|
||||
$table->foreign('item_id')->references('id')->on('items');
|
||||
$table->unsignedBigInteger('package_id');
|
||||
$table->foreign('package_id')->references('id')->on('packages');
|
||||
// $table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('item_package');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCyclesTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cycles', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->date('date');
|
||||
$table->string('sterilizer_id');
|
||||
$table->text('note')->nullable();
|
||||
$table->enum('verified',['Verified', 'NotVerified']);
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cycles');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTablePackes extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('packes', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->date('sterile_date')->nullable();
|
||||
$table->date('expire_date')->nullable();
|
||||
$table->string('sterilizer_id');
|
||||
$table->string('cycle_number');
|
||||
$table->string('lot_number');
|
||||
$table->string('department');
|
||||
$table->text('note')->nullable();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('packes');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTablePackPackage extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pack_package', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('pack_id');
|
||||
$table->foreign('pack_id')->references('id')->on('packes');
|
||||
$table->unsignedBigInteger('package_id');
|
||||
$table->foreign('package_id')->references('id')->on('packages');
|
||||
// $table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pack_package');
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -4,7 +4,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateCyclePackageTable extends Migration
|
||||
class CreateTableCyclePack extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
@@ -13,12 +13,12 @@ class CreateCyclePackageTable extends Migration
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cycle_package', function (Blueprint $table) {
|
||||
Schema::create('cycle_pack', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->integer('cycle_id')->unsigned();
|
||||
$table->integer('package_id')->unsigned();
|
||||
$table->unsignedBigInteger('pack_id');
|
||||
$table->foreign('pack_id')->references('id')->on('packes');
|
||||
$table->unsignedBigInteger('cycle_id');
|
||||
$table->foreign('cycle_id')->references('id')->on('cycles');
|
||||
$table->foreign('package_id')->references('id')->on('packages');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
@@ -30,6 +30,6 @@ class CreateCyclePackageTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cycle_package');
|
||||
Schema::dropIfExists('cycle_pack');
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('email')->nullable();
|
||||
$table->string('country_code')->default('0098');;
|
||||
$table->string('cell_number');
|
||||
$table->enum('gender', ['Male','FeMale'])->default('Male');
|
||||
$table->enum('verified', ['Verified','NotVerified'])->default('NotVerified');
|
||||
$table->enum('status', ['Active','Suspended'])->default('Active');
|
||||
$table->unsignedBigInteger('medical_center_id');
|
||||
$table->foreign('medical_center_id')->references('id')->on('medical_centers');
|
||||
$table->string('password');
|
||||
$table->string('address')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
}
|
||||
}
|
||||
@@ -17,9 +17,8 @@ class CreatePackagesTable extends Migration
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('unique_id');
|
||||
$table->enum('result',array('Pass', 'Fail'));
|
||||
$table->text('description');
|
||||
$table->enum('verified',array('Verified', 'NotVerified'));
|
||||
$table->text('note')->nullable();
|
||||
$table->enum('verified', ['Verified', 'NotVerified']);
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
|
||||
@@ -16,7 +16,10 @@ class CreateItemsTable extends Migration
|
||||
Schema::create('items', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->text('description');
|
||||
$table->string('size');
|
||||
$table->string('unique_id');
|
||||
$table->string('specific');
|
||||
$table->text('note')->nullable();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
|
||||
@@ -15,11 +15,11 @@ class CreateItemPackageTable extends Migration
|
||||
{
|
||||
Schema::create('item_package', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->integer('item_id')->unsigned();
|
||||
$table->integer('package_id')->unsigned();
|
||||
$table->unsignedBigInteger('item_id');
|
||||
$table->foreign('item_id')->references('id')->on('items');
|
||||
$table->unsignedBigInteger('package_id');
|
||||
$table->foreign('package_id')->references('id')->on('packages');
|
||||
$table->timestamps();
|
||||
// $table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ class CreateCyclesTable extends Migration
|
||||
Schema::create('cycles', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('unique_id');
|
||||
$table->enum('result',['Pass', 'Fail']);
|
||||
$table->text('description');
|
||||
$table->date('date');
|
||||
$table->string('sterilizer_id');
|
||||
$table->text('note')->nullable();
|
||||
$table->enum('verified',['Verified', 'NotVerified']);
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTablePackes extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('packes', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('name');
|
||||
$table->string('unique_id');
|
||||
$table->date('sterile_date')->nullable();
|
||||
$table->date('expire_date')->nullable();
|
||||
$table->string('sterilizer_id');
|
||||
$table->string('cycle_number');
|
||||
$table->string('lot_number');
|
||||
$table->string('department');
|
||||
$table->text('note')->nullable();
|
||||
$table->unsignedBigInteger('user_id');
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('packes');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTablePackPackage extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pack_package', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('pack_id');
|
||||
$table->foreign('pack_id')->references('id')->on('packes');
|
||||
$table->unsignedBigInteger('package_id');
|
||||
$table->foreign('package_id')->references('id')->on('packages');
|
||||
// $table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('pack_package');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateTableCyclePack extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cycle_pack', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('pack_id');
|
||||
$table->foreign('pack_id')->references('id')->on('packes');
|
||||
$table->unsignedBigInteger('cycle_id');
|
||||
$table->foreign('cycle_id')->references('id')->on('cycles');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cycle_pack');
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -48,12 +48,14 @@ Route::middleware('auth:api')->group(function () {
|
||||
|
||||
Route::resource('Items', 'ItemController');
|
||||
Route::resource('Packages', 'PackageController');
|
||||
Route::resource('Items', 'ItemController');
|
||||
Route::resource('Packes', 'PackController');
|
||||
|
||||
Route::resource('Messages', 'MessageController');
|
||||
Route::delete('Messages/User/{User}', 'MessageController@destroyUserMessages');
|
||||
Route::post('/Package/Verify/{Package}', 'PackageController@verifyPackage');
|
||||
Route::get('/GetItems', 'ItemController@getItems');
|
||||
Route::get('/GetPackages', 'PackageController@getPackages');
|
||||
Route::get('/GetPackes', 'PackController@getPackes');
|
||||
|
||||
Route::resource('Cycles', 'CycleController');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user