Merge branch 'main' of https://git.digital-tps.tk/Shohrat/gurl_o into main
This commit is contained in:
commit
43915663e8
|
|
@ -69,15 +69,15 @@ class BlogPostsApiController extends Controller
|
||||||
|
|
||||||
}else if ($dataq->sections[$i]->section_type == "TPS\Birzha\Models\Product") {
|
}else if ($dataq->sections[$i]->section_type == "TPS\Birzha\Models\Product") {
|
||||||
|
|
||||||
$modified = $dataq->sections[$i]->section_type::where('type', $dataq->sections[$i]->product_type)->select('id', 'name', 'price', 'description', 'vendor_id', 'number_of_views', 'is_home')->with([
|
$modified = $dataq->sections[$i]->section_type::where('type', $dataq->sections[$i]->product_type)->select('id', 'name', 'price', 'description', 'place_id', 'vendor_id', 'number_of_views', 'is_home', 'short_description')->with("place")->with([
|
||||||
'translations:locale,model_id,attribute_data',
|
'translations:locale,model_id,attribute_data',
|
||||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||||
'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram',
|
'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram',
|
||||||
'place',
|
])->limit(10)->get();
|
||||||
])->limit(10)->get();
|
|
||||||
// $modified->makeHidden(['created_at', 'updated_at', 'deleted_at']);
|
// $modified->makeHidden(['created_at', 'updated_at', 'deleted_at']);
|
||||||
$product_section = array(
|
$product_section = array(
|
||||||
"type"=> "product_section",
|
"type"=> "product_section",
|
||||||
|
"header" => $dataq->sections[$i]->header,
|
||||||
"contents"=> $modified
|
"contents"=> $modified
|
||||||
);
|
);
|
||||||
$contents = array_merge($contents, array($product_section));
|
$contents = array_merge($contents, array($product_section));
|
||||||
|
|
@ -292,7 +292,7 @@ class BlogPostsApiController extends Controller
|
||||||
//$data = User::find($id)->first;
|
//$data = User::find($id)->first;
|
||||||
|
|
||||||
|
|
||||||
$data = User::where('id', $id)->select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'short_description', 'description', 'map', 'banner', 'is_instagram')
|
$data = User::where('id', $id)->select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'short_description', 'description', 'map', 'banner', 'is_instagram', 'tiktok', 'instagram', 'site', 'qr')
|
||||||
->with(['categories' => function($q){
|
->with(['categories' => function($q){
|
||||||
$q->with('translations:locale,model_id,attribute_data');
|
$q->with('translations:locale,model_id,attribute_data');
|
||||||
}])
|
}])
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,35 @@ class OrderApiController extends Controller
|
||||||
|
|
||||||
public function mySales(Request $request){
|
public function mySales(Request $request){
|
||||||
|
|
||||||
|
$data = $request->all();
|
||||||
|
|
||||||
|
$validator = Validator::make($data, [
|
||||||
|
'order_id' => 'required',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// $validator = $this->validateForm($data, $rules);
|
||||||
|
if($validator->fails()) {
|
||||||
|
return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validator->errors() );
|
||||||
|
}
|
||||||
|
|
||||||
$currentUser = \JWTAuth::parseToken()->authenticate();
|
$currentUser = \JWTAuth::parseToken()->authenticate();
|
||||||
|
|
||||||
$sales = VendorSales::where('vendor_id', $currentUser->id)->with(['order.user', 'product'])->orderBy('id', 'DESC')->paginate(15);
|
$sales = VendorSales::where('vendor_id', $currentUser->id)->where('order_id', $data["order_id"])->with(['order.user', 'product'])->orderBy('id', 'DESC')->paginate(15);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return response()->json($sales, 200);
|
||||||
|
//return $this->helpers->apiArrayResponseBuilder(200, 'ok', [$orders]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function mySaleOrders(Request $request){
|
||||||
|
|
||||||
|
$currentUser = \JWTAuth::parseToken()->authenticate();
|
||||||
|
|
||||||
|
$sales = VendorSales::select('id', 'order_id', 'created_at', 'status')->where('vendor_id', $currentUser->id)->groupBy('order_id')->orderBy('id', 'DESC')->paginate(15);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -120,9 +146,9 @@ class OrderApiController extends Controller
|
||||||
$currentUser = \JWTAuth::parseToken()->authenticate();
|
$currentUser = \JWTAuth::parseToken()->authenticate();
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
|
|
||||||
$sales = VendorSales::where('vendor_id', $currentUser->id)->where('status', 'new')->groupBy('order_id')->get();
|
$sales = VendorSales::where('vendor_id', $currentUser->id)->where('status', 'new')->get();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$newOrders = array(
|
$newOrders = array(
|
||||||
"new_order_count" => count($sales),
|
"new_order_count" => count($sales),
|
||||||
|
|
|
||||||
|
|
@ -184,6 +184,7 @@ class ProductsAPIController extends Controller
|
||||||
->with([
|
->with([
|
||||||
'translations:locale,model_id,attribute_data',
|
'translations:locale,model_id,attribute_data',
|
||||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||||
|
'place'
|
||||||
])
|
])
|
||||||
->withCount(['comments as rating_avg' => function($query) {
|
->withCount(['comments as rating_avg' => function($query) {
|
||||||
$query->select(DB::raw('avg(rating)'));
|
$query->select(DB::raw('avg(rating)'));
|
||||||
|
|
@ -266,7 +267,7 @@ class ProductsAPIController extends Controller
|
||||||
$data = $this->Product::with([
|
$data = $this->Product::with([
|
||||||
'translations:locale,model_id,attribute_data',
|
'translations:locale,model_id,attribute_data',
|
||||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||||
'vendor:id,name,surname,email,username,logo,banner',
|
'vendor:id,name,surname,email,username,logo,banner,type',
|
||||||
'files', 'place',
|
'files', 'place',
|
||||||
])
|
])
|
||||||
//->withCount('comments')->withAvg('comments', 'rating')
|
//->withCount('comments')->withAvg('comments', 'rating')
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class TermsapiController extends Controller
|
||||||
$inputData = $request->all();
|
$inputData = $request->all();
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'type' => 'required|in:about,privacy'
|
'type' => 'required|in:about,privacy,success_prod_add'
|
||||||
];
|
];
|
||||||
|
|
||||||
$validator = Validator::make($inputData, $rules);
|
$validator = Validator::make($inputData, $rules);
|
||||||
|
|
@ -41,6 +41,10 @@ class TermsapiController extends Controller
|
||||||
case 'privacy':
|
case 'privacy':
|
||||||
$data = $this->Term::privacy()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
$data = $this->Term::privacy()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'success_prod_add':
|
||||||
|
$data = $this->Term::ProdAdd()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
# code...
|
# code...
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro
|
||||||
|
|
||||||
Route::post('make/order', 'OrderApiController@createOrder');
|
Route::post('make/order', 'OrderApiController@createOrder');
|
||||||
Route::get('my/orders', 'OrderApiController@myOrders');
|
Route::get('my/orders', 'OrderApiController@myOrders');
|
||||||
|
Route::get('vendor/sale/orders', 'OrderApiController@mySaleOrders');
|
||||||
Route::get('vendor/sales', 'OrderApiController@mySales');
|
Route::get('vendor/sales', 'OrderApiController@mySales');
|
||||||
Route::post('vendor/confirm/order', 'OrderApiController@confirmOrder');
|
Route::post('vendor/confirm/order', 'OrderApiController@confirmOrder');
|
||||||
Route::get('check/vendor/sales', 'OrderApiController@checkVendorSales');
|
Route::get('check/vendor/sales', 'OrderApiController@checkVendorSales');
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,9 @@ class Product extends Model
|
||||||
];
|
];
|
||||||
|
|
||||||
public $belongsTo = [
|
public $belongsTo = [
|
||||||
'place' => City::class,
|
//'place' => City::class,
|
||||||
'order_item' => OrderItems::class,
|
'order_item' => OrderItems::class,
|
||||||
//'measure' => ['TPS\Birzha\Models\Measure','key' => 'measure_id'],
|
'place' => ['TPS\Birzha\Models\City','key' => 'place_id'],
|
||||||
//'currency' => ['TPS\Birzha\Models\Currency'],
|
//'currency' => ['TPS\Birzha\Models\Currency'],
|
||||||
//'payment_term' => ['TPS\Birzha\Models\Term','key' => 'payment_term_id'],
|
//'payment_term' => ['TPS\Birzha\Models\Term','key' => 'payment_term_id'],
|
||||||
//'delivery_term' => ['TPS\Birzha\Models\Term','key' => 'delivery_term_id'],
|
//'delivery_term' => ['TPS\Birzha\Models\Term','key' => 'delivery_term_id'],
|
||||||
|
|
|
||||||
|
|
@ -41,4 +41,8 @@ class Term extends Model
|
||||||
public function scopePrivacy($query){
|
public function scopePrivacy($query){
|
||||||
return $query->where('type','privacy');
|
return $query->where('type','privacy');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeProdAdd($query){
|
||||||
|
return $query->where('type','success_prod_add');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ fields:
|
||||||
options:
|
options:
|
||||||
about: About
|
about: About
|
||||||
privacy: 'Privacy Policy'
|
privacy: 'Privacy Policy'
|
||||||
|
success_prod_add: 'Success prod Add'
|
||||||
span: auto
|
span: auto
|
||||||
required: 1
|
required: 1
|
||||||
type: balloon-selector
|
type: balloon-selector
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue