Add shop id to attach reports to shops
This commit is contained in:
parent
4b7199d1dd
commit
ee5f053e7b
|
|
@ -41,9 +41,9 @@ class Report extends Controller
|
||||||
|
|
||||||
$filenames = array_diff(scandir($storageDestinationPath), array('.', '..'));
|
$filenames = array_diff(scandir($storageDestinationPath), array('.', '..'));
|
||||||
foreach ($filenames as $item) {
|
foreach ($filenames as $item) {
|
||||||
$shop_number = explode(".", $item)[0];
|
$shop_id = explode(".", $item)[0];
|
||||||
Log::info($item);
|
|
||||||
$shop = Shop::where("shop_number", $shop_number)->get()->first();
|
$shop = Shop::where("shop_id", $shop_id)->get()->first();
|
||||||
|
|
||||||
if ($shop) {
|
if ($shop) {
|
||||||
$exist = ReportDetail::where('report_id', $id)->where("shop_id", $shop->id)->get();
|
$exist = ReportDetail::where('report_id', $id)->where("shop_id", $shop->id)->get();
|
||||||
|
|
@ -52,7 +52,6 @@ Log::info($item);
|
||||||
$report_detail->report_id = $id;
|
$report_detail->report_id = $id;
|
||||||
$report_detail->shop_id = $shop->id;
|
$report_detail->shop_id = $shop->id;
|
||||||
// on local explode storage\app on live server storage/app
|
// on local explode storage\app on live server storage/app
|
||||||
Log::info('/extract'.explode('extract', $storageDestinationPath)[1].'/'.$item);
|
|
||||||
$report_detail->file = '/extract'.explode('extract', $storageDestinationPath)[1].'/'.$item;
|
$report_detail->file = '/extract'.explode('extract', $storageDestinationPath)[1].'/'.$item;
|
||||||
$report_detail->save();
|
$report_detail->save();
|
||||||
Log::info("saved succesfully");
|
Log::info("saved succesfully");
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,9 @@ columns:
|
||||||
shop_number:
|
shop_number:
|
||||||
label: shop_number
|
label: shop_number
|
||||||
type: text
|
type: text
|
||||||
|
shop_id:
|
||||||
|
label: shop_id
|
||||||
|
type: text
|
||||||
phone:
|
phone:
|
||||||
label: phone
|
label: phone
|
||||||
type: number
|
type: number
|
||||||
|
|
@ -19,7 +22,6 @@ columns:
|
||||||
type: text
|
type: text
|
||||||
category_field:
|
category_field:
|
||||||
label: category
|
label: category
|
||||||
disabled: true
|
|
||||||
created_at:
|
created_at:
|
||||||
label: created_at
|
label: created_at
|
||||||
type: datetime
|
type: datetime
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,10 @@ fields:
|
||||||
descriptionFrom: name
|
descriptionFrom: name
|
||||||
span: auto
|
span: auto
|
||||||
type: relation
|
type: relation
|
||||||
|
shop_id:
|
||||||
|
label: 'Shop Id'
|
||||||
|
span: auto
|
||||||
|
type: text
|
||||||
floor:
|
floor:
|
||||||
label: Floor
|
label: Floor
|
||||||
span: auto
|
span: auto
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php namespace Tps\Shops\Updates;
|
||||||
|
|
||||||
|
use Schema;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class BuilderTableUpdateTpsShops12 extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('tps_shops_', function($table)
|
||||||
|
{
|
||||||
|
$table->string('shop_id')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('tps_shops_', function($table)
|
||||||
|
{
|
||||||
|
$table->dropColumn('shop_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -84,3 +84,6 @@
|
||||||
1.0.29:
|
1.0.29:
|
||||||
- 'Updated table tps_shops_reports'
|
- 'Updated table tps_shops_reports'
|
||||||
- builder_table_update_tps_shops_reports.php
|
- builder_table_update_tps_shops_reports.php
|
||||||
|
1.0.30:
|
||||||
|
- 'Updated table tps_shops_'
|
||||||
|
- builder_table_update_tps_shops__12.php
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue