123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class Promotion extends Model
- {
- protected $appends = ['dead_line'];
- use SoftDeletes;
- protected $guarded=[];
- public function company()
- {
- return $this->belongsTo(Company::class, 'companyid');
- }
- public function job()
- {
- return $this->belongsTo(Jobs::class, 'jobid');
- }
- public function getDeadLineAttribute()
- {
- return date('Y-m-d', $this->starttime)."~".date('Y-m-d', $this->endtime);
- }
- public static function get($where)
- {
- if (Promotion::where($where)->first()) {
- return true;
- }
- return false;
- }
- }
|