first commit
This commit is contained in:
0
Modules/Asset/app/Repositories/.gitkeep
Normal file
0
Modules/Asset/app/Repositories/.gitkeep
Normal file
13
Modules/Asset/app/Repositories/AssetCategoryInterface.php
Normal file
13
Modules/Asset/app/Repositories/AssetCategoryInterface.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Asset\Repositories;
|
||||
|
||||
interface AssetCategoryInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function pluck();
|
||||
public function getAssetCategoryById($assetCategoryId);
|
||||
public function delete($assetCategoryId);
|
||||
public function create(array $assetCategoryDetails);
|
||||
public function update($assetCategoryId, array $newDetails);
|
||||
}
|
39
Modules/Asset/app/Repositories/AssetCategoryRepository.php
Normal file
39
Modules/Asset/app/Repositories/AssetCategoryRepository.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Asset\Repositories;
|
||||
|
||||
use Modules\Asset\Models\AssetCategory;
|
||||
|
||||
|
||||
class AssetCategoryRepository implements AssetCategoryInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return AssetCategory::get();
|
||||
}
|
||||
|
||||
public function getAssetCategoryById($assetCategoryId)
|
||||
{
|
||||
return AssetCategory::findOrFail($assetCategoryId);
|
||||
}
|
||||
|
||||
public function delete($assetCategoryId)
|
||||
{
|
||||
AssetCategory::destroy($assetCategoryId);
|
||||
}
|
||||
|
||||
public function create(array $assetCategoryDetails)
|
||||
{
|
||||
return AssetCategory::create($assetCategoryDetails);
|
||||
}
|
||||
|
||||
public function update($assetCategoryId, array $newDetails)
|
||||
{
|
||||
return AssetCategory::where('asset_category_id', $assetCategoryId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck(){
|
||||
return AssetCategory::pluck('name','asset_category_id');
|
||||
}
|
||||
|
||||
}
|
12
Modules/Asset/app/Repositories/AssetDemandInterface.php
Normal file
12
Modules/Asset/app/Repositories/AssetDemandInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Asset\Repositories;
|
||||
|
||||
interface AssetDemandInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getAssetDemandById($assetDemandId);
|
||||
public function delete($assetDemandId);
|
||||
public function create(array $assetDemandDetails);
|
||||
public function update($assetDemandId, array $newDetails);
|
||||
}
|
36
Modules/Asset/app/Repositories/AssetDemandRepository.php
Normal file
36
Modules/Asset/app/Repositories/AssetDemandRepository.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Asset\Repositories;
|
||||
|
||||
use Modules\Asset\Models\AssetDemand;
|
||||
use Modules\Asset\Repositories\AssetDemandInterface;
|
||||
|
||||
|
||||
class AssetDemandRepository implements AssetDemandInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return AssetDemand::get();
|
||||
}
|
||||
|
||||
public function getAssetDemandById($assetDemandId)
|
||||
{
|
||||
return AssetDemand::findOrFail($assetDemandId);
|
||||
}
|
||||
|
||||
public function delete($assetDemandId)
|
||||
{
|
||||
AssetDemand::destroy($assetDemandId);
|
||||
}
|
||||
|
||||
public function create(array $assetDemandDetails)
|
||||
{
|
||||
return AssetDemand::create($assetDemandDetails);
|
||||
}
|
||||
|
||||
public function update($assetDemandId, array $newDetails)
|
||||
{
|
||||
return AssetDemand::where('id', $assetDemandId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
13
Modules/Asset/app/Repositories/AssetInterface.php
Normal file
13
Modules/Asset/app/Repositories/AssetInterface.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Asset\Repositories;
|
||||
|
||||
interface AssetInterface
|
||||
{
|
||||
public function pluckAvailable();
|
||||
public function findAll();
|
||||
public function getAssetById($assetId);
|
||||
public function delete($assetId);
|
||||
public function create(array $assetDetails);
|
||||
public function update($assetId, array $newDetails);
|
||||
}
|
40
Modules/Asset/app/Repositories/AssetRepository.php
Normal file
40
Modules/Asset/app/Repositories/AssetRepository.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user