You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and dots ('.'), can be up to 35 characters long. Letters must be lowercase.
 
 
 
 

39 lines
718 B

<?php
namespace App\Models;
use App\Utils\S3;
use Illuminate\Database\Eloquent\Model;
class Photo extends Model
{
protected $fillable = [
'name',
'path',
'uuid',
'user_id'
];
public function jsonSerialize():array
{
return [
'uuid' => $this->uuid,
'name' => $this->name,
'path' => $this->path,
'user' => $this->user,
'created_at' => date("d.m.Y", strtotime($this->created_at)),
];
}
public function user()
{
return $this->belongsTo(User::class);
}
public function albums()
{
return $this->belongsToMany(Album::class)->withTimestamps();
}
}