InOutRecord.php 855 B

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