diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php index ffbd4f4..2947deb 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/BlogPostsApiController.php @@ -120,7 +120,7 @@ class BlogPostsApiController extends Controller // } $currentUser = \JWTAuth::parseToken()->authenticate(); - $comment = $this->Comment::where('user_id', $currentUser->id)->paginate(9); + $comment = $this->Comment::where('user_id', $currentUser->id)->with('product')->paginate(9); //dd($favourite); return response()->json($comment, 200); @@ -202,6 +202,7 @@ class BlogPostsApiController extends Controller { $data = Product::where('vendor_id', $id) ->with('categories:id,name') + ->with('vendor') ->with([ 'translations:locale,model_id,attribute_data', 'images:attachment_id,attachment_type,disk_name,file_name', @@ -228,7 +229,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', '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') ->with(['categories' => function($q){ $q->with('translations:locale,model_id,attribute_data'); }]) @@ -247,21 +248,21 @@ class BlogPostsApiController extends Controller { $data = $request->all(); - $dataAccounts = User::select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'description', 'map', 'banner', 'is_instagram') + $dataAccounts = User::select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'short_description', 'description', 'map', 'banner', 'is_instagram') ->with('categories:id,name,slug,icon') ->paginate(9); 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') + ->select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'short_description', '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') + ->select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'short_description', 'description', 'map', 'is_instagram') ->with('categories:id,name,slug,icon') ->paginate(9); diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/MessagesapiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/MessagesapiController.php index a8240d4..03c1789 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/MessagesapiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/MessagesapiController.php @@ -37,7 +37,7 @@ class MessagesapiController extends Controller * this is the message_partner with whom * $currentUser is chatting ('users.id', '!=', $currentUser->id) */ - $query->select(['users.id', 'username', 'name', 'surname', 'email']) + $query->select(['users.id', 'username', 'name', 'surname', 'email', 'logo', 'banner', 'short_description']) ->where('users.id', '!=', $currentUser->id); }, 'messages' => function ($query) { @@ -53,6 +53,8 @@ class MessagesapiController extends Controller return $chatroom; }); + + $chatrooms[0]->path = 'http://78.111.88.8:9086' . \Config::get('cms.storage.media.path'); // dump(\DB::getQueryLog()); // dd($this->helpers->apiArrayResponseBuilder(200, 'success', ['chatrooms' => $chatrooms])); diff --git a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php index 4fb2da8..88614c9 100644 --- a/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php +++ b/plugins/ahmadfatoni/apigenerator/controllers/api/ProductsApiController.php @@ -63,6 +63,29 @@ class ProductsAPIController extends Controller ->approved() ->orderBy('ends_at', $sortOrder); + if($seller && $categorySeller) { + + $category = Category::find($categorySeller); + if($category) { + $query = $category->products() + ->with('categories:id,name') + ->with([ + 'translations:locale,model_id,attribute_data', + 'images:attachment_id,attachment_type,disk_name,file_name', + ]) + ->withCount(['comments as rating_avg' => function($query) { + $query->select(DB::raw('avg(rating)')); + }]) + ->where('vendor_id', $seller) + ->approved() + ->orderBy('ends_at', $sortOrder); + } else { + $query = null; + } + + } + + if($categoryId) { // fetch offers by the category of the product $category = Category::find($categoryId); if($category) { diff --git a/plugins/rainlab/user/models/user/fields.yaml b/plugins/rainlab/user/models/user/fields.yaml index 1b7a81f..2234d54 100644 --- a/plugins/rainlab/user/models/user/fields.yaml +++ b/plugins/rainlab/user/models/user/fields.yaml @@ -113,6 +113,12 @@ tabs: size: huge type: richeditor tab: Gurlushyk + short_description: + label: 'Short desc' + span: auto + size: '' + type: textarea + tab: Gurlushyk categories: label: Relation nameFrom: name diff --git a/plugins/tps/birzha/models/OrderItems.php b/plugins/tps/birzha/models/OrderItems.php index 91f511d..f83c0db 100644 --- a/plugins/tps/birzha/models/OrderItems.php +++ b/plugins/tps/birzha/models/OrderItems.php @@ -21,6 +21,7 @@ class OrderItems extends Model public $belongsTo = [ 'order' => ['TPS\Birzha\Models\Orders', 'table' => 'tps_birzha_orders'], + 'product' => ['TPS\Birzha\Models\Product', 'table' => 'tps_birzha_products'], ]; /** diff --git a/plugins/tps/birzha/models/Product.php b/plugins/tps/birzha/models/Product.php index 0755090..a911605 100644 --- a/plugins/tps/birzha/models/Product.php +++ b/plugins/tps/birzha/models/Product.php @@ -6,6 +6,7 @@ use RainLab\User\Models\User; use Carbon\Carbon; use TPS\Birzha\Models\Settings; use TPS\Birzha\Models\City; +use TPS\Birzha\Models\OrderItems; /** * Model @@ -53,6 +54,7 @@ class Product extends Model public $belongsTo = [ 'place' => City::class, + 'order_item' => OrderItems::class, //'measure' => ['TPS\Birzha\Models\Measure','key' => 'measure_id'], //'currency' => ['TPS\Birzha\Models\Currency'], //'payment_term' => ['TPS\Birzha\Models\Term','key' => 'payment_term_id'], diff --git a/themes/gulushyk2/meta/static-pages.yaml b/themes/gulushyk2/meta/static-pages.yaml new file mode 100644 index 0000000..69beb95 --- /dev/null +++ b/themes/gulushyk2/meta/static-pages.yaml @@ -0,0 +1 @@ +static-pages: { }