vendor attributes
This commit is contained in:
parent
296f09d424
commit
1b3d3f0816
|
|
@ -18,7 +18,7 @@ class Vendors extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
$vendors = $this->vendorRepository->select('marketplace_sellers.id','url','logo','banner','shop_title')
|
||||
$vendors = $this->vendorRepository->select('marketplace_sellers.id','url','logo','banner','shop_title','brand_attribute_id')
|
||||
->where('is_approved',true)
|
||||
->with(['categories:seller_id,type,categories'])
|
||||
// ->leftJoin('seller_categories','marketplace_sellers.id','=','seller_categories.seller_id')
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class Vendor extends JsonResource
|
|||
'shop_title' => $this->shop_title,
|
||||
'logo' => $this->logo_url,
|
||||
'banner' => $this->banner_url,
|
||||
'brand_id' => $this->brand_attribute_id,
|
||||
'categories' => SellerCategory::collection($this->categories),
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class UpdateSellersTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('marketplace_sellers', function (Blueprint $table) {
|
||||
$table->unsignedInteger('brand_attribute_id')->nullable();
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('marketplace_sellers', function (Blueprint $table) {
|
||||
$table->dropColumn('brand_attribute_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: merdan
|
||||
* Date: 12/29/2021
|
||||
* Time: 10:23
|
||||
*/
|
||||
|
||||
namespace Sarga\Admin\Listeners;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Webkul\Attribute\Repositories\AttributeOptionRepository;
|
||||
|
||||
class Sellers
|
||||
{
|
||||
protected $optionRepository;
|
||||
public function __construct(AttributeOptionRepository $optionRepository)
|
||||
{
|
||||
$this->optionRepository = $optionRepository;
|
||||
}
|
||||
|
||||
public function edit($seller){
|
||||
Log::info(json_encode($seller));
|
||||
return view('sarga_admin::sellers.seller-brand');
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@ class AdminServiceProvider extends ServiceProvider
|
|||
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'sarga_admin');
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'sarga');
|
||||
$this->app->register(EventServiceProvider::class);
|
||||
}
|
||||
|
||||
public function register()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: merdan
|
||||
* Date: 12/29/2021
|
||||
* Time: 10:14
|
||||
*/
|
||||
|
||||
namespace Sarga\Admin\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
public function boot(){
|
||||
Event::listen('marketplace.sellers.account.profile.edit.before', function($viewRenderEventManager) {
|
||||
$viewRenderEventManager->addTemplate('sarga_admin::sellers.seller-brand');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
@php
|
||||
$attributes = app('Webkul\Attribute\Repositories\AttributeRepository')->findWhere(['type'=>'select']);
|
||||
@endphp
|
||||
<div class="control-group" :class="[errors.has('brand_attribute_id') ? 'has-error' : '']">
|
||||
<label for="brand_attribute_id" class="required">Brand Attribute</label>
|
||||
<select name="brand_attribute_id" id="brand_attribute_id" class="control"
|
||||
data-vv-as=""Brand Attribute""
|
||||
>
|
||||
@foreach ($attributes as $attribute)
|
||||
<option value="{{$attribute->id}}" @if(old('brand_attribute_id',$seller->brand_attribute_id)==$attribute->id)selected @endif>
|
||||
{{$attribute->admin_name}}</option>
|
||||
@endforeach
|
||||
|
||||
</select>
|
||||
<span class="control-error" v-if="errors.has('brand_attribute_id')">@{{ errors.first('brand_attribute_id') }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Webkul\Attribute\Http\Controllers\AttributeController;
|
||||
use Webkul\Attribute\Http\Controllers\AttributeFamilyController;
|
||||
use Webkul\Category\Http\Controllers\CategoryController;
|
||||
use Webkul\Marketplace\Http\Controllers\Admin\SellerCategoryController;
|
||||
use Webkul\Product\Http\Controllers\ProductController;
|
||||
|
||||
/**
|
||||
* marketplace routes.
|
||||
*/
|
||||
Route::group(['middleware' => ['web', 'admin', 'admin_locale'], 'prefix' => config('app.admin_url')], function () {
|
||||
Route::prefix('marketplace/seller-categories')->group(function () {
|
||||
|
||||
Route::get('/', 'Webkul\Marketplace\Http\Controllers\Admin\SellerCategoryController@index')->defaults('_config', [
|
||||
'view' => 'sarga_admin::sellers.category.index'
|
||||
])->name('admin.marketplace.seller.category.index');
|
||||
|
||||
Route::get('create', [SellerCategoryController::class, 'create'])->defaults('_config', [
|
||||
'view' => 'sarga_admin::sellers.category.create',
|
||||
])->name('admin.marketplace.seller.category.create');
|
||||
|
||||
Route::get('edit/{id}', 'Webkul\Marketplace\Http\Controllers\Admin\SellerCategoryController@edit')->defaults('_config', [
|
||||
'view' => 'sarga_admin::sellers.category.edit',
|
||||
])->name('admin.marketplace.seller.category.edit');
|
||||
|
||||
// seller profile routes start here
|
||||
Route::get('sellers/profile/edit/{id}', 'Webkul\Marketplace\Http\Controllers\Admin\SellerController@editProfile')->defaults('_config', [
|
||||
'view' => 'marketplace::admin.sellers.edit'
|
||||
])->name('admin.marketplace.seller.edit');
|
||||
|
||||
// seller profile routes end here
|
||||
});
|
||||
});
|
||||
|
|
@ -10,14 +10,14 @@ Route::group(['middleware' => ['web', 'admin', 'admin_locale'], 'prefix' => conf
|
|||
* Channels routes.
|
||||
*/
|
||||
|
||||
Route::get('/channels/create', [ChannelController::class, 'create'])->defaults('_config', [
|
||||
'view' => 'sarga_admin::settings.channels.create',
|
||||
])->name('admin.channels.create');
|
||||
|
||||
|
||||
Route::get('/channels/edit/{id}', [ChannelController::class, 'edit'])->defaults('_config', [
|
||||
'view' => 'sarga_admin::settings.channels.edit',
|
||||
])->name('admin.channels.edit');
|
||||
// Route::get('/channels/create', [ChannelController::class, 'create'])->defaults('_config', [
|
||||
// 'view' => 'sarga_admin::settings.channels.create',
|
||||
// ])->name('admin.channels.create');
|
||||
//
|
||||
//
|
||||
// Route::get('/channels/edit/{id}', [ChannelController::class, 'edit'])->defaults('_config', [
|
||||
// 'view' => 'sarga_admin::settings.channels.edit',
|
||||
// ])->name('admin.channels.edit');
|
||||
|
||||
/*
|
||||
* Scrap
|
||||
|
|
|
|||
|
|
@ -9,3 +9,8 @@ require 'catalog-routes.php';
|
|||
* Settings routes.
|
||||
*/
|
||||
require 'settings-routes.php';
|
||||
|
||||
/**
|
||||
* marketplace routes
|
||||
*/
|
||||
require 'marketplace-routes.php';
|
||||
Loading…
Reference in New Issue