restore composer.json, add mysqli extension
This commit is contained in:
60
app/Models/SpecialOffer.php
Executable file
60
app/Models/SpecialOffer.php
Executable file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\LogOptionsTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Spatie\Activitylog\Traits\LogsActivity;
|
||||
|
||||
class SpecialOffer extends Model
|
||||
{
|
||||
use LogsActivity, LogOptionsTrait;
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'link',
|
||||
'image'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'name' => 'array',
|
||||
'description' => 'array'
|
||||
];
|
||||
|
||||
protected static $logName = 'special_offer';
|
||||
protected static $logOnlyDirty = true;
|
||||
protected static $submitEmptyLogs = false;
|
||||
protected static $logAttributes = [
|
||||
'name',
|
||||
'description',
|
||||
'link',
|
||||
'image'
|
||||
];
|
||||
|
||||
public function getName(): string
|
||||
{
|
||||
return (string) $this->name[app()->getLocale()] ?? null;
|
||||
}
|
||||
|
||||
public function getDescription(): string
|
||||
{
|
||||
return (string) $this->description[app()->getLocale()] ?? null;
|
||||
}
|
||||
|
||||
public function getImage(): string
|
||||
{
|
||||
if (!empty($this->image)) {
|
||||
if (in_array(env('FILESYSTEM_DISK'), ['s3', 'minio'])) {
|
||||
return Storage::temporaryUrl(
|
||||
$this->image, Date::now()->addMinutes(5)
|
||||
);
|
||||
}
|
||||
return (string) $this->image;
|
||||
}
|
||||
|
||||
return (string) 'images/nophoto.png';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user