Job.php 610 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Repositories\Models\Base;
  3. use App\Repositories\Models\Model;
  4. class Job extends Model
  5. {
  6. /**
  7. * @var string
  8. */
  9. protected $table = 'base_jobs';
  10. /**
  11. * The attributes that are mass assignable.
  12. *
  13. * @var array
  14. */
  15. protected $guarded = [];
  16. /**
  17. * The attributes excluded from the model's JSON form.
  18. *
  19. * @var array
  20. */
  21. protected $hidden = [
  22. ];
  23. public static function checkCodeIsUnique($code, $ignore_id = 0)
  24. {
  25. return self::query()->where('code', $code)->where('id', '<>', $ignore_id)->exists();
  26. }
  27. }