StocksNew/Modules/Asset/app/Repositories/AssetRepository.php
Sampanna Rimal 53c0140f58 first commit
2024-08-27 17:48:06 +05:45

41 lines
760 B
PHP

<?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');
}
}