1
0
Fork 0
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.

84 lines
1.7 KiB
PHP

<?php
namespace App\Observers;
use App\Models\Setting;
class settingObserver
{
public $afterCommit = true;
/**
* Handle the setting "created" event.
*
* @param \App\Setting $setting
* @return void
*/
// public function created(Setting $setting)
// {
// //
// }
/**
* Handle the setting "updated" event.
*
* @param \App\Setting $setting
* @return void
*/
// public function updated(Setting $setting)
// {
// //
// if ($setting->key == 'price'){
// $p = (float) str_replace(',','',$setting->value);
// if ($setting->value != $p){
// $setting->value = $p;
// $setting->save();
// return ;
// }
// $pros = Product::where('active',1)->get();
// foreach ($pros as $pro){
// if ($pro->getMeta('weight') != null){
// $np = (($p * (float) $pro->getMeta('weight')) /(100+7+9+15) )* 100;
// $pro->price = $np;
// $pro->save();
// }
// }
// }
// }
/**
* Handle the setting "deleted" event.
*
* @param \App\Setting $setting
* @return void
*/
public function deleted(Setting $setting)
{
//
}
/**
* Handle the setting "restored" event.
*
* @param \App\Setting $setting
* @return void
*/
public function restored(Setting $setting)
{
//
}
/**
* Handle the setting "force deleted" event.
*
* @param \App\Setting $setting
* @return void
*/
public function forceDeleted(Setting $setting)
{
//
}
}