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.
37 lines
805 B
37 lines
805 B
<?php
|
|
|
|
namespace App\Entities\Projects;
|
|
|
|
use App\Entities\Users\User;
|
|
use App\Entities\Projects\Project;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Issue extends Model
|
|
{
|
|
protected $fillable = ['project_id', 'title', 'body', 'pic_id', 'creator_id'];
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function pic()
|
|
{
|
|
return $this->belongsTo(User::class)->withDefault(['name' => __('issue.no_pic')]);
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function getStatusAttribute()
|
|
{
|
|
return IssueStatus::getNameById($this->status_id);
|
|
}
|
|
|
|
public function getStatusLabelAttribute()
|
|
{
|
|
return '<span class="badge">'.$this->status.'</span>';
|
|
}
|
|
}
|