StocksNew/Modules/Asset/app/Repositories/AssetRepository.php

41 lines
760 B
PHP
Raw Normal View History

2024-08-27 12:03:06 +00:00
<?php
namespace Modules\Asset\Repositories;
use Modules\Asset\Models\Asset;
class AssetRepository implements AssetInterface
{
public function findAll()
{
return Asset::get();
}
public function getAssetById($assetId)
{
return Asset::findOrFail($assetId);
}
public function delete($assetId)
{
Asset::destroy($assetId);
}
public function create(array $assetDetails)
{
return Asset::create($assetDetails);
}
public function update($assetId, array $newDetails)
{
return Asset::where('asset_id', $assetId)->update($newDetails);
}
public function pluckAvailable()
{
return Asset::where('is_available', 1)->pluck('name', 'asset_id');
}
}