Site.php 614 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Factories\HasFactory;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. use DateTimeInterface;
  7. class Site extends Model
  8. {
  9. use HasFactory;
  10. use SoftDeletes;
  11. protected $table='sites';
  12. protected $appends= ['limit_role_arr'];
  13. protected function serializeDate(DateTimeInterface $date)
  14. {
  15. return $date->format('Y-m-d H:i:s');
  16. }
  17. public function getLimitRoleArrAttribute()
  18. {
  19. $role= trim($this->attributes['limit_role'],',');
  20. return explode(',', $role);
  21. }
  22. }