You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/app/Models/Portfolio.php

51 lines
1.1 KiB
PHTML

<?php
namespace App\Models;
9 months ago
use App\Services\AccountService;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Portfolio extends Model
{
use HasFactory;
public $fillable = [
4 years ago
'profile_id',
'active',
'show_captions',
'show_license',
'show_location',
'show_timestamp',
'show_link',
'show_avatar',
'show_bio',
'profile_layout',
9 months ago
'profile_source',
];
7 months ago
protected function casts(): array
{
return [
'metadata' => 'json',
];
}
public function url($suffix = '')
{
$account = AccountService::get($this->profile_id);
9 months ago
if (! $account) {
return null;
}
9 months ago
return 'https://'.config('portfolio.domain').config('portfolio.path').'/'.$account['username'].$suffix;
}
public function permalink($suffix = '')
{
9 months ago
$account = AccountService::get($this->profile_id);
9 months ago
return config('app.url').'/account/portfolio/'.$account['username'].$suffix;
}
}