mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-14 02:24:31 +00:00
30 lines
557 B
PHP
30 lines
557 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Newsroom extends Model
|
|
{
|
|
protected $table = 'newsroom';
|
|
protected $fillable = ['title'];
|
|
|
|
protected $casts = [
|
|
'published_at' => 'datetime'
|
|
];
|
|
|
|
public function permalink()
|
|
{
|
|
$year = $this->published_at->year;
|
|
$month = $this->published_at->format('m');
|
|
$slug = $this->slug;
|
|
|
|
return url("/site/newsroom/{$year}/{$month}/{$slug}");
|
|
}
|
|
|
|
public function editUrl()
|
|
{
|
|
return url("/i/admin/newsroom/edit/{$this->id}");
|
|
}
|
|
}
|