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/Newsroom.php

34 lines
624 B
PHTML

<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Newsroom extends Model
{
protected $table = 'newsroom';
7 months ago
protected $fillable = ['title'];
5 months ago
protected function casts(): array
{
return [
'published_at' => 'datetime',
];
}
public function permalink()
{
7 months ago
$year = $this->published_at->year;
$month = $this->published_at->format('m');
$slug = $this->slug;
7 months ago
return url("/site/newsroom/{$year}/{$month}/{$slug}");
}
public function editUrl()
{
return url("/i/admin/newsroom/edit/{$this->id}");
}
}