改版
This commit is contained in:
65
app/Models/Resume.php
Normal file
65
app/Models/Resume.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Traits\HasOneCover;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class Resume extends Model
|
||||
{
|
||||
use HasOneCover;
|
||||
|
||||
protected $casts = [
|
||||
'information' => 'json'
|
||||
];
|
||||
|
||||
/***
|
||||
* Notes: 所属分类
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2021/12/1 9:57
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function category(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 所属科室
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2021/12/1 9:58
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function group(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ResumeGroup::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 跳转链接
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2021/12/1 13:11
|
||||
* @return string
|
||||
*/
|
||||
public function getLinkAttribute(): string
|
||||
{
|
||||
return route('resume.show', $this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Notes: 获取基础数据
|
||||
*
|
||||
* @Author: 玄尘
|
||||
* @Date: 2021/12/1 13:11
|
||||
* @param $key
|
||||
* @param string $default
|
||||
*/
|
||||
public function getInformation($key, string $default = '')
|
||||
{
|
||||
return Arr::get($this->information, $key, $default);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user