123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace App\Http\Models;
- use App\Http\Traits\ModelBoost;
- use Illuminate\Database\Eloquent\Model;
- use Illuminate\Database\Eloquent\SoftDeletes;
- class Link extends Model
- {
- use SoftDeletes, ModelBoost;
- protected $table = 'links';
- protected $primaryKey = 'id';
- protected $guarded = [];
- public function getTypeTitleAttribute()
- {
- $typeList = array_column(self::TYPES, null, 'inx');
- return $typeList[$this->type ?? 0]['val'] ?? '';
- }
- const TYPES = [
- 1 => 'PDF',
- 2 => 'B2B',
- 3 => '书签',
- 4 => '一次性',
- 5 => '图片',
- 6 => 'SNS',
- 7 => '论坛',
- 8 => 'Blog',
- 9 => '信息页',
- 12 => '重点外链',
- ];
- }
|