ProductInventorySet.php 830 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Model;
  3. use App\Scopes\TopDepartmentScope;
  4. use Illuminate\Database\Eloquent\Model;
  5. class ProductInventorySet extends Model
  6. {
  7. protected $guarded = [];
  8. protected $table = "depart_set"; //指定表
  9. const CREATED_AT = 'crt_time';
  10. const UPDATED_AT = 'upd_time';
  11. protected $dateFormat = 'U';
  12. const type_one = 1;//校验锁定
  13. const type_two = 2;//不校验锁定
  14. public static $user = [];
  15. public static $search = [];
  16. public function __construct(array $attributes = [])
  17. {
  18. if(! empty($attributes['userData'])) {
  19. self::$user = $attributes['userData'];
  20. self::$search = $attributes['search'];
  21. static::addGlobalScope(new TopDepartmentScope(self::$user, self::$search));
  22. }
  23. parent::__construct($attributes);
  24. }
  25. }