mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-10 19:31:07 +03:30
change Item
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use App\Http\Requests\StoreItemRequest;
|
||||||
|
use App\Item;
|
||||||
|
|
||||||
|
class ItemController extends Controller
|
||||||
|
{
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
$Items = Item::with('user')->paginate(10);
|
||||||
|
return \MessageResponse::data($Items);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public function show(Item $Item)
|
||||||
|
{
|
||||||
|
return \MessageResponse::data($Item);
|
||||||
|
}
|
||||||
|
public function store(StoreItemRequest $request)
|
||||||
|
{
|
||||||
|
|
||||||
|
// $UniqueID = substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, 10);
|
||||||
|
$ItemData = [
|
||||||
|
'name' => $request->name,
|
||||||
|
'result' => $request->result,
|
||||||
|
'description' => $request->description,
|
||||||
|
'user_id' => auth('api')->user()->id,
|
||||||
|
];
|
||||||
|
$ItemObj = Item::create($ItemData);
|
||||||
|
|
||||||
|
return \MessageResponse::success(trans('messages.success'));
|
||||||
|
}
|
||||||
|
public function edit(Item $Item)
|
||||||
|
{
|
||||||
|
return \MessageResponse::data($Item);
|
||||||
|
}
|
||||||
|
public function update(StoreItemRequest $request, Item $Item)
|
||||||
|
{
|
||||||
|
// dd($request->all());
|
||||||
|
$Item->update($request->all());
|
||||||
|
return \MessageResponse::success(trans('messages.success'));
|
||||||
|
}
|
||||||
|
public function destroy(Item $Item)
|
||||||
|
{
|
||||||
|
if (!auth('api')->user()->can('delete', $Item)) {
|
||||||
|
return \MessageResponse::error(trans('messages.access_denied'));
|
||||||
|
}
|
||||||
|
$Item->delete();
|
||||||
|
return \MessageResponse::success(trans('messages.success'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getItems(){
|
||||||
|
$Items = Item::with('user')->get();
|
||||||
|
return \MessageResponse::data($Items);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ class PackageController extends Controller
|
|||||||
}
|
}
|
||||||
public function show(Package $Package)
|
public function show(Package $Package)
|
||||||
{
|
{
|
||||||
|
$Package->load('user', 'items');
|
||||||
return \MessageResponse::data($Package);
|
return \MessageResponse::data($Package);
|
||||||
}
|
}
|
||||||
public function store(StorePackageRequest $request)
|
public function store(StorePackageRequest $request)
|
||||||
@@ -41,16 +42,19 @@ class PackageController extends Controller
|
|||||||
'user_id' => auth('api')->user()->id,
|
'user_id' => auth('api')->user()->id,
|
||||||
'verified' => 'NotVerified',
|
'verified' => 'NotVerified',
|
||||||
];
|
];
|
||||||
Package::create($PackageData);
|
$PackageObj = Package::create($PackageData);
|
||||||
|
$PackageObj->items()->attach($request->items);
|
||||||
return \MessageResponse::success(trans('messages.success'));
|
return \MessageResponse::success(trans('messages.success'));
|
||||||
}
|
}
|
||||||
public function edit(Package $Package)
|
public function edit(Package $Package)
|
||||||
{
|
{
|
||||||
|
$Package->load('user', 'items');
|
||||||
return \MessageResponse::data($Package);
|
return \MessageResponse::data($Package);
|
||||||
}
|
}
|
||||||
public function update(StorePackageRequest $request, Package $Package)
|
public function update(StorePackageRequest $request, Package $Package)
|
||||||
{
|
{
|
||||||
$Package->update($request->all());
|
$Package->update($request->except(['items']));
|
||||||
|
$Package->items()->sync($request->items);
|
||||||
return \MessageResponse::success(trans('messages.success'));
|
return \MessageResponse::success(trans('messages.success'));
|
||||||
}
|
}
|
||||||
public function destroy(Package $Package)
|
public function destroy(Package $Package)
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class TestResultController extends Controller
|
|||||||
|
|
||||||
public function store(StoreTestResultRequest $request)
|
public function store(StoreTestResultRequest $request)
|
||||||
{
|
{
|
||||||
|
// dd($request->result);
|
||||||
try {
|
try {
|
||||||
$return_value = \DB::transaction(function () use ($request) {
|
$return_value = \DB::transaction(function () use ($request) {
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ class TestResultController extends Controller
|
|||||||
// 'autoclave_id' => $request->autoclave_id,
|
// 'autoclave_id' => $request->autoclave_id,
|
||||||
'cycle_number' => $request->cycle_number,
|
'cycle_number' => $request->cycle_number,
|
||||||
'device_id' => $request->device_id,
|
'device_id' => $request->device_id,
|
||||||
'device_label' => $request->device_label,
|
// 'device_label' => $request->device_label,
|
||||||
'test_type_id' => $request->test_type_id,
|
'test_type_id' => $request->test_type_id,
|
||||||
'result' => $request->result,
|
'result' => $request->result,
|
||||||
'verified' => 'NotVerified',
|
'verified' => 'NotVerified',
|
||||||
@@ -102,15 +102,15 @@ class TestResultController extends Controller
|
|||||||
foreach ($Inputs as $Input) {
|
foreach ($Inputs as $Input) {
|
||||||
if ($Input['type'] != 'Form') {
|
if ($Input['type'] != 'Form') {
|
||||||
$Value = $TestResultInfo[$Input->name.'_'.$Input->id];
|
$Value = $TestResultInfo[$Input->name.'_'.$Input->id];
|
||||||
if ($Input['type'] == 'Checkbox' || $Input['type'] == 'Select' || $Input['type'] == 'Radiobutton' || $Input['type'] == 'Range') {
|
if ($Input['type'] == 'Checkbox' || $Input['type'] == 'Select' || $Input['type'] == 'Radiobutton') {
|
||||||
|
|
||||||
// foreach ($Value as $Option) {
|
|
||||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'option_id' => $Option]);
|
|
||||||
// }
|
|
||||||
foreach ($Input->options as $Option) {//--2
|
foreach ($Input->options as $Option) {//--2
|
||||||
if(in_array($Option->id,$Value)){
|
if(is_array($Value) && in_array($Option->id,$Value)){
|
||||||
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'option_id' => $Option->id]);
|
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'option_id' => $Option->id]);
|
||||||
}
|
}
|
||||||
|
if ($Input['type'] == 'Radiobutton' && $Option->id == $Value) {
|
||||||
|
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $Input->id, 'option_id' => $Option->id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -120,14 +120,15 @@ class TestResultController extends Controller
|
|||||||
foreach ($Input->children as $InputChild) {
|
foreach ($Input->children as $InputChild) {
|
||||||
$Value = $TestResultInfo[$InputChild->name.'_'.$InputChild->id];
|
$Value = $TestResultInfo[$InputChild->name.'_'.$InputChild->id];
|
||||||
|
|
||||||
if ($InputChild['type'] == 'Checkbox' || $InputChild['type'] == 'Select' || $Input['type'] == 'Radiobutton' || $Input['type'] == 'Range') {
|
if ($InputChild['type'] == 'Checkbox' || $InputChild['type'] == 'Select' || $InputChild['type'] == 'Radiobutton') {
|
||||||
// foreach ($Value as $Option) {
|
|
||||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $InputChild->id, 'option_id' => $Option]);
|
|
||||||
// }
|
|
||||||
foreach ($InputChild->options as $Option) {//--2
|
foreach ($InputChild->options as $Option) {//--2
|
||||||
if(in_array($Option->id,$Value)){
|
if(is_array($Value) && in_array($Option->id,$Value)){
|
||||||
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $InputChild->id, 'option_id' => $Option->id]);
|
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $InputChild->id, 'option_id' => $Option->id]);
|
||||||
}
|
}
|
||||||
|
if ($Input['type'] == 'Radiobutton' && $Option->id == $Value) {
|
||||||
|
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id, 'input_id' => $InputChild->id, 'option_id' => $Option->id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -139,32 +140,16 @@ class TestResultController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////Inputs
|
///////////////////////////////////////////////////////////////////////////Inputs
|
||||||
///////////////////////////////////////////////////////////////////////////Image
|
///////////////////////////////////////////////////////////////////////////Images
|
||||||
|
|
||||||
// if ($request->img != null) {
|
|
||||||
//
|
|
||||||
// $Image = $request->img;
|
|
||||||
// $InterventionImage = Image::make($Image);
|
|
||||||
// $Mime = explode('/', $InterventionImage->mime());
|
|
||||||
//
|
|
||||||
// $ImageName = time().'.'.$Mime[1];
|
|
||||||
// $Path = 'uploads'.'/TestResults'.'/'.$TestResultObj->id .'/'.$ImageName;
|
|
||||||
//
|
|
||||||
// Storage::disk('public')->makeDirectory('TestResults'.'/'.$TestResultObj->id);
|
|
||||||
// $InterventionImage->save(public_path($Path));
|
|
||||||
//
|
|
||||||
// $GalleryObj = Gallery::create(['user_id' => auth('api')->user()->id, 'path' => $Path]);
|
|
||||||
// $Uploadable = Uploadable::create(['uploadable_id' => $TestResultObj->id, 'uploadable_type' => 'App\TestResult', 'gallery_id' => $GalleryObj->id, 'image_role' => 'TitleImage']);
|
|
||||||
// }
|
|
||||||
//-------------------------------------------------imgs
|
|
||||||
if ($request->imgs != null) {
|
if ($request->imgs != null) {
|
||||||
|
|
||||||
foreach ($request->imgs as $img) {
|
foreach ($request->imgs as $key => $img) {
|
||||||
|
// $UniqueID = substr(base_convert(sha1(uniqid(mt_rand())), 16, 36), 0, 10);
|
||||||
$Image = $img;
|
$Image = $img;
|
||||||
$InterventionImage = Image::make($Image);
|
$InterventionImage = Image::make($Image);
|
||||||
$Mime = explode('/', $InterventionImage->mime());
|
$Mime = explode('/', $InterventionImage->mime());
|
||||||
|
|
||||||
$ImageName = time().'.'.$Mime[1];
|
$ImageName = time().$key.'.'.$Mime[1];
|
||||||
$Path = 'uploads'.'/TestResults'.'/'.$TestResultObj->id .'/'.$ImageName;
|
$Path = 'uploads'.'/TestResults'.'/'.$TestResultObj->id .'/'.$ImageName;
|
||||||
|
|
||||||
Storage::disk('public')->makeDirectory('TestResults'.'/'.$TestResultObj->id);
|
Storage::disk('public')->makeDirectory('TestResults'.'/'.$TestResultObj->id);
|
||||||
@@ -174,7 +159,7 @@ class TestResultController extends Controller
|
|||||||
$Uploadable = Uploadable::create(['uploadable_id' => $TestResultObj->id, 'uploadable_type' => 'App\TestResult', 'gallery_id' => $GalleryObj->id, 'image_role' => 'TitleImage']);
|
$Uploadable = Uploadable::create(['uploadable_id' => $TestResultObj->id, 'uploadable_type' => 'App\TestResult', 'gallery_id' => $GalleryObj->id, 'image_role' => 'TitleImage']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////Image
|
///////////////////////////////////////////////////////////////////////////Images
|
||||||
|
|
||||||
});
|
});
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -193,7 +178,7 @@ class TestResultController extends Controller
|
|||||||
|
|
||||||
if ($input->parent_id != null && $input->parent['type'] == 'Form') {
|
if ($input->parent_id != null && $input->parent['type'] == 'Form') {
|
||||||
//----------------------------------------------------------------------FormType
|
//----------------------------------------------------------------------FormType
|
||||||
if ($input->type == 'Checkbox' || $input->type == 'Select' || $Input['type'] == 'Radiobutton' || $Input['type'] == 'Range') {
|
if ($input->type == 'Checkbox' || $input->type == 'Select' || $input['type'] == 'Radiobutton') {
|
||||||
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
|
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
|
||||||
$options = [];
|
$options = [];
|
||||||
foreach ($input_options as $input_option) {
|
foreach ($input_options as $input_option) {
|
||||||
@@ -213,7 +198,7 @@ class TestResultController extends Controller
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//-----------------------------------------------------------------------Anothertype
|
//-----------------------------------------------------------------------Anothertype
|
||||||
if ($input->type == 'Checkbox' || $input->type == 'Select' || $Input['type'] == 'Radiobutton' || $Input['type'] == 'Range') {
|
if ($input->type == 'Checkbox' || $input->type == 'Select' || $input['type'] == 'Radiobutton') {
|
||||||
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
|
$input_options = InputValue::with('option')->where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get();
|
||||||
$options = [];
|
$options = [];
|
||||||
foreach ($input_options as $input_option) {
|
foreach ($input_options as $input_option) {
|
||||||
@@ -231,8 +216,12 @@ class TestResultController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ImagesPath = [];
|
||||||
if (count($TestResult->TitleImage)) {
|
if (count($TestResult->TitleImage)) {
|
||||||
$TestResult['imagePath'] = $TestResult->TitleImage[0]->path;
|
foreach ($TestResult->TitleImage as $Key => $TitleImage) {
|
||||||
|
$ImagesPath[] = $TitleImage->path;
|
||||||
|
}
|
||||||
|
$TestResult['imagesPath'] = $ImagesPath;
|
||||||
}
|
}
|
||||||
return \MessageResponse::data($TestResult);
|
return \MessageResponse::data($TestResult);
|
||||||
}
|
}
|
||||||
@@ -241,16 +230,25 @@ class TestResultController extends Controller
|
|||||||
{
|
{
|
||||||
foreach ($TestResult->input_values as $key => $value) {
|
foreach ($TestResult->input_values as $key => $value) {
|
||||||
$input = $value->input;
|
$input = $value->input;
|
||||||
if ($input->type == 'Checkbox' || $input->type == 'Select' || $Input['type'] == 'Radiobutton' || $Input['type'] == 'Range') {
|
if ($input->type == 'Checkbox' || $input->type == 'Select' || $input['type'] == 'Radiobutton') {
|
||||||
$input_options = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get()->pluck('option_id')->toArray();
|
$input_options = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $input->id)->get()->pluck('option_id')->toArray();
|
||||||
$TestResult[$input->name.'_'.$input->id] = $input_options;
|
if ($input['type'] == 'Radiobutton') {
|
||||||
|
$TestResult[$input->name.'_'.$input->id] = $input_options[0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$TestResult[$input->name.'_'.$input->id] = $input_options;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$TestResult[$input->name.'_'.$input->id] = $value->value;
|
$TestResult[$input->name.'_'.$input->id] = $value->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$ImagesPath = [];
|
||||||
if (count($TestResult->TitleImage)) {
|
if (count($TestResult->TitleImage)) {
|
||||||
$TestResult['imagePath'] = $TestResult->TitleImage[0]->path;
|
foreach ($TestResult->TitleImage as $Key => $TitleImage) {
|
||||||
|
$ImagesPath[] = $TitleImage->path;
|
||||||
|
}
|
||||||
|
$TestResult['imagesPath'] = $ImagesPath;
|
||||||
}
|
}
|
||||||
return \MessageResponse::data($TestResult);
|
return \MessageResponse::data($TestResult);
|
||||||
}
|
}
|
||||||
@@ -269,7 +267,7 @@ class TestResultController extends Controller
|
|||||||
// 'autoclave_id' => $request->autoclave_id,
|
// 'autoclave_id' => $request->autoclave_id,
|
||||||
'cycle_number' => $request->cycle_number,
|
'cycle_number' => $request->cycle_number,
|
||||||
'device_id' => $request->device_id,
|
'device_id' => $request->device_id,
|
||||||
'device_label' => $request->device_label,
|
// 'device_label' => $request->device_label,
|
||||||
'test_type_id' => $request->test_type_id,
|
'test_type_id' => $request->test_type_id,
|
||||||
'result' => $request->result,
|
'result' => $request->result,
|
||||||
'verified' => 'NotVerified',
|
'verified' => 'NotVerified',
|
||||||
@@ -282,19 +280,17 @@ class TestResultController extends Controller
|
|||||||
foreach ($Inputs as $Input) {
|
foreach ($Inputs as $Input) {
|
||||||
if ($Input['type'] != 'Form') {
|
if ($Input['type'] != 'Form') {
|
||||||
$Value = $TestResultInfo[$Input->name.'_'.$Input->id];
|
$Value = $TestResultInfo[$Input->name.'_'.$Input->id];
|
||||||
|
if ($Input['type'] == 'Checkbox' || $Input['type'] == 'Select' || $Input['type'] == 'Radiobutton') {
|
||||||
if ($Input['type'] == 'Checkbox' || $Input['type'] == 'Select' || $Input['type'] == 'Radiobutton' || $Input['type'] == 'Range') {
|
|
||||||
|
|
||||||
$InputOptions = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $Input->id)->get()->each->delete();
|
$InputOptions = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $Input->id)->get()->each->delete();
|
||||||
|
|
||||||
// $option_array = $Input->options->pluck('id')->toArray();
|
|
||||||
// foreach ($Value as $Option) {//--1
|
|
||||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $Input->id, 'option_id' => $Option]);
|
|
||||||
// }
|
|
||||||
foreach ($Input->options as $Option) {//--2
|
foreach ($Input->options as $Option) {//--2
|
||||||
if(in_array($Option->id,$Value)){
|
if(is_array($Value) && in_array($Option->id,$Value)){
|
||||||
$InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $Input->id, 'option_id' => $Option->id]);
|
$InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $Input->id, 'option_id' => $Option->id]);
|
||||||
}
|
}
|
||||||
|
if ($Input['type'] == 'Radiobutton' && $Option->id == $Value) {
|
||||||
|
$InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $Input->id, 'option_id' => $Option->id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -306,16 +302,16 @@ class TestResultController extends Controller
|
|||||||
|
|
||||||
$Value = $TestResultInfo[$InputChild->name.'_'.$InputChild->id];
|
$Value = $TestResultInfo[$InputChild->name.'_'.$InputChild->id];
|
||||||
|
|
||||||
if ($InputChild['type'] == 'Checkbox' || $InputChild['type'] == 'Select' || $Input['type'] == 'Radiobutton' || $Input['type'] == 'Range') {
|
if ($InputChild['type'] == 'Checkbox' || $InputChild['type'] == 'Select' || $InputChild['type'] == 'Radiobutton') {
|
||||||
$InputOptions = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $InputChild->id)->get()->each->delete();
|
$InputOptions = InputValue::where('test_result_id', $TestResult->id)->where('input_id', $InputChild->id)->get()->each->delete();
|
||||||
|
|
||||||
// foreach ($Value as $Option) {
|
|
||||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $InputChild->id, 'option_id' => $Option]);
|
|
||||||
// }
|
|
||||||
foreach ($InputChild->options as $Option) {//--2
|
foreach ($InputChild->options as $Option) {//--2
|
||||||
if(in_array($Option->id,$Value)){
|
if(is_array($Value) && in_array($Option->id,$Value)){
|
||||||
$InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $InputChild->id, 'option_id' => $Option->id]);
|
$InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $InputChild->id, 'option_id' => $Option->id]);
|
||||||
}
|
}
|
||||||
|
if ($Input['type'] == 'Radiobutton' && $Option->id == $Value) {
|
||||||
|
$InputValueObj = InputValue::create(['test_result_id' => $TestResult->id, 'input_id' => $InputChild->id, 'option_id' => $Option->id]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -324,42 +320,38 @@ class TestResultController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////////////////////////Image
|
/////////////////////////////////////////////////////////////////////Images
|
||||||
$image = '';
|
$images = '';
|
||||||
if (count($TestResult->TitleImage))
|
if (count($TestResult->TitleImage))
|
||||||
$image = $TestResult->TitleImage[0];
|
{
|
||||||
|
$images = $TestResult->TitleImage;
|
||||||
if ($request->img != null) {
|
foreach ($images as $key => $image) {
|
||||||
|
|
||||||
$Image = $request->img;
|
|
||||||
$InterventionImage = Image::make($Image);
|
|
||||||
$Mime = explode('/', $InterventionImage->mime());
|
|
||||||
|
|
||||||
$ImageName = time().'.'.$Mime[1];
|
|
||||||
$Path = 'uploads'.'/TestResults'.'/'.$TestResult->id .'/'.$ImageName;
|
|
||||||
|
|
||||||
Storage::disk('public')->makeDirectory('TestResults'.'/'.$TestResult->id);
|
|
||||||
$InterventionImage->save(public_path($Path));
|
|
||||||
|
|
||||||
|
|
||||||
if ($image !== ''){
|
|
||||||
Storage::disk('public')->delete(static::storage_path($image->path));
|
Storage::disk('public')->delete(static::storage_path($image->path));
|
||||||
Uploadable::where('gallery_id', $image->id)->where('uploadable_id', $TestResult->id)->where('uploadable_type', get_class($TestResult))->delete();
|
Uploadable::where('gallery_id', $image->id)->where('uploadable_id', $TestResult->id)->where('uploadable_type', get_class($TestResult))->delete();
|
||||||
|
Gallery::where('id', $image->id)->delete();
|
||||||
//--------------------------------------------------------
|
|
||||||
$GalleryObj = Gallery::where('id', $image->id)->update(['path' => $Path]);
|
|
||||||
$Uploadable = Uploadable::create(['uploadable_id' => $TestResult->id, 'uploadable_type' => get_class($TestResult), 'gallery_id' => $image->id, 'image_role' => 'TitleImage']);
|
|
||||||
//--------------------------------------------------------
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//--------------------------------------------------------
|
|
||||||
$GalleryObj = Gallery::create(['user_id' => auth('api')->user()->id, 'path' => $Path]);
|
|
||||||
$Uploadable = Uploadable::create(['uploadable_id' => $TestResult->id, 'uploadable_type' => 'App\TestResult', 'gallery_id' => $GalleryObj->id, 'image_role' => 'TitleImage']);
|
|
||||||
//--------------------------------------------------------
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////////////////////Image
|
|
||||||
|
if ($request->imgs != null) {
|
||||||
|
foreach ($request->imgs as $key => $img) {//
|
||||||
|
|
||||||
|
$Image = $img;
|
||||||
|
$InterventionImage = Image::make($Image);
|
||||||
|
$Mime = explode('/', $InterventionImage->mime());
|
||||||
|
|
||||||
|
$ImageName = time().$key.'.'.$Mime[1];
|
||||||
|
$Path = 'uploads'.'/TestResults'.'/'.$TestResult->id .'/'.$ImageName;
|
||||||
|
|
||||||
|
Storage::disk('public')->makeDirectory('TestResults'.'/'.$TestResult->id);
|
||||||
|
$InterventionImage->save(public_path($Path));
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
$GalleryObj = Gallery::create(['user_id' => auth('api')->user()->id, 'path' => $Path]);
|
||||||
|
$Uploadable = Uploadable::create(['uploadable_id' => $TestResult->id, 'uploadable_type' => 'App\TestResult', 'gallery_id' => $GalleryObj->id, 'image_role' => 'TitleImage']);
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
}//
|
||||||
|
}
|
||||||
|
|
||||||
return \MessageResponse::success(null,trans('messages.update'));
|
return \MessageResponse::success(null,trans('messages.update'));
|
||||||
}
|
}
|
||||||
@@ -369,6 +361,16 @@ class TestResultController extends Controller
|
|||||||
if (!auth('api')->user()->can('delete', $TestResult)) {
|
if (!auth('api')->user()->can('delete', $TestResult)) {
|
||||||
return \MessageResponse::error(trans('messages.access_denied'));
|
return \MessageResponse::error(trans('messages.access_denied'));
|
||||||
}
|
}
|
||||||
|
if (count($TestResult->input_values)) {
|
||||||
|
InputValue::where('test_result_id', $TestResult->id)->get()->each->delete();
|
||||||
|
}
|
||||||
|
if (count($TestResult->TitleImage)){
|
||||||
|
foreach ($TestResult->TitleImage as $image) {
|
||||||
|
Storage::disk('public')->delete(static::storage_path($image->path));
|
||||||
|
Uploadable::where('gallery_id', $image->id)->where('uploadable_id', $TestResult->id)->where('uploadable_type', get_class($TestResult))->delete();
|
||||||
|
Gallery::where('id', $image->id)->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
$TestResult->delete();
|
$TestResult->delete();
|
||||||
return \MessageResponse::success(null, trans('messages.success'));
|
return \MessageResponse::success(null, trans('messages.success'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ class TestTypeController extends Controller
|
|||||||
$TestType = [
|
$TestType = [
|
||||||
'name' => $request['name'],
|
'name' => $request['name'],
|
||||||
'unique_code' => $request['unique_code'],
|
'unique_code' => $request['unique_code'],
|
||||||
|
'device_label' => $request['device_label'],
|
||||||
'user_id' => auth('api')->user()->id
|
'user_id' => auth('api')->user()->id
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -320,6 +321,7 @@ class TestTypeController extends Controller
|
|||||||
$TestTypeData = [
|
$TestTypeData = [
|
||||||
'name' => $request['name'],
|
'name' => $request['name'],
|
||||||
'unique_code' => $request['unique_code'],
|
'unique_code' => $request['unique_code'],
|
||||||
|
'device_label' => $request['device_label'],
|
||||||
];
|
];
|
||||||
$TestType->update($TestTypeData);
|
$TestType->update($TestTypeData);
|
||||||
$TestTypeInfo = $request['info'];
|
$TestTypeInfo = $request['info'];
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Requests;
|
||||||
|
|
||||||
|
use App\Item;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Illuminate\Foundation\Http\FormRequest;
|
||||||
|
use Illuminate\Contracts\Validation\Validator;
|
||||||
|
|
||||||
|
|
||||||
|
class StoreItemRequest extends FormRequest
|
||||||
|
{
|
||||||
|
public function authorize()
|
||||||
|
{
|
||||||
|
if ($this->method() == 'POST') {
|
||||||
|
return auth('api')->check() && auth('api')->user()->can('store', Item::class);
|
||||||
|
} else {
|
||||||
|
$Item = $this->route('Item');
|
||||||
|
return auth('api')->check() && $Item && auth('api')->user()->can('update', $Item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function rules()
|
||||||
|
{
|
||||||
|
switch ($this->method()) {
|
||||||
|
case 'POST': {
|
||||||
|
return [
|
||||||
|
'name' => 'required|max:100|unique:Items',
|
||||||
|
'result' => 'required',
|
||||||
|
// 'description' => 'required',
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 'PUT':
|
||||||
|
case 'PATCH': {
|
||||||
|
$Item = $this->route('Item');
|
||||||
|
return [
|
||||||
|
'name' => 'required|max:100|unique:Items,id,'.$Item->id,
|
||||||
|
'result' => 'required',
|
||||||
|
// 'description' => 'required',
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -25,10 +25,7 @@ class StoreTestResultRequest extends FormRequest
|
|||||||
switch ($this->method()) {
|
switch ($this->method()) {
|
||||||
case 'POST': {
|
case 'POST': {
|
||||||
return [
|
return [
|
||||||
// 'user_id' => 'required',
|
// 'device_id' => 'requisred',
|
||||||
// 'autoclave_id' => 'required',
|
|
||||||
'device_id' => 'required',
|
|
||||||
'device_label' => 'required',
|
|
||||||
'cycle_number' => 'required',
|
'cycle_number' => 'required',
|
||||||
'test_type_id' => 'required|numeric|exists:test_types,id',
|
'test_type_id' => 'required|numeric|exists:test_types,id',
|
||||||
'result' => 'required',
|
'result' => 'required',
|
||||||
@@ -39,10 +36,7 @@ class StoreTestResultRequest extends FormRequest
|
|||||||
case 'PATCH': {
|
case 'PATCH': {
|
||||||
// $TestResult = $this->route('TestResult');
|
// $TestResult = $this->route('TestResult');
|
||||||
return [
|
return [
|
||||||
// 'user_id' => 'required',
|
// 'device_id' => 'required',
|
||||||
// 'autoclave_id' => 'required',
|
|
||||||
'device_id' => 'required',
|
|
||||||
'device_label' => 'required',
|
|
||||||
'cycle_number' => 'required',
|
'cycle_number' => 'required',
|
||||||
'test_type_id' => 'required|numeric|exists:test_types,id',
|
'test_type_id' => 'required|numeric|exists:test_types,id',
|
||||||
'result' => 'required',
|
'result' => 'required',
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class StoreTestTypeRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'name' => 'required|max:100|unique:test_types',
|
'name' => 'required|max:100|unique:test_types',
|
||||||
'unique_code' => 'required|max:100|unique:test_types',
|
'unique_code' => 'required|max:100|unique:test_types',
|
||||||
|
'device_label' => 'required',
|
||||||
'info.*.name'=>'required',
|
'info.*.name'=>'required',
|
||||||
'info.*.type'=>'required',
|
'info.*.type'=>'required',
|
||||||
'info.*.size'=>'nullable',
|
'info.*.size'=>'nullable',
|
||||||
@@ -40,6 +41,7 @@ class StoreTestTypeRequest extends FormRequest
|
|||||||
return [
|
return [
|
||||||
'name' => 'required|max:100|unique:test_types,id,'.$TestType->id,
|
'name' => 'required|max:100|unique:test_types,id,'.$TestType->id,
|
||||||
'unique_code' => 'required|max:100|unique:test_types,id,'.$TestType->id,
|
'unique_code' => 'required|max:100|unique:test_types,id,'.$TestType->id,
|
||||||
|
'device_label' => 'required',
|
||||||
'info.*.name'=>'required',
|
'info.*.name'=>'required',
|
||||||
'info.*.type'=>'required',
|
'info.*.type'=>'required',
|
||||||
'info.*.size'=>'nullable',
|
'info.*.size'=>'nullable',
|
||||||
|
|||||||
+1
-16
@@ -6,24 +6,9 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class Item extends Model
|
class Item extends Model
|
||||||
{
|
{
|
||||||
public $fillable = [];
|
public $fillable = ['name', 'result', 'description', 'user_id'];
|
||||||
public function packages()
|
public function packages()
|
||||||
{
|
{
|
||||||
return $this->belongsToMany('App\Package', 'item_package');
|
return $this->belongsToMany('App\Package', 'item_package');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Schema::create('role_user', function (Blueprint $table) {
|
|
||||||
//
|
|
||||||
// $table->integer('user_id')->unsigned();
|
|
||||||
//
|
|
||||||
// $table->integer('role_id')->unsigned();
|
|
||||||
//
|
|
||||||
// $table->foreign('user_id')->references('id')->on('users')
|
|
||||||
//
|
|
||||||
// ->onDelete('cascade');
|
|
||||||
//
|
|
||||||
// $table->foreign('role_id')->references('id')->on('roles')
|
|
||||||
//
|
|
||||||
// ->onDelete('cascade');
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use App\User;
|
||||||
|
use App\Item;
|
||||||
|
use Doctrine\Tests\Common\Inflector\InflectorTest;
|
||||||
|
|
||||||
|
class ItemPolicy
|
||||||
|
{
|
||||||
|
public function delete(User $User, Item $Item)
|
||||||
|
{
|
||||||
|
// if($User->hasRole('Admin') && $Item->users->count() == 0)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(User $User, Item $Item)
|
||||||
|
{
|
||||||
|
// if($User->hasRole('Admin'))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(User $User)
|
||||||
|
{
|
||||||
|
// if($User->hasRole('Admin'))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+1
-1
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class TestResult extends Model
|
class TestResult extends Model
|
||||||
{
|
{
|
||||||
public $fillable = ['result','verified','autoclave_id','test_type_id','user_id','device_id', 'device_label', 'cycle_number'];
|
public $fillable = ['result','verified','autoclave_id','test_type_id','user_id','device_id', 'cycle_number'];
|
||||||
public function test_type()
|
public function test_type()
|
||||||
{
|
{
|
||||||
return $this->belongsTo('App\TestType');
|
return $this->belongsTo('App\TestType');
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ class TestType extends Model
|
|||||||
{
|
{
|
||||||
use SoftDeletes;
|
use SoftDeletes;
|
||||||
|
|
||||||
public $fillable = ['name','unique_code','user_id','bar_code'];
|
public $fillable = ['name', 'unique_code', 'user_id', 'bar_code', 'device_label'];
|
||||||
// protected $softDelete = true;
|
// protected $softDelete = true;
|
||||||
|
|
||||||
public function user()
|
public function user()
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
"require": {
|
"require": {
|
||||||
"php": "^7.1.3",
|
"php": "^7.1.3",
|
||||||
"fideloper/proxy": "^4.0",
|
"fideloper/proxy": "^4.0",
|
||||||
|
"intervention/image": "^2.5",
|
||||||
"laravel/framework": "5.8.*",
|
"laravel/framework": "5.8.*",
|
||||||
"laravel/passport": "^7.2",
|
"laravel/passport": "^7.2",
|
||||||
"laravel/tinker": "^1.0",
|
"laravel/tinker": "^1.0",
|
||||||
|
|||||||
Generated
+71
-1
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "282319c473e3a4fae1950c36e3c9832a",
|
"content-hash": "c8fc2e38aa1756fdf6c2038c630a5b1b",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "defuse/php-encryption",
|
"name": "defuse/php-encryption",
|
||||||
@@ -663,6 +663,76 @@
|
|||||||
],
|
],
|
||||||
"time": "2018-12-04T20:46:45+00:00"
|
"time": "2018-12-04T20:46:45+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "intervention/image",
|
||||||
|
"version": "2.5.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/Intervention/image.git",
|
||||||
|
"reference": "39eaef720d082ecc54c64bf54541c55f10db546d"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/Intervention/image/zipball/39eaef720d082ecc54c64bf54541c55f10db546d",
|
||||||
|
"reference": "39eaef720d082ecc54c64bf54541c55f10db546d",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-fileinfo": "*",
|
||||||
|
"guzzlehttp/psr7": "~1.1",
|
||||||
|
"php": ">=5.4.0"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"mockery/mockery": "~0.9.2",
|
||||||
|
"phpunit/phpunit": "^4.8 || ^5.7"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"ext-gd": "to use GD library based image processing.",
|
||||||
|
"ext-imagick": "to use Imagick based image processing.",
|
||||||
|
"intervention/imagecache": "Caching extension for the Intervention Image library"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.4-dev"
|
||||||
|
},
|
||||||
|
"laravel": {
|
||||||
|
"providers": [
|
||||||
|
"Intervention\\Image\\ImageServiceProvider"
|
||||||
|
],
|
||||||
|
"aliases": {
|
||||||
|
"Image": "Intervention\\Image\\Facades\\Image"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Intervention\\Image\\": "src/Intervention/Image"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Oliver Vogel",
|
||||||
|
"email": "oliver@olivervogel.com",
|
||||||
|
"homepage": "http://olivervogel.com/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Image handling and manipulation library with support for Laravel integration",
|
||||||
|
"homepage": "http://image.intervention.io/",
|
||||||
|
"keywords": [
|
||||||
|
"gd",
|
||||||
|
"image",
|
||||||
|
"imagick",
|
||||||
|
"laravel",
|
||||||
|
"thumbnail",
|
||||||
|
"watermark"
|
||||||
|
],
|
||||||
|
"time": "2019-06-24T14:06:31+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "jakub-onderka/php-console-color",
|
"name": "jakub-onderka/php-console-color",
|
||||||
"version": "v0.2",
|
"version": "v0.2",
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ return [
|
|||||||
Illuminate\Translation\TranslationServiceProvider::class,
|
Illuminate\Translation\TranslationServiceProvider::class,
|
||||||
Illuminate\Validation\ValidationServiceProvider::class,
|
Illuminate\Validation\ValidationServiceProvider::class,
|
||||||
Illuminate\View\ViewServiceProvider::class,
|
Illuminate\View\ViewServiceProvider::class,
|
||||||
|
Intervention\Image\ImageServiceProvider::class,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Package Service Providers...
|
* Package Service Providers...
|
||||||
@@ -229,6 +230,7 @@ return [
|
|||||||
'MessageResponse' => Packages\Messaging\src\Facades\MessageResponse::class,
|
'MessageResponse' => Packages\Messaging\src\Facades\MessageResponse::class,
|
||||||
'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
|
'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
|
||||||
'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,
|
'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,
|
||||||
|
'Image' => Intervention\Image\Facades\Image::class
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class CreateTestTypesTable extends Migration
|
|||||||
$table->bigIncrements('id');
|
$table->bigIncrements('id');
|
||||||
$table->string('name')->unique();
|
$table->string('name')->unique();
|
||||||
$table->string('unique_code')->unique();
|
$table->string('unique_code')->unique();
|
||||||
|
$table->string('device_label');
|
||||||
$table->string('bar_code');
|
$table->string('bar_code');
|
||||||
$table->unsignedBigInteger('user_id');
|
$table->unsignedBigInteger('user_id');
|
||||||
$table->foreign('user_id')->references('id')->on('users');
|
$table->foreign('user_id')->references('id')->on('users');
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class CreateTestResultsTable extends Migration
|
|||||||
$table->text('description');
|
$table->text('description');
|
||||||
$table->smallInteger('verified');
|
$table->smallInteger('verified');
|
||||||
$table->string('device_id');
|
$table->string('device_id');
|
||||||
$table->string('device_label');
|
|
||||||
$table->integer('autoclave_id');
|
$table->integer('autoclave_id');
|
||||||
$table->unsignedBigInteger('user_id');
|
$table->unsignedBigInteger('user_id');
|
||||||
$table->foreign('user_id')->references('id')->on('users');
|
$table->foreign('user_id')->references('id')->on('users');
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?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->enum('result',array('Pass', 'Fail'));
|
||||||
|
$table->text('description');
|
||||||
|
$table->enum('verified',array('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,36 @@
|
|||||||
|
<?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->enum('result', array('Pass', 'Fail'));
|
||||||
|
$table->text('description');
|
||||||
|
$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->integer('item_id')->unsigned();
|
||||||
|
$table->integer('package_id')->unsigned();
|
||||||
|
$table->foreign('item_id')->references('id')->on('items');
|
||||||
|
$table->foreign('package_id')->references('id')->on('packages');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('item_package');
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user