Browse Source
Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix
Merge branch 'phoenix' of http://120.24.33.109:11081/hyzjshwo/lanzu_api_hyperf into phoenix
# Conflicts: # app/Model/v3/GoodsActivity.php # config/autoload/dependencies.phpmaster
9 changed files with 92 additions and 89 deletions
-
6app/Controller/v3/GoodsRecommendController.php
-
4app/Controller/v3/HomeController.php
-
31app/Model/v3/Category.php
-
12app/Model/v3/Goods.php
-
25app/Model/v3/GoodsActivity.php
-
89app/Service/v3/Implementations/ActivityService.php
-
5app/Service/v3/Implementations/BannerService.php
-
8app/Service/v3/Implementations/CategoryService.php
-
1config/autoload/dependencies.php
@ -0,0 +1,31 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Model\v3; |
||||
|
|
||||
|
use App\Model\Model; |
||||
|
use Hyperf\Database\Model\Builder; |
||||
|
use Hyperf\Database\Model\SoftDeletes; |
||||
|
|
||||
|
class Category extends Model |
||||
|
{ |
||||
|
use SoftDeletes; |
||||
|
|
||||
|
protected $table = 'lanzu_category'; |
||||
|
|
||||
|
protected $appends = [ |
||||
|
'goods_types' |
||||
|
]; |
||||
|
|
||||
|
protected function boot(): void |
||||
|
{ |
||||
|
parent::boot(); |
||||
|
static::addGlobalScope('status', function (Builder $builder) { |
||||
|
$builder->where(['status' => 1])->orderBy('sort', 'desc'); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public function getGoodsTypesAttribute() |
||||
|
{ |
||||
|
return self::query()->where(['parent_id' => $this->attributes['id']])->orderBy('sort', 'desc')->get()->toArray(); |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue