海南旅游SAAS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
500 B

  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. class AgentSetting extends BaseModel
  5. {
  6. use HasFactory;
  7. protected $fillable = ['agent_id', 'setting'];
  8. public function __construct(array $attributes = [])
  9. {
  10. parent::__construct($attributes);
  11. $this->timestamps = false;
  12. }
  13. public function scopeVal($query, $agent_id, $key)
  14. {
  15. $setting = json_decode($query->where('agent_id', $agent_id)->value('setting'), true);
  16. return $setting[$key] ?? null;
  17. }
  18. }