changes
This commit is contained in:
0
Modules/Setting/app/Repositories/.gitkeep
Normal file
0
Modules/Setting/app/Repositories/.gitkeep
Normal file
15
Modules/Setting/app/Repositories/SettingInterface.php
Normal file
15
Modules/Setting/app/Repositories/SettingInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Repositories;
|
||||
|
||||
interface SettingInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getSettingById($SettingId);
|
||||
public function getSettingByEmail($email);
|
||||
public function delete($SettingId);
|
||||
public function create($SettingDetails);
|
||||
public function update($SettingId, array $newDetails);
|
||||
public function pluck();
|
||||
|
||||
}
|
46
Modules/Setting/app/Repositories/SettingRepository.php
Normal file
46
Modules/Setting/app/Repositories/SettingRepository.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Setting\Repositories;
|
||||
|
||||
use Modules\Setting\Models\Setting;
|
||||
|
||||
class SettingRepository implements SettingInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Setting::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getSettingById($SettingId)
|
||||
{
|
||||
return Setting::findOrFail($SettingId);
|
||||
}
|
||||
|
||||
public function getSettingByEmail($email)
|
||||
{
|
||||
return Setting::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($SettingId)
|
||||
{
|
||||
Setting::destroy($SettingId);
|
||||
}
|
||||
|
||||
public function create($SettingDetails)
|
||||
{
|
||||
return Setting::create($SettingDetails);
|
||||
}
|
||||
|
||||
public function update($SettingId, array $newDetails)
|
||||
{
|
||||
return Setting::whereId($SettingId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Setting::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user