mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update Profile model
This commit is contained in:
parent
c7a4adb8ad
commit
1cba67b781
1 changed files with 9 additions and 27 deletions
|
@ -2,27 +2,16 @@
|
|||
|
||||
namespace App;
|
||||
|
||||
use Auth, Cache, Storage;
|
||||
use App\Util\Lexer\PrettyNumber;
|
||||
use Auth;
|
||||
use Cache;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Storage;
|
||||
use Illuminate\Database\Eloquent\{Model, SoftDeletes};
|
||||
|
||||
class Profile extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
/**
|
||||
* The attributes that should be mutated to dates.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $dates = ['deleted_at'];
|
||||
protected $hidden = [
|
||||
'private_key',
|
||||
];
|
||||
|
||||
protected $hidden = ['private_key'];
|
||||
protected $visible = ['username', 'name'];
|
||||
|
||||
public function user()
|
||||
|
@ -30,26 +19,19 @@ class Profile extends Model
|
|||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function url($suffix = '')
|
||||
public function url($suffix = null)
|
||||
{
|
||||
if ($this->remote_url) {
|
||||
return $this->remote_url;
|
||||
} else {
|
||||
return url($this->username.$suffix);
|
||||
}
|
||||
return $this->remote_url ?? url($this->username . $suffix);
|
||||
}
|
||||
|
||||
public function localUrl($suffix = '')
|
||||
public function localUrl($suffix = null)
|
||||
{
|
||||
return url($this->username.$suffix);
|
||||
return url($this->username . $suffix);
|
||||
}
|
||||
|
||||
public function permalink($suffix = '')
|
||||
public function permalink($suffix = null)
|
||||
{
|
||||
if($this->remote_url) {
|
||||
return $this->remote_url;
|
||||
}
|
||||
return url('users/'.$this->username.$suffix);
|
||||
return $this->remote_url ?? url('users/' . $this->username . $suffix);
|
||||
}
|
||||
|
||||
public function emailUrl()
|
||||
|
|
Loading…
Reference in a new issue