first change
This commit is contained in:
0
Modules/Admin/app/Repositories/.gitkeep
Normal file
0
Modules/Admin/app/Repositories/.gitkeep
Normal file
35
Modules/Admin/app/Repositories/CalendarRepository.php
Normal file
35
Modules/Admin/app/Repositories/CalendarRepository.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Calendar;
|
||||
|
||||
|
||||
class CalendarRepository implements CalendarInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Calendar::get();
|
||||
}
|
||||
|
||||
public function getCalendarById($CalendarId)
|
||||
{
|
||||
return Calendar::findOrFail($CalendarId);
|
||||
}
|
||||
|
||||
public function delete($CalendarId)
|
||||
{
|
||||
Calendar::destroy($CalendarId);
|
||||
}
|
||||
|
||||
public function create(array $CalendarDetails)
|
||||
{
|
||||
return Calendar::create($CalendarDetails);
|
||||
}
|
||||
|
||||
public function update($CalendarId, array $newDetails)
|
||||
{
|
||||
return Calendar::where('id', $CalendarId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/CityInterface.php
Normal file
12
Modules/Admin/app/Repositories/CityInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface CityInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getCityById($cityId);
|
||||
public function delete($cityId);
|
||||
public function create(array $cityDetails);
|
||||
public function update($cityId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/CityRepository.php
Normal file
35
Modules/Admin/app/Repositories/CityRepository.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\City;
|
||||
|
||||
|
||||
class CityRepository implements CityInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return City::get();
|
||||
}
|
||||
|
||||
public function getCityById($cityId)
|
||||
{
|
||||
return City::findOrFail($cityId);
|
||||
}
|
||||
|
||||
public function delete($cityId)
|
||||
{
|
||||
City::destroy($cityId);
|
||||
}
|
||||
|
||||
public function create(array $cityDetails)
|
||||
{
|
||||
return City::create($cityDetails);
|
||||
}
|
||||
|
||||
public function update($cityId, array $newDetails)
|
||||
{
|
||||
return City::where('id', $cityId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
13
Modules/Admin/app/Repositories/CountryInterface.php
Normal file
13
Modules/Admin/app/Repositories/CountryInterface.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface CountryInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getCountryById($countryId);
|
||||
public function delete($countryId);
|
||||
public function create(array $countryDetails);
|
||||
public function update($countryId, array $newDetails);
|
||||
public function pluck();
|
||||
}
|
39
Modules/Admin/app/Repositories/CountryRepository.php
Normal file
39
Modules/Admin/app/Repositories/CountryRepository.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Country;
|
||||
|
||||
|
||||
class CountryRepository implements CountryInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Country::get();
|
||||
}
|
||||
|
||||
public function getCountryById($countryId)
|
||||
{
|
||||
return Country::findOrFail($countryId);
|
||||
}
|
||||
|
||||
public function delete($countryId)
|
||||
{
|
||||
Country::destroy($countryId);
|
||||
}
|
||||
|
||||
public function create(array $countryDetails)
|
||||
{
|
||||
return Country::create($countryDetails);
|
||||
}
|
||||
|
||||
public function update($countryId, array $newDetails)
|
||||
{
|
||||
return Country::where('id', $countryId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck(){
|
||||
return Country::pluck('name','id');
|
||||
}
|
||||
|
||||
}
|
13
Modules/Admin/app/Repositories/DepartmentInterface.php
Normal file
13
Modules/Admin/app/Repositories/DepartmentInterface.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface DepartmentInterface
|
||||
{
|
||||
public function pluck();
|
||||
public function findAll();
|
||||
public function getDepartmentById($departmentId);
|
||||
public function delete($departmentId);
|
||||
public function create(array $departmentDetails);
|
||||
public function update($departmentId, array $newDetails);
|
||||
}
|
46
Modules/Admin/app/Repositories/DepartmentRepository.php
Normal file
46
Modules/Admin/app/Repositories/DepartmentRepository.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Department;
|
||||
|
||||
|
||||
class DepartmentRepository implements DepartmentInterface
|
||||
{
|
||||
protected $model;
|
||||
|
||||
public function __construct(Department $model)
|
||||
{
|
||||
$this->model = $model;
|
||||
}
|
||||
|
||||
public function findAll()
|
||||
{
|
||||
return Department::get();
|
||||
}
|
||||
|
||||
public function getDepartmentById($departmentId)
|
||||
{
|
||||
return Department::findOrFail($departmentId);
|
||||
}
|
||||
|
||||
public function delete($departmentId)
|
||||
{
|
||||
Department::destroy($departmentId);
|
||||
}
|
||||
|
||||
public function create(array $departmentDetails)
|
||||
{
|
||||
return Department::create($departmentDetails);
|
||||
}
|
||||
|
||||
public function update($departmentId, array $newDetails)
|
||||
{
|
||||
return Department::where('department_id', $departmentId)->update($newDetails);
|
||||
}
|
||||
|
||||
|
||||
public function pluck(){
|
||||
return Department::pluck('name','id');
|
||||
}
|
||||
}
|
14
Modules/Admin/app/Repositories/DesignationInterface.php
Normal file
14
Modules/Admin/app/Repositories/DesignationInterface.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface DesignationInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getDesignationById($designationId);
|
||||
public function delete($designationId);
|
||||
public function create(array $designationDetails);
|
||||
public function update($designationId, array $newDetails);
|
||||
|
||||
public function pluck();
|
||||
}
|
39
Modules/Admin/app/Repositories/DesignationRepository.php
Normal file
39
Modules/Admin/app/Repositories/DesignationRepository.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Designation;
|
||||
|
||||
|
||||
class DesignationRepository implements DesignationInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Designation::get();
|
||||
}
|
||||
|
||||
public function getDesignationById($designationId)
|
||||
{
|
||||
return Designation::findOrFail($designationId);
|
||||
}
|
||||
|
||||
public function delete($designationId)
|
||||
{
|
||||
Designation::destroy($designationId);
|
||||
}
|
||||
|
||||
public function create(array $designationDetails)
|
||||
{
|
||||
return Designation::create($designationDetails);
|
||||
}
|
||||
|
||||
public function update($designationId, array $newDetails)
|
||||
{
|
||||
return Designation::where('designation_id', $designationId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck(){
|
||||
return Designation::pluck('name','id');
|
||||
}
|
||||
|
||||
}
|
13
Modules/Admin/app/Repositories/DistrictInterface.php
Normal file
13
Modules/Admin/app/Repositories/DistrictInterface.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface DistrictInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getDistrictById($districtId);
|
||||
public function delete($districtId);
|
||||
public function create(array $districtDetails);
|
||||
public function update($districtId, array $newDetails);
|
||||
public function pluck();
|
||||
}
|
37
Modules/Admin/app/Repositories/DistrictRepository.php
Normal file
37
Modules/Admin/app/Repositories/DistrictRepository.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\District;
|
||||
|
||||
|
||||
class DistrictRepository implements DistrictInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return District::get();
|
||||
}
|
||||
|
||||
public function getDistrictById($districtId)
|
||||
{
|
||||
return District::findOrFail($districtId);
|
||||
}
|
||||
|
||||
public function delete($districtId)
|
||||
{
|
||||
District::destroy($districtId);
|
||||
}
|
||||
|
||||
public function create(array $districtDetails)
|
||||
{
|
||||
return District::create($districtDetails);
|
||||
}
|
||||
|
||||
public function update($districtId, array $newDetails)
|
||||
{
|
||||
return District::where('id', $districtId)->update($newDetails);
|
||||
}
|
||||
public function pluck(){
|
||||
return District::pluck('name');
|
||||
}
|
||||
}
|
12
Modules/Admin/app/Repositories/DropdownInterface.php
Normal file
12
Modules/Admin/app/Repositories/DropdownInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface DropdownInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getDropdownById($DropdownId);
|
||||
public function delete($DropdownId);
|
||||
public function create(array $DropdownDetails);
|
||||
public function update($DropdownId, array $newDetails);
|
||||
}
|
34
Modules/Admin/app/Repositories/DropdownRepository.php
Normal file
34
Modules/Admin/app/Repositories/DropdownRepository.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Dropdown;
|
||||
|
||||
class DropdownRepository implements DropdownInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Dropdown::get();
|
||||
}
|
||||
|
||||
public function getDropdownById($DropdownId)
|
||||
{
|
||||
return Dropdown::findOrFail($DropdownId);
|
||||
}
|
||||
|
||||
public function delete($DropdownId)
|
||||
{
|
||||
Dropdown::destroy($DropdownId);
|
||||
}
|
||||
|
||||
public function create(array $DropdownDetails)
|
||||
{
|
||||
return Dropdown::create($DropdownDetails);
|
||||
}
|
||||
|
||||
public function update($DropdownId, array $newDetails)
|
||||
{
|
||||
return Dropdown::where('id', $DropdownId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/EventInterface.php
Normal file
12
Modules/Admin/app/Repositories/EventInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface EventInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getEventById($eventId);
|
||||
public function delete($eventId);
|
||||
public function create(array $eventDetails);
|
||||
public function update($eventId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/EventRepository.php
Normal file
35
Modules/Admin/app/Repositories/EventRepository.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Event;
|
||||
|
||||
|
||||
class EventRepository implements EventInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Event::get();
|
||||
}
|
||||
|
||||
public function getEventById($EventId)
|
||||
{
|
||||
return Event::findOrFail($EventId);
|
||||
}
|
||||
|
||||
public function delete($EventId)
|
||||
{
|
||||
Event::destroy($EventId);
|
||||
}
|
||||
|
||||
public function create(array $EventDetails)
|
||||
{
|
||||
return Event::create($EventDetails);
|
||||
}
|
||||
|
||||
public function update($EventId, array $newDetails)
|
||||
{
|
||||
return Event::where('id', $EventId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
14
Modules/Admin/app/Repositories/FieldInterface.php
Normal file
14
Modules/Admin/app/Repositories/FieldInterface.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface FieldInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getFieldById($FieldId);
|
||||
public function getList();
|
||||
public function getDropdownByAlias($alias);
|
||||
public function delete($FieldId);
|
||||
public function create(array $FieldDetails);
|
||||
public function update($FieldId, array $newDetails);
|
||||
}
|
48
Modules/Admin/app/Repositories/FieldRepository.php
Normal file
48
Modules/Admin/app/Repositories/FieldRepository.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Field;
|
||||
|
||||
class FieldRepository implements FieldInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Field::get();
|
||||
}
|
||||
|
||||
public function getFieldById($FieldId)
|
||||
{
|
||||
return Field::findOrFail($FieldId);
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return Field::pluck('title', 'id');
|
||||
}
|
||||
|
||||
public function getDropdownByAlias($alias)
|
||||
{
|
||||
$fieldModel = Field::where("alias", $alias)->first();
|
||||
if ($fieldModel) {
|
||||
return $fieldModel->dropdown()->pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function delete($FieldId)
|
||||
{
|
||||
Field::destroy($FieldId);
|
||||
}
|
||||
|
||||
public function create(array $FieldDetails)
|
||||
{
|
||||
return Field::create($FieldDetails);
|
||||
}
|
||||
|
||||
public function update($FieldId, array $newDetails)
|
||||
{
|
||||
return Field::where('id', $FieldId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
12
Modules/Admin/app/Repositories/MunicipalityInterface.php
Normal file
12
Modules/Admin/app/Repositories/MunicipalityInterface.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface MunicipalityInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getMunicipalityById($municipalityId);
|
||||
public function delete($municipalityId);
|
||||
public function create(array $municipalityDetails);
|
||||
public function update($municipalityId, array $newDetails);
|
||||
}
|
35
Modules/Admin/app/Repositories/MunicipalityRepository.php
Normal file
35
Modules/Admin/app/Repositories/MunicipalityRepository.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Municipality;
|
||||
|
||||
|
||||
class MunicipalityRepository implements MunicipalityInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Municipality::get();
|
||||
}
|
||||
|
||||
public function getMunicipalityById($municipalityId)
|
||||
{
|
||||
return Municipality::findOrFail($municipalityId);
|
||||
}
|
||||
|
||||
public function delete($municipalityId)
|
||||
{
|
||||
Municipality::destroy($municipalityId);
|
||||
}
|
||||
|
||||
public function create(array $municipalityDetails)
|
||||
{
|
||||
return Municipality::create($municipalityDetails);
|
||||
}
|
||||
|
||||
public function update($municipalityId, array $newDetails)
|
||||
{
|
||||
return Municipality::where('id', $municipalityId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
13
Modules/Admin/app/Repositories/ProvinceInterface.php
Normal file
13
Modules/Admin/app/Repositories/ProvinceInterface.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
interface ProvinceInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getProvinceById($provinceId);
|
||||
public function delete($provinceId);
|
||||
public function create(array $provinceDetails);
|
||||
public function update($provinceId, array $newDetails);
|
||||
public function pluck();
|
||||
}
|
39
Modules/Admin/app/Repositories/ProvinceRepository.php
Normal file
39
Modules/Admin/app/Repositories/ProvinceRepository.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Modules\Admin\Models\Province;
|
||||
|
||||
|
||||
class ProvinceRepository implements ProvinceInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Province::get();
|
||||
}
|
||||
|
||||
public function getProvinceById($provinceId)
|
||||
{
|
||||
return Province::findOrFail($provinceId);
|
||||
}
|
||||
|
||||
public function delete($provinceId)
|
||||
{
|
||||
Province::destroy($provinceId);
|
||||
}
|
||||
|
||||
public function create(array $provinceDetails)
|
||||
{
|
||||
return Province::create($provinceDetails);
|
||||
}
|
||||
|
||||
public function update($provinceId, array $newDetails)
|
||||
{
|
||||
return Province::where('id', $provinceId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck(){
|
||||
return Province::pluck('name', 'id');
|
||||
}
|
||||
|
||||
}
|
15
Modules/Admin/app/Repositories/SettingInterface.php
Normal file
15
Modules/Admin/app/Repositories/SettingInterface.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
interface SettingInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getSettingById($SettingId);
|
||||
public function getList();
|
||||
public function delete($SettingId);
|
||||
public function create(array $SettingDetails, Request $request);
|
||||
public function update($SettingId, array $newDetails);
|
||||
}
|
53
Modules/Admin/app/Repositories/SettingRepository.php
Normal file
53
Modules/Admin/app/Repositories/SettingRepository.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Repositories;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Admin\Models\Setting;
|
||||
|
||||
class SettingRepository implements SettingInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Setting::get()->mapWithKeys(function ($setting) {
|
||||
return [$setting->key => $setting->value];
|
||||
});
|
||||
}
|
||||
|
||||
public function getSettingById($SettingId)
|
||||
{
|
||||
return Setting::findOrFail($SettingId);
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
return Setting::pluck('title', 'id');
|
||||
}
|
||||
|
||||
public function delete($SettingId)
|
||||
{
|
||||
Setting::destroy($SettingId);
|
||||
}
|
||||
public function create(array $settingDetails, Request $request)
|
||||
{
|
||||
$thumbName = time() . '.' . $request->file('thumb')->extension();
|
||||
$logoName = uniqid() . '.' . $request->file('logo')->extension();
|
||||
|
||||
$request->thumb->move(public_path('images/setting'), $thumbName);
|
||||
$request->logo->move(public_path('images/setting'), $logoName);
|
||||
|
||||
$path = 'images/setting/';
|
||||
$settingDetails['logo'] = $path . $logoName;
|
||||
$settingDetails['thumb'] = $path . $thumbName;
|
||||
|
||||
// dd($settingDetails);
|
||||
return Setting::create($settingDetails);
|
||||
}
|
||||
|
||||
public function update($SettingId, $newDetails)
|
||||
{
|
||||
$setting = Setting::where('id', $SettingId);
|
||||
|
||||
$setting->update($newDetails);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user