api settings
This commit is contained in:
parent
5a985dc5dd
commit
7c6ef8e82f
|
|
@ -48,18 +48,33 @@ class BlogPostsApiController extends Controller
|
|||
|
||||
public function getAccounts(Request $request)
|
||||
{
|
||||
//$path = Config::get('cms.storage.media.path');
|
||||
$data = $request->all();
|
||||
|
||||
$dataAccounts = User::select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'description', 'map', 'banner', 'is_instagram')
|
||||
->with('categories:id,name,slug,icon')
|
||||
->get();
|
||||
|
||||
$dataAccounts = User::where('is_featured', 1)
|
||||
->select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'description', 'map')
|
||||
->get();
|
||||
if($data && $data["type"] == "home"){
|
||||
|
||||
$dataAccounts = User::where('is_featured', 1)
|
||||
->select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'description', 'map', 'banner', 'is_instagram')
|
||||
->with('categories:id,name,slug,icon')
|
||||
->paginate(9);
|
||||
|
||||
}elseif($data && $data["type"] == "category"){
|
||||
|
||||
$dataAccounts = User::where('is_category', 1)
|
||||
->select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'description', 'map', 'is_instagram')
|
||||
->with('categories:id,name,slug,icon')
|
||||
->paginate(9);
|
||||
|
||||
}
|
||||
//$dataSlider["img"] = $path.$dataSlider["img"];
|
||||
|
||||
if($dataAccounts){
|
||||
$dataAccounts->each(function ($item, $key) {
|
||||
$item->logo = 'http://78.111.88.8:9086'.Config::get('cms.storage.media.path').$item->logo;
|
||||
$item->banner = 'http://78.111.88.8:9086'.Config::get('cms.storage.media.path').$item->banner;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,7 @@ class ProductsAPIController extends Controller
|
|||
$query = $this->Product::with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
//'measure.translations:locale,model_id,attribute_data',
|
||||
//'currency.translations:locale,model_id,attribute_data'
|
||||
])
|
||||
// ->approvedAndFreshEndDate()
|
||||
->approved()
|
||||
->orderBy('ends_at', $sortOrder);
|
||||
|
||||
|
|
@ -58,14 +55,11 @@ class ProductsAPIController extends Controller
|
|||
$category = Category::find($categoryId);
|
||||
if($category) {
|
||||
$query = $category->products()
|
||||
// ->with('categories:id,name')
|
||||
->with('categories:id,name')
|
||||
->with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
//'measure.translations:locale,model_id,attribute_data',
|
||||
//'currency.translations:locale,model_id,attribute_data'
|
||||
])
|
||||
// ->approvedAndFreshEndDate()
|
||||
->approved()
|
||||
->orderBy('ends_at', $sortOrder);
|
||||
} else {
|
||||
|
|
@ -86,8 +80,6 @@ class ProductsAPIController extends Controller
|
|||
->with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
//'measure.translations:locale,model_id,attribute_data',
|
||||
//'currency.translations:locale,model_id,attribute_data'
|
||||
])
|
||||
// ->approvedAndFreshEndDate()
|
||||
->approved()
|
||||
|
|
@ -102,24 +94,12 @@ class ProductsAPIController extends Controller
|
|||
->with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
//'measure.translations:locale,model_id,attribute_data',
|
||||
//'currency.translations:locale,model_id,attribute_data'
|
||||
])
|
||||
->orderBy('ends_at', $sortOrder);
|
||||
}
|
||||
|
||||
$data = $query ? $query->paginate($perPage) : null;
|
||||
//if($data) {
|
||||
// foreach ($data as $product) {
|
||||
// $product->unit = new MeasureResource($product->measure);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if($data) {
|
||||
// $data->each(function ($item, $key) {
|
||||
// $item->img_url_start = $this->pageUrl('index') . \Config::get('cms.storage.media.path') . $item->icon;
|
||||
// });
|
||||
// }
|
||||
|
||||
return response()->json($data, 200);
|
||||
}
|
||||
|
|
@ -129,10 +109,6 @@ class ProductsAPIController extends Controller
|
|||
$data = $this->Product::with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
'measure.translations:locale,model_id,attribute_data',
|
||||
'currency.translations:locale,model_id,attribute_data',
|
||||
'payment_term.translations:locale,model_id,attribute_data',
|
||||
'delivery_term.translations:locale,model_id,attribute_data',
|
||||
'vendor:id,name,surname,email,username'
|
||||
])->find($id);
|
||||
|
||||
|
|
@ -163,10 +139,10 @@ class ProductsAPIController extends Controller
|
|||
}
|
||||
}
|
||||
],
|
||||
'mark' => 'required',
|
||||
'manufacturer' => 'required',
|
||||
'country' => 'required',
|
||||
'market_type' => 'required|in:in,out',
|
||||
// 'mark' => 'required',
|
||||
// 'manufacturer' => 'required',
|
||||
// 'country' => 'required',
|
||||
// 'market_type' => 'required|in:in,out',
|
||||
|
||||
// if product is being edited - not added
|
||||
'productForEditing' => [
|
||||
|
|
@ -214,10 +190,10 @@ class ProductsAPIController extends Controller
|
|||
|
||||
$product->slug = \Str::slug($data['name_tm'],'-');
|
||||
$product->status = 'draft';
|
||||
$product->mark = $data['mark'];
|
||||
$product->manufacturer = $data['manufacturer'];
|
||||
$product->country = $data['country'];
|
||||
$product->market_type = $data['market_type'];
|
||||
// $product->mark = $data['mark'];
|
||||
// $product->manufacturer = $data['manufacturer'];
|
||||
// $product->country = $data['country'];
|
||||
// $product->market_type = $data['market_type'];
|
||||
|
||||
$product->vendor_id = \JWTAuth::parseToken()->authenticate()->id;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class TermsapiController extends Controller
|
|||
$inputData = $request->all();
|
||||
|
||||
$rules = [
|
||||
'type' => 'required|in:payment,delivery'
|
||||
'type' => 'required|in:about,privacy'
|
||||
];
|
||||
|
||||
$validator = Validator::make($inputData, $rules);
|
||||
|
|
@ -34,12 +34,12 @@ class TermsapiController extends Controller
|
|||
}
|
||||
|
||||
switch ($inputData['type']) {
|
||||
case 'payment':
|
||||
$data = $this->Term::payment()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
||||
case 'about':
|
||||
$data = $this->Term::about()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
||||
break;
|
||||
|
||||
case 'delivery':
|
||||
$data = $this->Term::delivery()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
||||
case 'privacy':
|
||||
$data = $this->Term::privacy()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -14,9 +14,11 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro
|
|||
|
||||
// Route::get('products/{id}/delete', ['as' => 'products.delete', 'uses' => 'ProductsApiController@destroy']);
|
||||
|
||||
Route::resource('countries', 'CountriesapiController', ['except' => ['destroy', 'create', 'edit']]);
|
||||
Route::resource('currencies', 'CurrenciesapiController', ['except' => ['destroy', 'create', 'edit']]);
|
||||
Route::resource('measures', 'MeasuresapiController', ['except' => ['destroy', 'create', 'edit']]);
|
||||
// Route::resource('countries', 'CountriesapiController', ['except' => ['destroy', 'create', 'edit']]);
|
||||
// Route::resource('currencies', 'CurrenciesapiController', ['except' => ['destroy', 'create', 'edit']]);
|
||||
// Route::resource('measures', 'MeasuresapiController', ['except' => ['destroy', 'create', 'edit']]);
|
||||
|
||||
|
||||
// Route::get('measures/{id}/delete', ['as' => 'measures.delete', 'uses' => 'MeasuresapiController@destroy']);
|
||||
|
||||
Route::resource('terms', 'TermsapiController', ['except' => ['destroy', 'create', 'edit']]);
|
||||
|
|
|
|||
|
|
@ -84,14 +84,6 @@ tabs:
|
|||
default: simple
|
||||
type: balloon-selector
|
||||
tab: Gurlushyk
|
||||
logo:
|
||||
label: Logo
|
||||
mode: image
|
||||
imageWidth: '100'
|
||||
imageHeight: '100'
|
||||
span: auto
|
||||
type: mediafinder
|
||||
tab: Gurlushyk
|
||||
shop_title:
|
||||
label: 'Brend Ady'
|
||||
span: auto
|
||||
|
|
@ -109,11 +101,6 @@ tabs:
|
|||
span: auto
|
||||
type: text
|
||||
tab: Gurlushyk
|
||||
is_instagram:
|
||||
label: 'Instagram Stilmi'
|
||||
span: auto
|
||||
type: switch
|
||||
tab: Gurlushyk
|
||||
map:
|
||||
label: Map
|
||||
size: ''
|
||||
|
|
@ -126,12 +113,6 @@ tabs:
|
|||
span: auto
|
||||
type: textarea
|
||||
tab: Gurlushyk
|
||||
is_featured:
|
||||
label: 'Bash Sahypa'
|
||||
span: auto
|
||||
disabled: 0
|
||||
type: switch
|
||||
tab: Gurlushyk
|
||||
categories:
|
||||
label: Relation
|
||||
nameFrom: name
|
||||
|
|
@ -139,6 +120,37 @@ tabs:
|
|||
span: auto
|
||||
type: relation
|
||||
tab: Kategoriyalar
|
||||
is_featured:
|
||||
label: 'Bash Sahypa'
|
||||
span: auto
|
||||
disabled: 0
|
||||
type: switch
|
||||
tab: Suratlar
|
||||
is_instagram:
|
||||
label: 'Instagram Stilmi'
|
||||
span: auto
|
||||
type: switch
|
||||
tab: Suratlar
|
||||
is_category:
|
||||
label: 'Category Page'
|
||||
span: auto
|
||||
type: switch
|
||||
tab: Suratlar
|
||||
logo:
|
||||
label: Logo
|
||||
mode: image
|
||||
imageWidth: '100'
|
||||
imageHeight: '100'
|
||||
span: left
|
||||
type: mediafinder
|
||||
tab: Suratlar
|
||||
banner:
|
||||
label: Banner
|
||||
mode: image
|
||||
span: auto
|
||||
imageWidth: '200'
|
||||
type: mediafinder
|
||||
tab: Suratlar
|
||||
secondaryTabs:
|
||||
fields:
|
||||
avatar:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?php namespace RainLab\User\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class UsersAddBanner extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function($table)
|
||||
{
|
||||
$table->string('banner')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if (Schema::hasColumn('users', 'banner')) {
|
||||
Schema::table('users', function($table)
|
||||
{
|
||||
$table->dropColumn('banner');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php namespace RainLab\User\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class UsersAddIsCategory extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function($table)
|
||||
{
|
||||
$table->boolean('is_category')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
if (Schema::hasColumn('users', 'is_category')) {
|
||||
Schema::table('users', function($table)
|
||||
{
|
||||
$table->dropColumn('is_category');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -92,3 +92,9 @@ v1.7.5:
|
|||
v1.7.6:
|
||||
- Add featured user gurlushyk
|
||||
- users_add_featured.php
|
||||
v1.7.7:
|
||||
- Add banner user gurlushyk
|
||||
- users_add_banner.php
|
||||
v1.7.8:
|
||||
- Add is category user gurlushyk
|
||||
- users_add_is_category.php
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Product extends Model
|
|||
'name' => 'required',
|
||||
'slug' => 'required',
|
||||
'images' => 'required',
|
||||
'quantity' => 'required',
|
||||
// 'quantity' => 'required',
|
||||
//'measure' => 'required',
|
||||
'price' => 'required|numeric|max:9999999',
|
||||
//'currency' => 'required',
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ class Term extends Model
|
|||
|
||||
public $translatable = ['name'];
|
||||
|
||||
public function scopePayment($query){
|
||||
return $query->where('type','payment');
|
||||
public function scopeAbout($query){
|
||||
return $query->where('type','about');
|
||||
}
|
||||
|
||||
public function scopeDelivery($query){
|
||||
return $query->where('type','delivery');
|
||||
public function scopePrivacy($query){
|
||||
return $query->where('type','privacy');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,6 @@ columns:
|
|||
label: Status
|
||||
type: status
|
||||
sortable: true
|
||||
mark:
|
||||
label: Marka
|
||||
type: text
|
||||
searchable: true
|
||||
sortable: true
|
||||
updated_at:
|
||||
label: 'Updated at'
|
||||
type: datetime
|
||||
|
|
@ -29,3 +24,6 @@ columns:
|
|||
label: 'Ends at'
|
||||
type: datetime
|
||||
invisible: true
|
||||
is_home:
|
||||
label: 'Is Home'
|
||||
type: switch
|
||||
|
|
|
|||
|
|
@ -12,20 +12,12 @@ fields:
|
|||
preset:
|
||||
field: name
|
||||
type: slug
|
||||
mark:
|
||||
label: Marka
|
||||
span: auto
|
||||
type: text
|
||||
created_at:
|
||||
label: 'Created at'
|
||||
mode: datetime
|
||||
span: auto
|
||||
readOnly: 1
|
||||
type: datepicker
|
||||
quantity:
|
||||
label: Quantity
|
||||
span: auto
|
||||
type: number
|
||||
ends_at:
|
||||
label: 'Ends at'
|
||||
mode: datetime
|
||||
|
|
@ -62,6 +54,10 @@ fields:
|
|||
extension: auto
|
||||
span: auto
|
||||
type: fileupload
|
||||
is_home:
|
||||
label: 'Is Home'
|
||||
span: auto
|
||||
type: switch
|
||||
tabs:
|
||||
fields:
|
||||
categories:
|
||||
|
|
|
|||
|
|
@ -7,8 +7,13 @@ fields:
|
|||
type:
|
||||
label: Type
|
||||
options:
|
||||
payment: payment
|
||||
delivery: delivery
|
||||
about: About
|
||||
privacy: 'Privacy Policy'
|
||||
span: auto
|
||||
required: 1
|
||||
type: balloon-selector
|
||||
content:
|
||||
label: Content
|
||||
size: huge
|
||||
span: full
|
||||
type: richeditor
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<?php namespace TPS\Birzha\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsBirzhaProducts27 extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_birzha_products', function($table)
|
||||
{
|
||||
$table->dropColumn('mark');
|
||||
$table->dropColumn('quantity');
|
||||
$table->dropColumn('measure_id');
|
||||
$table->dropColumn('currency_id');
|
||||
$table->dropColumn('payment_term_id');
|
||||
$table->dropColumn('delivery_term_id');
|
||||
$table->dropColumn('packaging');
|
||||
$table->dropColumn('payment_id');
|
||||
$table->dropColumn('payed_fee_for_publ');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_birzha_products', function($table)
|
||||
{
|
||||
$table->string('mark', 191)->nullable();
|
||||
$table->decimal('quantity', 10, 2)->nullable();
|
||||
$table->integer('measure_id')->nullable();
|
||||
$table->integer('currency_id')->nullable();
|
||||
$table->integer('payment_term_id')->nullable();
|
||||
$table->integer('delivery_term_id')->nullable();
|
||||
$table->string('packaging', 191)->nullable();
|
||||
$table->integer('payment_id')->nullable();
|
||||
$table->decimal('payed_fee_for_publ', 10, 2)->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php namespace TPS\Birzha\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsBirzhaProducts28 extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_birzha_products', function($table)
|
||||
{
|
||||
$table->boolean('is_home')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_birzha_products', function($table)
|
||||
{
|
||||
$table->dropColumn('is_home');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php namespace TPS\Birzha\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsBirzhaProducts29 extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_birzha_products', function($table)
|
||||
{
|
||||
$table->boolean('is_home')->default(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_birzha_products', function($table)
|
||||
{
|
||||
$table->boolean('is_home')->default(null)->change();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
<?php namespace TPS\Birzha\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsBirzhaTerms extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_birzha_terms', function($table)
|
||||
{
|
||||
$table->text('content')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_birzha_terms', function($table)
|
||||
{
|
||||
$table->dropColumn('content');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -335,3 +335,15 @@
|
|||
1.0.118:
|
||||
- 'Updated table tps_birzha_user_sliders'
|
||||
- builder_table_update_tps_birzha_user_sliders_5.php
|
||||
1.0.119:
|
||||
- 'Updated table tps_birzha_products'
|
||||
- builder_table_update_tps_birzha_products_27.php
|
||||
1.0.120:
|
||||
- 'Updated table tps_birzha_products'
|
||||
- builder_table_update_tps_birzha_products_28.php
|
||||
1.0.121:
|
||||
- 'Updated table tps_birzha_products'
|
||||
- builder_table_update_tps_birzha_products_29.php
|
||||
1.0.122:
|
||||
- 'Updated table tps_birzha_terms'
|
||||
- builder_table_update_tps_birzha_terms.php
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
title = "home"
|
||||
url = "/"
|
||||
is_hidden = 0
|
||||
==
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
name: gulushyk2
|
||||
description: ''
|
||||
author: ''
|
||||
homepage: ''
|
||||
code: ''
|
||||
Loading…
Reference in New Issue