Merge pull request #205 from bagisto/prashant

migration fixes for product grid and fixes in slider data grid and ta…
This commit is contained in:
JItendra Singh 2018-11-28 16:15:31 +05:30 committed by GitHub
commit c8acd1823d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 32 deletions

View File

@ -103,9 +103,9 @@ class SliderDataGrid
'label' => 'ID'
], [
'column' => 's.title',
'alias' => 'SliderTitle',
'alias' => 'sliderTitle',
'type' => 'string',
'label' => 'Slider Title'
'label' => 'title'
],
],

View File

@ -103,18 +103,18 @@ class TaxCategoryDataGrid
],
//don't use aliasing in case of filters
'filterable' => [
[
'column' => 'tr.name',
'alias' => 'Name',
'type' => 'number',
'label' => 'Name'
],
[
'column' => 'tr.id',
'alias' => 'ID',
'type' => 'number',
'label' => 'ID'
],
[
'column' => 'tr.name',
'alias' => 'Name',
'type' => 'string',
'label' => 'Name'
],
[
'column' => 'tr.code',
'alias' => 'code',

View File

@ -174,10 +174,8 @@ Route::group(['middleware' => ['web']], function () {
// Catalog Routes
Route::prefix('catalog')->group(function () {
Route::get('/sync', 'Webkul\Product\Http\Controllers\ProductController@sync');
// Catalog Product Routes
Route::get('/products', 'Webkul\Product\Http\Controllers\ProductController@index')->defaults('_config', [
'view' => 'admin::catalog.products.index'

View File

@ -243,11 +243,17 @@ class Product {
$qty = 0;
}
$this->productGrid->create($gridObject);
$oldGridObject = $this->productGrid->findOneByField('product_id', $product->id);
if($oldGridObject) {
$oldGridObject->update($gridObject);
} else {
$this->productGrid->create($gridObject);
}
$gridObject = [];
}
return true;
}
}

View File

@ -13,11 +13,10 @@ class RemoveCostColumnFromDatagrid extends Migration
*/
public function up()
{
if (Schema::hasTable('product_grid')) {
Schema::table('products_grid', function (Blueprint $table) {
$table->dropColumn('cost');
});
}
Schema::table('products_grid', function (Blueprint $table) {
$table->dropColumn('cost');
$table->dropColumn('attribute_family_name');
});
}
/**
@ -27,10 +26,9 @@ class RemoveCostColumnFromDatagrid extends Migration
*/
public function down()
{
if (Schema::hasTable('product_grid')) {
Schema::table('products_grid', function (Blueprint $table) {
$table->string('cost');
});
}
Schema::table('products_grid', function (Blueprint $table) {
$table->string('cost');
$table->string('attribute_family_name')->nullable();
});
}
}

View File

@ -78,6 +78,8 @@ class ProductController extends Controller
Product $product,
ProductGrid $productGrid)
{
$this->middleware('admin');
$this->attributeFamily = $attributeFamily;
$this->category = $category;
@ -216,6 +218,8 @@ class ProductController extends Controller
* To be manually invoked when data is seeded into products
*/
public function sync() {
Event::fire('products.datagrid.create', true);
Event::fire('products.datagrid.sync', true);
return redirect()->route('admin.catalog.products.index');
}
}

View File

@ -19,7 +19,7 @@ class ProductServiceProvider extends ServiceProvider
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
Event::listen('products.datagrid.create', 'Webkul\Admin\Listeners\Product@sync');
Event::listen('products.datagrid.sync', 'Webkul\Admin\Listeners\Product@sync');
Event::listen('product.save.after', 'Webkul\Admin\Listeners\Product@afterProductCreated');

View File

@ -187,14 +187,6 @@
<span class="suggestion mt-15">Designer sarees</span>
</div> --}}
</div>
@auth('customer')
@if(auth()->guard('customer')->user()->is_verified == 0)
<div class="verify-account">
<span>{{ __('shop::app.home.verify-email') }}</span>
</div>
@endif
@endauth
</div>
@push('scripts')