firstcommit

This commit is contained in:
2024-05-16 09:31:08 +05:45
commit 34d9672cb8
1396 changed files with 86482 additions and 0 deletions

View File

@ -0,0 +1,66 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
class AdminController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
return view('admin::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('admin::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
//
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('admin::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Repositories\CityRepository;
class CityController extends Controller
{
private $cityRepository;
public function __construct(CityRepository $cityRepository)
{
$this->cityRepository = $cityRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'City List';
$data['cityLists'] = $this->cityRepository->findAll();
return view('admin::cities.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create City';
$data['editable'] = false;
return view('admin::cities.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->cityRepository->create($request->all());
return redirect()->route('city.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::cities.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit City';
$data['editable'] = true;
$data['city'] = $this->cityRepository->getCityById($id);
return view('admin::cities.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->cityRepository->update($id, $request->all());
return redirect()->route('city.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Repositories\CountryRepository;
class CountryController extends Controller
{
private $countryRepository;
public function __construct(CountryRepository $countryRepository)
{
$this->countryRepository = $countryRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Country List';
$data['countryLists'] = $this->countryRepository->findAll();
return view('admin::countries.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Country';
$data['editable'] = false;
return view('admin::countries.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$this->countryRepository->create($request->all());
return redirect()->route('country.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::countries.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Country';
$data['editable'] = true;
$data['country'] = $this->countryRepository->getCountryById($id);
return view('admin::countries.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$this->countryRepository->update($id, $request->all());
return redirect()->route('country.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,108 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Repositories\DistrictRepository;
use Modules\Admin\Services\AdminService;
class DistrictController extends Controller
{
private $districtRepository;
private $adminService;
public function __construct(DistrictRepository $districtRepository, AdminService $adminService)
{
$this->districtRepository = $districtRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'District List';
$data['districtLists'] = $this->districtRepository->findAll();
return view('admin::districts.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create District';
$data['editable'] = false;
$data['provinceLists'] = $this->adminService->pluckProvinces();
return view('admin::districts.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->districtRepository->create($request->all());
toastr()->success('District created successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('district.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::districts.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit District';
$data['editable'] = true;
$data['district'] = $this->districtRepository->getDistrictById($id);
$data['provinceLists'] = $this->adminService->pluckProvinces();
return view('admin::districts.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->districtRepository->update($id, $request->all());
toastr()->success('District updated successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('district.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->districtRepository->delete($id);
toastr()->success('District deleted successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('district.index');
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\FieldInterface;
class DropdownController extends Controller
{
private $fieldRepository;
private $dropdownRepository;
public function __construct(FieldInterface $fieldRepository,
DropdownInterface $dropdownRepository) {
$this->fieldRepository = $fieldRepository;
$this->dropdownRepository = $dropdownRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Dropdown List';
$data['fields'] = $this->fieldRepository->findAll();
$data['fieldLists'] = $data['fields']->pluck('title', 'id');
return view('admin::dropdown.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('admin::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
// $inputData['status'] = $request->status ?? 10;
$this->dropdownRepository->create($inputData);
toastr()->success('Dropdown Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$dropdownModel = $this->dropdownRepository->getDropdownById($id);
$fieldLists = $this->fieldRepository->getList();
return response()->json([
'view' => view('admin::dropdown.edit', compact('dropdownModel', 'fieldLists'))->render(),
'status' => true,
]);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
$inputData = $request->except(['_method', '_token']);
try {
$inputData['status'] = $request->status ?? 10;
$this->dropdownRepository->update($id, $inputData);
toastr()->success('Dropdown Update Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->dropdownRepository->delete($id);
toastr()->success('Dropdown Deleted Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return response()->json([
'status' => true,
]);
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Modules\Admin\Repositories\DropdownInterface;
use Modules\Admin\Repositories\FieldInterface;
class FieldController extends Controller
{
private $fieldRepository;
private $dropdownRepository;
public function __construct(FieldInterface $fieldRepository,
DropdownInterface $dropdownRepository) {
$this->fieldRepository = $fieldRepository;
$this->dropdownRepository = $dropdownRepository;
}
/**
* Display a listing of the resource.
*/
public function index()
{
return view('admin::index');
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('admin::create');
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
$inputData = $request->all();
try {
$this->fieldRepository->create($inputData);
toastr()->success('Field Created Succesfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('dropdown.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
return view('admin::edit');
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
//
}
}

View File

@ -0,0 +1,108 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Repositories\MunicipalityRepository;
use Modules\Admin\Services\AdminService;
class MunicipalityController extends Controller
{
private $municipalityRepository;
private $adminService;
public function __construct(MunicipalityRepository $municipalityRepository, AdminService $adminService)
{
$this->municipalityRepository = $municipalityRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Municipality List';
$data['municipalityLists'] = $this->municipalityRepository->findAll();
return view('admin::municipalities.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Municipality';
$data['editable'] = false;
$data['districtLists'] = $this->adminService->pluckDistricts();
return view('admin::municipalities.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->municipalityRepository->create($request->all());
toastr()->success('Municipality created successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('municipality.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::municipalities.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Municipality';
$data['editable'] = true;
$data['municipality'] = $this->municipalityRepository->getMunicipalityById($id);
$data['districtLists'] = $this->adminService->pluckDistricts();
return view('admin::municipalities.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->municipalityRepository->update($id, $request->all());
toastr()->success('Municipality updated successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('municipality.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->municipalityRepository->delete($id);
toastr()->success('Municipality deleted successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('municipality.index');
}
}

View File

@ -0,0 +1,45 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class NotificationController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index(Request $request)
{
$data['notifications'] = auth()->user()->notifications;
return view('notification.index', $data);
}
public function markAsRead(Request $request)
{
$filterData = $request->all();
try {
$notification = auth()->user()->notifications()->where('id', $filterData['id'])->first();
if ($notification) {
$notification->markAsRead();
}
return redirect()->back()->withSuccess('Mark As Read');
} catch (\Throwable $th) {
return redirect()->back()->withError('Something Went Wrong!');
}
}
public function markAllAsRead(Request $request)
{
try {
foreach (auth()->user()->unreadNotifications as $notification) {
$notification->markAsRead();
}
return redirect()->back()->withSuccess('Mark All As Read');
} catch (\Throwable $th) {
//throw $th;
return redirect()->back()->withError('Something Went Wrong!');
}
}
}

View File

@ -0,0 +1,108 @@
<?php
namespace Modules\Admin\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Modules\Admin\Repositories\ProvinceRepository;
use Modules\Admin\Services\AdminService;
class ProvinceController extends Controller
{
private $provinceRepository;
private $adminService;
public function __construct(ProvinceRepository $provinceRepository, AdminService $adminService)
{
$this->provinceRepository = $provinceRepository;
$this->adminService = $adminService;
}
/**
* Display a listing of the resource.
*/
public function index()
{
$data['title'] = 'Province List';
$data['provinceLists'] = $this->provinceRepository->findAll();
return view('admin::provinces.index', $data);
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
$data['title'] = 'Create Province';
$data['editable'] = false;
$data['countryLists'] = $this->adminService->pluckCountries();
return view('admin::provinces.create', $data);
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request): RedirectResponse
{
try {
$this->provinceRepository->create($request->all());
toastr()->success('Province created successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('province.index');
}
/**
* Show the specified resource.
*/
public function show($id)
{
return view('admin::provinces.show');
}
/**
* Show the form for editing the specified resource.
*/
public function edit($id)
{
$data['title'] = 'Edit Province';
$data['editable'] = true;
$data['province'] = $this->provinceRepository->getProvinceById($id);
$data['countryLists'] = $this->adminService->pluckCountries();
return view('admin::provinces.edit', $data);
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, $id): RedirectResponse
{
try {
$this->provinceRepository->update($id, $request->all());
toastr()->success('Province updated successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('province.index');
}
/**
* Remove the specified resource from storage.
*/
public function destroy($id)
{
try {
$this->provinceRepository->delete($id);
toastr()->success('Province deleted successfully');
} catch (\Throwable $th) {
toastr()->error($th->getMessage());
}
return redirect()->route('province.index');
}
}

View File