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('.', '..'));
|
||||
foreach ($filenames as $item) {
|
||||
$shop_number = explode(".", $item)[0];
|
||||
Log::info($item);
|
||||
$shop = Shop::where("shop_number", $shop_number)->get()->first();
|
||||
$shop_id = explode(".", $item)[0];
|
||||
|
||||
$shop = Shop::where("shop_id", $shop_id)->get()->first();
|
||||
|
||||
if ($shop) {
|
||||
$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->shop_id = $shop->id;
|
||||
// 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->save();
|
||||
Log::info("saved succesfully");
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ columns:
|
|||
shop_number:
|
||||
label: shop_number
|
||||
type: text
|
||||
shop_id:
|
||||
label: shop_id
|
||||
type: text
|
||||
phone:
|
||||
label: phone
|
||||
type: number
|
||||
|
|
@ -19,7 +22,6 @@ columns:
|
|||
type: text
|
||||
category_field:
|
||||
label: category
|
||||
disabled: true
|
||||
created_at:
|
||||
label: created_at
|
||||
type: datetime
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@ fields:
|
|||
descriptionFrom: name
|
||||
span: auto
|
||||
type: relation
|
||||
shop_id:
|
||||
label: 'Shop Id'
|
||||
span: auto
|
||||
type: text
|
||||
floor:
|
||||
label: Floor
|
||||
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:
|
||||
- 'Updated table tps_shops_reports'
|
||||
- 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