brand 50%

This commit is contained in:
merdan 2022-01-25 16:16:22 +05:00
parent 0cf0b874d0
commit 0957fbb83d
17 changed files with 123 additions and 30 deletions

View File

@ -5,7 +5,7 @@ return [
'key' => 'catalog.scrap',
'name' => 'sarga::app.layouts.scrap',
'route' => 'admin.scrap-categories.index',
'sort' => 5,
'sort' => 6,
'icon-class' => '',
],
[

View File

@ -12,7 +12,7 @@
},
"autoload": {
"psr-4": {
"Sarga\\Admin\\": "src/"
"Sarga\\Brand\\": "src/"
}
},
"extra": {

View File

@ -0,0 +1,4 @@
<?php
return [
\Sarga\Brand\Providers\ModuleServiceProvider::class
];

View File

@ -0,0 +1,11 @@
<?php
return [
[
'key' => 'catalog.brand',
'name' => 'brand::app.brands',
'route' => 'admin.catalog.brand.index',
'sort' => 5,
'icon-class' => '',
]
];

View File

@ -0,0 +1,7 @@
<?php
namespace Sarga\Brand\Contracts;
interface Brand
{
}

View File

@ -1,6 +0,0 @@
<?php namespace Sarga\Brand\Contracts;
interface Brand
{
}

View File

@ -1,25 +1,41 @@
<?php namespace Sarga\Brand\Http\Controllers;
use Sarga\Brand\Repositories\BrandRepository;
class BrandController extends Controller
{
/**
* Contains route related configuration.
*
* @var array
*/
protected $_config;
protected $brandRepository;
public function __construct(BrandRepository $brandRepository)
{
$this->brandRepository = $brandRepository;
$this->_config = request('_config');
}
public function index() {
return view($this->_config['view']);
}
public function create(){
return view($this->_config['view']);
}
public function edit(){
public function edit($id){
$brand = $this->brandRepository->find($id);
return view($this->_config['view'], compact('brand'));
}
public function update(){
}
public function destroy(){
public function destroy($id){
}

View File

@ -3,6 +3,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Sarga\Brand\Contracts\Brand as BrandContract;
class Brand extends Model implements BrandContract
{
protected $fillable = [

View File

@ -0,0 +1,8 @@
<?php
namespace Sarga\Brand\Models;
class BrandProxy extends \Konekt\Concord\Proxies\ModelProxy
{
}

View File

@ -11,7 +11,18 @@ class BrandServiceProvider extends ServiceProvider
public function boot(): void
{
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->loadRoutesFrom(__DIR__ . '/../Routes/brand-routes.php');
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'brand');
$this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'brand');
// CategoryProxy::observe(CategoryObserver::class);
}
public function register()
{
$this->mergeConfigFrom(
dirname(__DIR__) . '/Config/menu.php',
'menu.admin'
);
$this->mergeConfigFrom(dirname(__DIR__) . '/Config/concord.php','concord.modules');
}
}

View File

@ -0,0 +1,6 @@
<?php
return [
'brand' => 'Brand',
'brands' => 'Brands',
'create_brand' => 'Create brand'
];

View File

@ -0,0 +1,5 @@
<?php
return[
'brand' => 'Marka',
'brands' => 'Markalar'
];

View File

@ -6,7 +6,7 @@
@section('content')
<div class="content">
<form method="POST" action="{{ route('admin.catalog.brands.store') }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
<form method="POST" action="{{ route('admin.catalog.brand.store') }}" @submit.prevent="onSubmit" enctype="multipart/form-data">
</form>
</div>
@stop

View File

@ -1 +1,20 @@
<?php
@extends('admin::layouts.content')
@section('page_title')
{{ __('brand::app.brands') }}
@stop
@section('content')
<div class="content">
<div class="page-header">
<div class="page-title">
<h1>{{ __('brand::app.brands') }}</h1>
</div>
<div class="page-action">
<a href="{{ route('admin.catalog.brand.create') }}" class="btn btn-lg btn-primary">
{{ __('brand::app.create_brand') }}
</a>
</div>
</div>
</div>
@stop

View File

@ -11,32 +11,34 @@ Route::group(['middleware' => ['web', 'admin', 'admin_locale'], 'prefix' => conf
* Categories routes.
*/
Route::get('/brands', [BrandController::class, 'index'])->defaults('_config', [
'view' => 'admin::catalog.categories.index',
])->name('admin.catalog.categories.index');
'view' => 'brand::admin.index',
])->name('admin.catalog.brand.index');
Route::get('/brands/create', [BrandController::class, 'create'])->defaults('_config', [
'view' => 'admin::catalog.categories.create',
])->name('admin.catalog.categories.create');
'view' => 'brand::admin.create',
])->name('admin.catalog.brand.create');
Route::post('/brands/create', [BrandController::class, 'store'])->defaults('_config', [
'redirect' => 'admin.catalog.categories.index',
])->name('admin.catalog.categories.store');
'redirect' => 'admin.catalog.brand.index',
])->name('admin.catalog.brand.store');
Route::get('/brands/edit/{id}', [BrandController::class, 'edit'])->defaults('_config', [
'view' => 'admin::catalog.categories.edit',
])->name('admin.catalog.categories.edit');
'view' => 'brand::admin.edit',
])->name('admin.catalog.brand.edit');
Route::put('/brands/edit/{id}', [BrandController::class, 'update'])->defaults('_config', [
'redirect' => 'admin.catalog.categories.index',
])->name('admin.catalog.categories.update');
'redirect' => 'admin.catalog.brand.index',
])->name('admin.catalog.brand.update');
Route::post('/brands/delete/{id}', [BrandController::class, 'destroy'])->name('admin.catalog.categories.delete');
Route::post('/brands/delete/{id}', [BrandController::class, 'destroy'])
->name('admin.catalog.brand.delete');
Route::post('brands/massdelete', [BrandController::class, 'massDestroy'])->defaults('_config', [
'redirect' => 'admin.catalog.categories.index',
])->name('admin.catalog.categories.massdelete');
'redirect' => 'admin.catalog.brand.index',
])->name('admin.catalog.brand.massdelete');
Route::post('/brands/product/count', [BrandController::class, 'productCount'])->name('admin.catalog.categories.product.count');
Route::post('/brands/product/count', [BrandController::class, 'productCount'])
->name('admin.catalog.brand.product.count');
});
});

View File

@ -0,0 +1,9 @@
<?php
/*
* Admin routes
*/
require 'admin-routes.php';
/*
* Shop routes
*/
require 'shop-routes.php';