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.
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Resources\Views\Segments;
|
|
|
|
|
|
|
|
use App\Models\Part;
|
|
|
|
use App\Models\Setting;
|
|
|
|
use Illuminate\Support\Facades\File;
|
|
|
|
|
|
|
|
class PreloaderImage
|
|
|
|
{
|
|
|
|
public static function onAdd(Part $part = null)
|
|
|
|
{
|
|
|
|
$setting = new Setting();
|
|
|
|
$setting->key = 'PreloaderImage_gif';
|
|
|
|
$setting->title = '';
|
|
|
|
$setting->type = 'FILE';
|
|
|
|
$setting->section = 'Theme';
|
|
|
|
$setting->save();
|
|
|
|
File::copy(__DIR__.'/assets/PreloaderImage.gif',public_path('upload/images/').'PreloaderImage.gif');
|
|
|
|
}
|
|
|
|
public static function onRemove(Part $part = null)
|
|
|
|
{
|
|
|
|
Setting::where('key','PreloaderImage_gif')->delete();
|
|
|
|
File::delete(public_path('upload/images/').'PreloaderImage.gif');
|
|
|
|
}
|
|
|
|
public static function onMount(Part $part = null)
|
|
|
|
{
|
|
|
|
return $part;
|
|
|
|
}
|
|
|
|
}
|