kuvia/app/Models/Gallery.php

54 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2021-01-12 14:49:45 +00:00
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class Gallery extends Authenticatable
{
use HasFactory, Notifiable;
protected $table = "galleries";
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'url',
'description',
'tenant',
'gallery_create_time'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
];
public static function getByTenantAndUrl($tenant_id, $url) {
return Gallery::query()->where("tenant", "=", $tenant_id)->where("url", "=", $url)->first();
}
2021-02-08 00:15:18 +00:00
public function getTenant() {
$tenant = Tenant::query()->where("id", "=", $this->tenant)->firstOrFail();
return $tenant;
}
2021-01-12 14:49:45 +00:00
}