42 lines
910 B
PHP
42 lines
910 B
PHP
<?php
|
|
|
|
namespace App\Services\Activity;
|
|
|
|
use App\Models\LivestockManure;
|
|
use App\Services\SigdCrudService;
|
|
use App\Models\ReferenceAr;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class LivestockManureService extends SigdCrudService
|
|
{
|
|
public function __construct(LivestockManure $model)
|
|
{
|
|
parent::__construct($model);
|
|
}
|
|
|
|
public function setAktif($id)
|
|
{
|
|
try {
|
|
DB::beginTransaction();
|
|
|
|
LivestockManure::query()->update([
|
|
'active_status' => 0,
|
|
'updated_by' => Auth::user()->name
|
|
]);
|
|
|
|
$lm = LivestockManure::find($id);
|
|
if ($lm) {
|
|
$this->update($lm, ['active_status' => 1]);
|
|
}
|
|
|
|
DB::commit();
|
|
|
|
return $lm;
|
|
} catch (\Exception $e) {
|
|
DB::rollBack();
|
|
throw $e;
|
|
}
|
|
}
|
|
}
|