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.
xshop/resources/views/segments/footer/WaveFooter/WaveFooter.php

52 lines
1.8 KiB
PHTML

4 months ago
<?php
namespace Resources\Views\Segments;
use App\Models\Part;
use App\Models\Setting;
class WaveFooter
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area_name . '_' . $part->part.'_speed';
4 months ago
$setting->value = 2;
$setting->size = 4;
$setting->type = 'NUMBER';
$setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area_name . ' ' . $part->part. ' speed wave 1';
4 months ago
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area_name . '_' . $part->part.'_speed2';
4 months ago
$setting->value = 6;
$setting->size = 4;
$setting->type = 'NUMBER';
$setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area_name . ' ' . $part->part. ' speed wave 2';
4 months ago
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area_name . '_' . $part->part.'_speed3';
4 months ago
$setting->value = 4;
$setting->size = 4;
$setting->type = 'NUMBER';
$setting->data = json_encode(['xmin' => 2, 'xmax' => 90]);
$setting->title = $part->area_name . ' ' . $part->part. ' speed wave 3';
4 months ago
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area_name . '_' . $part->part.'_speed')->first()?->delete();
Setting::where('key',$part->area_name . '_' . $part->part.'_speed2')->first()?->delete();
Setting::where('key',$part->area_name . '_' . $part->part.'_speed3')->first()?->delete();
4 months ago
}
public static function onMount(Part $part = null)
{
return $part;
}
}