mirror of https://github.com/4xmen/xshop.git
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.
52 lines
1.8 KiB
PHTML
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';
|
||
|
$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';
|
||
|
$setting->save();
|
||
|
$setting = new Setting();
|
||
|
$setting->section = 'theme';
|
||
|
$setting->key = $part->area->name . '_' . $part->part.'_speed2';
|
||
|
$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';
|
||
|
$setting->save();
|
||
|
$setting = new Setting();
|
||
|
$setting->section = 'theme';
|
||
|
$setting->key = $part->area->name . '_' . $part->part.'_speed3';
|
||
|
$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';
|
||
|
$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();
|
||
|
}
|
||
|
public static function onMount(Part $part = null)
|
||
|
{
|
||
|
return $part;
|
||
|
}
|
||
|
}
|