from server api settings
This commit is contained in:
parent
2d0cc1d625
commit
c137c856aa
|
|
@ -69,15 +69,15 @@ class BlogPostsApiController extends Controller
|
|||
|
||||
}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([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram',
|
||||
'place',
|
||||
])->limit(10)->get();
|
||||
$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',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
'vendor:id,name,email,type,logo,banner,shop_title,slogan,is_instagram',
|
||||
])->limit(10)->get();
|
||||
// $modified->makeHidden(['created_at', 'updated_at', 'deleted_at']);
|
||||
$product_section = array(
|
||||
"type"=> "product_section",
|
||||
"header" => $dataq->sections[$i]->header,
|
||||
"contents"=> $modified
|
||||
);
|
||||
$contents = array_merge($contents, array($product_section));
|
||||
|
|
@ -292,7 +292,7 @@ class BlogPostsApiController extends Controller
|
|||
//$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){
|
||||
$q->with('translations:locale,model_id,attribute_data');
|
||||
}])
|
||||
|
|
|
|||
|
|
@ -103,9 +103,35 @@ class OrderApiController extends Controller
|
|||
|
||||
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();
|
||||
|
||||
$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();
|
||||
$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(
|
||||
"new_order_count" => count($sales),
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ class ProductsAPIController extends Controller
|
|||
->with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
'place'
|
||||
])
|
||||
->withCount(['comments as rating_avg' => function($query) {
|
||||
$query->select(DB::raw('avg(rating)'));
|
||||
|
|
@ -266,7 +267,7 @@ class ProductsAPIController extends Controller
|
|||
$data = $this->Product::with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'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',
|
||||
])
|
||||
//->withCount('comments')->withAvg('comments', 'rating')
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class TermsapiController extends Controller
|
|||
$inputData = $request->all();
|
||||
|
||||
$rules = [
|
||||
'type' => 'required|in:about,privacy'
|
||||
'type' => 'required|in:about,privacy,success_prod_add'
|
||||
];
|
||||
|
||||
$validator = Validator::make($inputData, $rules);
|
||||
|
|
@ -41,6 +41,10 @@ class TermsapiController extends Controller
|
|||
case 'privacy':
|
||||
$data = $this->Term::privacy()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
||||
break;
|
||||
|
||||
case 'success_prod_add':
|
||||
$data = $this->Term::ProdAdd()->with('translations:locale,model_id,attribute_data')->get()->toArray();
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro
|
|||
|
||||
Route::post('make/order', 'OrderApiController@createOrder');
|
||||
Route::get('my/orders', 'OrderApiController@myOrders');
|
||||
Route::get('vendor/sale/orders', 'OrderApiController@mySaleOrders');
|
||||
Route::get('vendor/sales', 'OrderApiController@mySales');
|
||||
Route::post('vendor/confirm/order', 'OrderApiController@confirmOrder');
|
||||
Route::get('check/vendor/sales', 'OrderApiController@checkVendorSales');
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ class Product extends Model
|
|||
];
|
||||
|
||||
public $belongsTo = [
|
||||
'place' => City::class,
|
||||
//'place' => City::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'],
|
||||
//'payment_term' => ['TPS\Birzha\Models\Term','key' => 'payment_term_id'],
|
||||
//'delivery_term' => ['TPS\Birzha\Models\Term','key' => 'delivery_term_id'],
|
||||
|
|
|
|||
|
|
@ -41,4 +41,8 @@ class Term extends Model
|
|||
public function scopePrivacy($query){
|
||||
return $query->where('type','privacy');
|
||||
}
|
||||
|
||||
public function scopeProdAdd($query){
|
||||
return $query->where('type','success_prod_add');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ fields:
|
|||
options:
|
||||
about: About
|
||||
privacy: 'Privacy Policy'
|
||||
success_prod_add: 'Success prod Add'
|
||||
span: auto
|
||||
required: 1
|
||||
type: balloon-selector
|
||||
|
|
|
|||
Loading…
Reference in New Issue