sarga/packages/Webkul/Tax/src/Repositories/TaxRateRepository.php

70 lines
1.3 KiB
PHP
Raw Normal View History

<?php
2018-10-11 14:25:59 +00:00
namespace Webkul\Tax\Repositories;
2022-01-11 08:50:24 +00:00
use Illuminate\Support\Facades\Event;
use Webkul\Core\Eloquent\Repository;
2018-10-15 10:39:09 +00:00
class TaxRateRepository extends Repository
{
/**
2022-01-11 08:50:24 +00:00
* Specify model class name.
*
* @return mixed
*/
2022-01-11 08:50:24 +00:00
public function model()
{
2022-01-11 08:50:24 +00:00
return \Webkul\Tax\Contracts\TaxRate::class;
}
2022-01-11 08:50:24 +00:00
/**
* Create.
*
* @param array $attributes
* @return mixed
*/
public function create(array $attributes)
{
Event::dispatch('tax.tax_rate.create.before');
$taxRate = parent::create($attributes);
Event::dispatch('tax.tax_rate.create.after', $taxRate);
return $taxRate;
}
/**
* Update.
*
* @param array $attributes
* @param $id
* @return mixed
*/
public function update(array $attributes, $id)
{
Event::dispatch('tax.tax_rate.update.before', $id);
$taxRate = parent::update($attributes, $id);
Event::dispatch('tax.tax_rate.update.after', $taxRate);
return $taxRate;
}
/**
* Delete.
*
* @param int $id
* @return bool
*/
public function delete($id)
{
Event::dispatch('tax.tax_rate.delete.before', $id);
parent::delete($id);
Event::dispatch('tax.tax_rate.delete.after', $id);
}
}