api code global jain
This commit is contained in:
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
||||
54
.env.example
Normal file
54
.env.example
Normal file
@@ -0,0 +1,54 @@
|
||||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=https://globaljain.net
|
||||
ADMIN_APP_URL=
|
||||
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=global_jain
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DRIVER=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailhog
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS=null
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
||||
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
* text=auto
|
||||
*.css linguist-vendored
|
||||
*.scss linguist-vendored
|
||||
*.js linguist-vendored
|
||||
CHANGELOG.md export-ignore
|
||||
17
.gitignore
vendored
Normal file
17
.gitignore
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.phpunit.result.cache
|
||||
docker-compose.override.yml
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.idea
|
||||
/.vscode
|
||||
/public/.well-known/server_key.json
|
||||
/public/robots.txt
|
||||
28
.htaccess
Normal file
28
.htaccess
Normal file
@@ -0,0 +1,28 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
# ✅ Redirect to HTTPS (no typo, correct domain)
|
||||
RewriteCond %{HTTPS} off
|
||||
RewriteRule ^(.*)$ https://lightyellow-mule-306456.hostingersite.com%{REQUEST_URI} [L,R=301]
|
||||
|
||||
# ✅ Handle Laravel front controller
|
||||
RewriteRule ^$ public/index.php [L]
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^ public/index.php [L]
|
||||
</IfModule>
|
||||
|
||||
# Disable directory listing
|
||||
Options -Indexes
|
||||
|
||||
# Block hidden files and folders (.env, .git, etc.)
|
||||
<FilesMatch "^\.">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
|
||||
# Block specific sensitive files
|
||||
<FilesMatch "(artisan|composer\.json|composer\.lock|env|\.gitignore|\.gitattributes|\.env\.example)">
|
||||
Order allow,deny
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
14
.styleci.yml
Normal file
14
.styleci.yml
Normal file
@@ -0,0 +1,14 @@
|
||||
php:
|
||||
preset: laravel
|
||||
version: 8
|
||||
disabled:
|
||||
- no_unused_imports
|
||||
finder:
|
||||
not-name:
|
||||
- index.php
|
||||
- server.php
|
||||
js:
|
||||
finder:
|
||||
not-name:
|
||||
- webpack.mix.js
|
||||
css: true
|
||||
BIN
1global_jain_prod.zip
Normal file
BIN
1global_jain_prod.zip
Normal file
Binary file not shown.
47
README.md
Normal file
47
README.md
Normal file
@@ -0,0 +1,47 @@
|
||||
<p align="center"><img src="https://globaljain.net/images/web/global-jain-logo.svg" width="50%" alt="Logo Global Jain"></p>
|
||||
|
||||
## About Global Jain
|
||||
|
||||
World's first and largest religious Social Networking Platform for JAIN Community.
|
||||
|
||||
## Install
|
||||
|
||||
You can create new Laravel project using git clone
|
||||
|
||||
git clone https://github.com/global-jain/api.git
|
||||
|
||||
After the project is created run the following commands
|
||||
|
||||
cd api
|
||||
|
||||
Fetch the all code from remote branches to local branches
|
||||
|
||||
git fetch --all
|
||||
|
||||
Install the dependencies using composer
|
||||
|
||||
composer install
|
||||
|
||||
Copy the environment from .env.example to .env and add database connection
|
||||
|
||||
copy .env.example .env
|
||||
|
||||
Then generate application key
|
||||
|
||||
php artisan key:generate
|
||||
|
||||
Then create storage link
|
||||
|
||||
php artisan storage:link
|
||||
|
||||
Then run the migrations
|
||||
|
||||
php artisan migrate:fresh
|
||||
|
||||
Start the local development server
|
||||
|
||||
php artisan serve
|
||||
|
||||
You can now access the server at http://localhost:8000
|
||||
|
||||
Or You can create virtual host and execute the project in your local system.
|
||||
60
app/Console/Commands/AddProfileCompletionPercentage.php
Normal file
60
app/Console/Commands/AddProfileCompletionPercentage.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Exception;
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AddProfileCompletionPercentage extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'add:profile-percentage';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Counts & adds profile completion percentage';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$users = User::with('userDetail', 'userWorkDetail', 'userQualification')->get();
|
||||
|
||||
if ($users) {
|
||||
foreach ($users as $user) {
|
||||
$userProfileCompletion = calculateActivity($user->toArray());
|
||||
$user['profile_statistics'] = $userProfileCompletion;
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->info(trans(__('Command executed successfully!')));
|
||||
|
||||
} catch(Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
60
app/Console/Commands/AddSantProfileCompletionPercentage.php
Normal file
60
app/Console/Commands/AddSantProfileCompletionPercentage.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Sant;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AddSantProfileCompletionPercentage extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'add:sant-profile-percentage';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Counts & adds sant profile completion percentage';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$sants = Sant::get();
|
||||
|
||||
if ($sants) {
|
||||
foreach ($sants as $sant) {
|
||||
$santProfileCompletion = calculateSantActivity($sant->toArray());
|
||||
$sant['profile_statistics'] = $santProfileCompletion;
|
||||
$sant->save();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->info(trans(__('Command executed successfully!')));
|
||||
|
||||
} catch(Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
126
app/Console/Commands/ReplaceVihaarEndLocation.php
Normal file
126
app/Console/Commands/ReplaceVihaarEndLocation.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Sant;
|
||||
use App\Constant\Constant;
|
||||
use App\Models\ThanaMember;
|
||||
use App\Models\SantLocation;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ReplaceVihaarEndLocation extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'check:vihaar';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'It checks if vihaar is ended and replace sant\'s location';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
try {
|
||||
$sants = Sant::with([
|
||||
'location.createdBy:id,name,avatar',
|
||||
'location.updatedBy:id,name,avatar',
|
||||
])->get()->toArray();
|
||||
|
||||
foreach ($sants as $sant) {
|
||||
$thanaID = Constant::NULL;
|
||||
$thanaSantID = [];
|
||||
|
||||
$thanaID = ThanaMember::where('sant_id', $sant['id'])->value('thana_id');
|
||||
$thanaSantID = ThanaMember::where('thana_id', $thanaID)->pluck('sant_id');
|
||||
|
||||
if (!empty($sant['location'])) {
|
||||
// $santLocation = SantLocation::find($sant['location']['sant_id']);
|
||||
$santLocation = SantLocation::where('sant_id', $sant['location']['sant_id'])->first();
|
||||
|
||||
if (empty($santLocation)) {
|
||||
if (!empty($thanaSantID) && count($thanaSantID) > 0) {
|
||||
foreach ($thanaSantID as $santID) {
|
||||
SantLocation::create([
|
||||
'sant_id' => $santID,
|
||||
'sangh_id' => Constant::NULL,
|
||||
'type' => isset($sant['location']['to_sangh_id']) ? Constant::STATUS_TWO : Constant::STATUS_ONE,
|
||||
'location' => $sant['location']['to'],
|
||||
'latitude' => $sant['location']['to_latitude'],
|
||||
'longitude' => $sant['location']['to_longitude'],
|
||||
'created_by' => $sant['location']['created_by']['id'] ?? Constant::NULL,
|
||||
'updated_by' => Constant::NULL,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
SantLocation::create([
|
||||
'sant_id' => $sant['id'] ?? Constant::NULL,
|
||||
'sangh_id' => Constant::NULL,
|
||||
'type' => isset($sant['location']['to_sangh_id']) ? Constant::STATUS_TWO : Constant::STATUS_ONE,
|
||||
'location' => $sant['location']['to'],
|
||||
'latitude' => $sant['location']['to_latitude'],
|
||||
'longitude' => $sant['location']['to_longitude'],
|
||||
'created_by' => $sant['location']['created_by']['id'] ?? Constant::NULL,
|
||||
'updated_by' => Constant::NULL,
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
if (!empty($thanaSantID) && count($thanaSantID) > 0) {
|
||||
foreach ($thanaSantID as $santID) {
|
||||
if ($santID == $santLocation->sant_id) {
|
||||
$santLocation->update([
|
||||
'sant_id' => $santID,
|
||||
'sangh_id' => Constant::NULL,
|
||||
'type' => $santLocation->type,
|
||||
'location' => $sant['location']['to'] ?? $santLocation->location,
|
||||
'latitude' => $sant['location']['to_latitude'] ?? $santLocation->latitude,
|
||||
'longitude' => $sant['location']['to_longitude'] ?? $santLocation->longitude,
|
||||
'created_by' => $santLocation->created_by ?? Constant::NULL,
|
||||
'updated_by' => $sant['location']['created_by']['id'] ?? Constant::NULL,
|
||||
]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$santLocation->update([
|
||||
'sant_id' => $sant['id'] ?? $santLocation->sant_id,
|
||||
'sangh_id' => Constant::NULL,
|
||||
'type' => $santLocation->type,
|
||||
'location' => $sant['location']['to'] ?? $santLocation->location,
|
||||
'latitude' => $sant['location']['to_latitude'] ?? $santLocation->latitude,
|
||||
'longitude' => $sant['location']['to_longitude'] ?? $santLocation->longitude,
|
||||
'created_by' => $santLocation->created_by ?? Constant::NULL,
|
||||
'updated_by' => $sant['location']['created_by']['id'] ?? Constant::NULL,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->info(trans(__('Command executed successfully!')));
|
||||
|
||||
} catch(Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
45
app/Console/Commands/SendMemberIDNotification.php
Normal file
45
app/Console/Commands/SendMemberIDNotification.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Jobs\SendGenerateMemberID;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SendMemberIDNotification extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'generate:memberid';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Generate your member ID';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
dispatch(new SendGenerateMemberID());
|
||||
$this->info('Notification generate memberID dispatched successfully!');
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
43
app/Console/Commands/SendNewAppNotification.php
Normal file
43
app/Console/Commands/SendNewAppNotification.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Jobs\Notifications\NewApp\SendDownloadNewApp;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class SendNewAppNotification extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'download:new-app';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
dispatch(new SendDownloadNewApp());
|
||||
}
|
||||
}
|
||||
57
app/Console/Commands/memberIdGenerate.php
Normal file
57
app/Console/Commands/memberIdGenerate.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\SanghMember;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class memberIdGenerate extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'add:member-id';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Add member id to sangh member table';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$membersGroupedBySangh = SanghMember::orderBy('id')->get()->groupBy('sangh_id');
|
||||
|
||||
foreach ($membersGroupedBySangh as $sanghId => $members) {
|
||||
$counter = 1;
|
||||
|
||||
foreach ($members as $member) {
|
||||
$newMemberId = str_pad($counter, 4, '0', STR_PAD_LEFT);
|
||||
$member->update(['member_id' => $newMemberId]);
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Member IDs added to columns successfully.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
45
app/Console/Kernel.php
Normal file
45
app/Console/Kernel.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use App\Console\Commands\ReplaceVihaarEndLocation;
|
||||
use App\Console\Commands\AddProfileCompletionPercentage;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use App\Console\Commands\AddSantProfileCompletionPercentage;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
protected $commands = [
|
||||
ReplaceVihaarEndLocation::class,
|
||||
AddProfileCompletionPercentage::class,
|
||||
AddSantProfileCompletionPercentage::class
|
||||
];
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
$schedule->command('telescope:clear')->daily();
|
||||
$schedule->command('check:vihaar')->hourly();
|
||||
$schedule->command('download:new-app')->twiceDaily(9, 20);
|
||||
$schedule->command('generate:memberid')->sundays()->at('10:00');
|
||||
// $schedule->command('generate:memberid')->everyFiveMinutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
||||
114
app/Constant/Constant.php
Normal file
114
app/Constant/Constant.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Constant;
|
||||
|
||||
/**
|
||||
* Class Constants
|
||||
* @package App\Constants
|
||||
*/
|
||||
class Constant
|
||||
{
|
||||
/**
|
||||
* Boolean status code
|
||||
*/
|
||||
public const STATUS_ZERO = 0;
|
||||
public const STATUS_ONE = 1;
|
||||
public const STATUS_TWO = 2;
|
||||
public const STATUS_THREE = 3;
|
||||
public const STATUS_FOUR = 4;
|
||||
public const STATUS_FIVE = 5;
|
||||
public const STATUS_SIX = 6;
|
||||
public const STATUS_TRUE = true;
|
||||
public const STATUS_FALSE = false;
|
||||
public const NULL = null;
|
||||
public const JOB_TRIES = 3;
|
||||
public const PAGINATE_LIMIT = 10;
|
||||
|
||||
public const MALE = 1;
|
||||
public const FEMALE = 2;
|
||||
|
||||
public const USER_RELATION = 1;
|
||||
public const SANT_RELATION = 2;
|
||||
|
||||
public const POST_DRAFT = 1;
|
||||
public const POST_PUBLISH = 2;
|
||||
|
||||
public const OTP ='OTP';
|
||||
public const PASSWORD = 'PASSWORD';
|
||||
public const POST_TYPE_USER = 1;
|
||||
public const POST_TYPE_SANT = 2;
|
||||
public const POST_TYPE_SANGH = 3;
|
||||
|
||||
|
||||
/**
|
||||
* Entity Status
|
||||
*/
|
||||
public const STATUS_ACTIVE = 'active';
|
||||
public const STATUS_INACTIVE = 'inactive';
|
||||
public const STATUS_CREATE = 'create';
|
||||
public const STATUS_UPDATE = 'update';
|
||||
public const STATUS_DELETE = 'delete';
|
||||
public const STATUS_ALL = 'all';
|
||||
|
||||
/**
|
||||
* Typographical Symbols
|
||||
*/
|
||||
public const BACK_SLASH = '\\';
|
||||
public const SLASH = '/';
|
||||
public const UNDERSCORE = '_';
|
||||
public const HYPHEN = '-';
|
||||
public const AT_SIGN = '@';
|
||||
public const SPACE = ' ';
|
||||
|
||||
/**
|
||||
* Error Codes
|
||||
*/
|
||||
public const CODE_200 = 200;
|
||||
public const CODE_401 = 401;
|
||||
public const CODE_403 = 403;
|
||||
public const CODE_404 = 404;
|
||||
public const CODE_422 = 422;
|
||||
public const CODE_500 = 500;
|
||||
public const CODE_409 = 409;
|
||||
|
||||
/**
|
||||
* Privacy
|
||||
*/
|
||||
public const PRIVACY_PUBLIC = 'Public';
|
||||
public const PRIVACY_FRIENDS = 'Friends';
|
||||
public const PRIVACY_ONLY_ME = 'Only Me';
|
||||
|
||||
/**
|
||||
* Date format
|
||||
*/
|
||||
public const DATE_FORMAT = 'd-m-Y';
|
||||
public const DATE_TIME_FORMAT = 'Y-m-d H:i:s';
|
||||
public const TIME_FORMAT = 'H:i:s';
|
||||
|
||||
/**
|
||||
* Roles Name
|
||||
*/
|
||||
public const ADMIN = 'Admin';
|
||||
public const CORE_COMMITTEE = 'Core Committee';
|
||||
public const SHRAVAK = 'Shravak';
|
||||
public const SANT = 'Sant';
|
||||
|
||||
/**
|
||||
* Permission Types & Guards
|
||||
*/
|
||||
public const TYPE_WEB = '1';
|
||||
public const TYPE_ADMIN = '2';
|
||||
public const GUARD_WEB = 'web';
|
||||
public const GUARD_ADMIN = 'admin';
|
||||
|
||||
/**
|
||||
* Image upload file path
|
||||
*/
|
||||
public const SANT_IMAGE_UPLOAD_PATH = 'images/sants/';
|
||||
public const USER_IMAGE_UPLOAD_PATH = 'images/users/';
|
||||
public const SANGH_IMAGE_UPLOAD_PATH = 'images/sanghs/';
|
||||
public const SANGH_MEMBER_IMAGE_UPLOAD_PATH = 'images/sangh-member/';
|
||||
public const POST_IMAGE_UPLOAD_PATH = 'images/posts/';
|
||||
public const HOSPITAL_IMAGE_UPLOAD_PATH = 'images/hospitals/';
|
||||
public const USER_CERTIFICATES_UPLOAD_PATH = 'images/users/certificates/';
|
||||
}
|
||||
37
app/Events/Report.php
Normal file
37
app/Events/Report.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class Report
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $user;
|
||||
public $type;
|
||||
public $reportedFor;
|
||||
public $reportSubject;
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* Report constructor.
|
||||
* @param $user
|
||||
* @param $type
|
||||
* @param $reportedFor
|
||||
* @param $reportSubject
|
||||
* @param $description
|
||||
*
|
||||
*/
|
||||
public function __construct($user, $type, $reportedFor, $reportSubject, $description)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->type = $type;
|
||||
$this->reportedFor = $reportedFor;
|
||||
$this->reportSubject = $reportSubject;
|
||||
$this->description = $description;
|
||||
}
|
||||
}
|
||||
27
app/Events/UserConfirmation.php
Normal file
27
app/Events/UserConfirmation.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class UserConfirmation
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $user;
|
||||
public $otp;
|
||||
|
||||
/**
|
||||
* UserConfirmation constructor.
|
||||
* @param $user
|
||||
* @param $otp
|
||||
*/
|
||||
public function __construct($user,$otp)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->otp = $otp;
|
||||
}
|
||||
}
|
||||
30
app/Events/WrongChaturmas.php
Normal file
30
app/Events/WrongChaturmas.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class WrongChaturmas
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $user;
|
||||
public $santID;
|
||||
public $chaturmasID;
|
||||
public $description;
|
||||
|
||||
/**
|
||||
* WrongChaturmas constructor.
|
||||
* @param $user
|
||||
*/
|
||||
public function __construct($user, $santID, $chaturmasID, $description)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->santID = $santID;
|
||||
$this->chaturmasID = $chaturmasID;
|
||||
$this->description = $description;
|
||||
}
|
||||
}
|
||||
50
app/Exceptions/GeneralException.php
Normal file
50
app/Exceptions/GeneralException.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
class GeneralException extends Exception
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* GeneralException constructor.
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct($message = '', $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report the exception.
|
||||
*/
|
||||
public function report()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request)
|
||||
{
|
||||
|
||||
// All instances of GeneralException redirect back with a flash message to show a bootstrap alert-error
|
||||
return redirect()
|
||||
->back()
|
||||
->withInput()
|
||||
->with('toast_warning', $this->message);
|
||||
}
|
||||
}
|
||||
41
app/Exceptions/Handler.php
Normal file
41
app/Exceptions/Handler.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed for validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
}
|
||||
}
|
||||
1472
app/Helpers/Helpers.php
Normal file
1472
app/Helpers/Helpers.php
Normal file
File diff suppressed because it is too large
Load Diff
235
app/Http/Controllers/Api/ApiController.php
Normal file
235
app/Http/Controllers/Api/ApiController.php
Normal file
@@ -0,0 +1,235 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Response as IlluminateResponse;
|
||||
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* Boolean status code
|
||||
*/
|
||||
const STATUS_ZERO = 0;
|
||||
const STATUS_ONE = 1;
|
||||
const STATUS_TRUE = true;
|
||||
const STATUS_FALSE = false;
|
||||
|
||||
/**
|
||||
* HTTP status code
|
||||
*/
|
||||
const HTTP_STATUS_CODE_200 = 200; // 200: OK. The standard success code and default option.
|
||||
const HTTP_STATUS_CODE_201 = 201; // 201: Object created. Useful for the store actions.
|
||||
const HTTP_STATUS_CODE_204 = 204; // 204: No content. When an action was executed successfully, but there is no content to return.
|
||||
const HTTP_STATUS_CODE_206 = 206; // 206: Partial content. Useful when you have to return a paginated list of resources.
|
||||
const HTTP_STATUS_CODE_400 = 400; // 400: Bad request. The standard option for requests that fail to pass validation.
|
||||
const HTTP_STATUS_CODE_401 = 401; // 401: Unauthorized. The user needs to be authenticated.
|
||||
const HTTP_STATUS_CODE_403 = 403; // 403: Forbidden. The user is authenticated, but does not have the permissions to perform an action.
|
||||
const HTTP_STATUS_CODE_422 = 422; // 403: Forbidden. The user is authenticated, but does not have the permissions to perform an action.
|
||||
const HTTP_STATUS_CODE_404 = 404; // 403: Forbidden. The user is authenticated, but does not have the permissions to perform an action.
|
||||
const HTTP_STATUS_CODE_500 = 500; // 404: Not found. This will be returned automatically by Laravel when the resource is not found.
|
||||
const HTTP_STATUS_CODE_503 = 503; // 500: Internal server error. Ideally you're not going to be explicitly returning this, but if something unexpected breaks, this is what your user is going to receive.
|
||||
|
||||
/**
|
||||
* default status code.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $statusCode = 200;
|
||||
|
||||
/**
|
||||
* get the status code.
|
||||
*
|
||||
* @return statuscode
|
||||
*/
|
||||
public function getStatusCode()
|
||||
{
|
||||
return $this->statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* set the status code.
|
||||
*
|
||||
* @param [type] $statusCode [description]
|
||||
*
|
||||
* @return statuscode
|
||||
*/
|
||||
public function setStatusCode($statusCode)
|
||||
{
|
||||
$this->statusCode = $statusCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond.
|
||||
*
|
||||
* @param array $data
|
||||
* @param array $headers
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function respond($data, $headers = [])
|
||||
{
|
||||
return response()->json($data, $this->getStatusCode(), $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* respond with pagincation.
|
||||
*
|
||||
* @param Paginator $items
|
||||
* @param array $data
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function respondWithPagination($items, $data)
|
||||
{
|
||||
$data = array_merge($data, [
|
||||
'paginator' => [
|
||||
'total_count' => $items->total(),
|
||||
'total_pages' => ceil($items->total() / $items->perPage()),
|
||||
'current_page' => $items->currentPage(),
|
||||
'limit' => $items->perPage(),
|
||||
],
|
||||
]);
|
||||
|
||||
return $this->respond($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond Created.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function respondCreated($data)
|
||||
{
|
||||
return $this->setStatusCode(201)->respond([
|
||||
'data' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond Created with data.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function respondCreatedWithData($data)
|
||||
{
|
||||
return $this->setStatusCode(201)->respond($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* respond with error.
|
||||
*
|
||||
* @param $message
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function respondWithError($message)
|
||||
{
|
||||
return $this->respond([
|
||||
'error' => [
|
||||
'message' => $message,
|
||||
'status_code' => $this->getStatusCode(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* responsd not found.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function respondNotFound($message = 'Not Found')
|
||||
{
|
||||
return $this->respond([
|
||||
'message' => $message,
|
||||
'status_code' => IlluminateResponse::HTTP_NOT_FOUND,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond with error.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function respondInternalError($message)
|
||||
{
|
||||
return $this->respond([
|
||||
'error' => $message,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond with unauthorized.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function respondUnauthorized($message = 'Unauthorized')
|
||||
{
|
||||
return $this->setStatusCode(401)->respondWithError($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond with forbidden.
|
||||
*
|
||||
* @param string $message
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function respondForbidden($message = 'Forbidden')
|
||||
{
|
||||
return $this->setStatusCode(403)->respondWithError($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Respond with no content.
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
protected function respondWithNoContent()
|
||||
{
|
||||
return $this->setStatusCode(204)->respond(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $message
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function throwValidation($message)
|
||||
{
|
||||
return $this->respond([
|
||||
'message' => $message,
|
||||
'status_code' => 422,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* update the status code and remove field from the array.
|
||||
*
|
||||
* @param array $request
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function updateStatusCode(array &$request)
|
||||
{
|
||||
if (array_key_exists('status_code', $request)) {
|
||||
$this->statusCode = $request['status_code'];
|
||||
unset($request['status_code']);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
40
app/Http/Controllers/Api/V1/Access/BloodGroupController.php
Normal file
40
app/Http/Controllers/Api/V1/Access/BloodGroupController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\BloodGroup\BloodGroupInterface as BloodGroupRepository;
|
||||
|
||||
class BloodGroupController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param BloodGroupRepository $bloodGroupRepository
|
||||
* BloodGroupController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(BloodGroupRepository $bloodGroupRepository)
|
||||
{
|
||||
$this->bloodGroupRepository = $bloodGroupRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getBloodGroupList()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->bloodGroupRepository->getBloodGroupList();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
153
app/Http/Controllers/Api/V1/Access/ChaturmasController.php
Normal file
153
app/Http/Controllers/Api/V1/Access/ChaturmasController.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Http\Requests\Api\Chaturmas\GetChaturmasRequest;
|
||||
use App\Http\Requests\Api\Chaturmas\StoreChaturmasRequest;
|
||||
use App\Http\Requests\Api\Chaturmas\UpdateChaturmasRequest;
|
||||
use App\Repositories\Api\Access\Chaturmas\ChaturmasInterface as ChaturmasRepository;
|
||||
use App\Models\Chaturmas;
|
||||
use Exception;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ChaturmasController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param ChaturmasRepository $chaturmasRepository
|
||||
* ChaturmasController constructor.
|
||||
*/
|
||||
public function __construct(ChaturmasRepository $chaturmasRepository)
|
||||
{
|
||||
$this->chaturmasRepository = $chaturmasRepository;
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(GetChaturmasRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasRepository->getChaturmasList($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param App\Http\Requests\Api\Chaturmas\StoreChaturmasRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreChaturmasRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasRepository->storeChaturmas($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Chaturmas $chaturma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Chaturmas $chaturma)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasRepository->showChaturmas($chaturma);
|
||||
$this->updateStatusCode($response);
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (Exception $ex) {
|
||||
$response['error'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param App\Http\Requests\Api\Chaturmas\UpdateChaturmasRequest $request
|
||||
* @param \App\Models\Chaturmas $chaturma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateChaturmasRequest $request, Chaturmas $chaturma)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasRepository->updateChaturmas($request->all(), $chaturma);
|
||||
$this->updateStatusCode($response);
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['error'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Chaturmas $chaturma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Chaturmas $chaturma)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Chaturmas $chaturma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getChaturmasYears()
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasRepository->getChaturmasYears();
|
||||
$this->updateStatusCode($response);
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (Exception $ex) {
|
||||
$response['error'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Chaturmas $chaturma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getHundredChaturmasYears()
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasRepository->getHundredChaturmasYears();
|
||||
$this->updateStatusCode($response);
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (Exception $ex) {
|
||||
$response['error'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
116
app/Http/Controllers/Api/V1/Access/ChaturmasReviewController.php
Normal file
116
app/Http/Controllers/Api/V1/Access/ChaturmasReviewController.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\ChaturmasReview;
|
||||
use App\Models\Chaturmas;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\ChaturmasReview\StoreChaturmasReviewRequest;
|
||||
use App\Http\Requests\Api\ChaturmasReview\UpdateChaturmasReviewRequest;
|
||||
use App\Repositories\Api\Access\ChaturmasReview\ChaturmasReviewInterface as ChaturmasReviewRepository;
|
||||
|
||||
|
||||
class ChaturmasReviewController extends ApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param ChaturmasReviewRepository $chaturmasReviewRepository
|
||||
* ChaturmasController constructor.
|
||||
*/
|
||||
public function __construct(ChaturmasReviewRepository $chaturmasReviewRepository)
|
||||
{
|
||||
$this->chaturmasReviewRepository = $chaturmasReviewRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasReviewRepository->getChaturmasReviewList($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param StoreChaturmasReviewRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreChaturmasReviewRequest $request, Chaturmas $chaturmas)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasReviewRepository->storeChaturmasReview($request->all(), $chaturmas);
|
||||
$this->updateStatusCode($response);
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\ChaturmasReview $chaturmasReview
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ChaturmasReview $chaturmasReview)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasReviewRepository->showChaturmasReview($chaturma);
|
||||
$this->updateStatusCode($response);
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (Exception $ex) {
|
||||
$response['error'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\ChaturmasReview $chaturmasReview
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, ChaturmasReview $chaturmasReview)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasReviewRepository->updateChaturmasReview($request->all(), $chaturma);
|
||||
$this->updateStatusCode($response);
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['error'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\ChaturmasReview $chaturmasReview
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ChaturmasReview $chaturmasReview)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
25
app/Http/Controllers/Api/V1/Access/CommonController.php
Normal file
25
app/Http/Controllers/Api/V1/Access/CommonController.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Http\Controllers\BaseController;
|
||||
|
||||
class CommonController extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$this->setStatusCode(Constant::CODE_200);
|
||||
|
||||
return $this->respond([
|
||||
'data' => [
|
||||
'sangh_types' => config('common-variables.sangh_types'),
|
||||
'derasar_type' => config('common-variables.derasar_type'),
|
||||
'mulnayak_bhagwan' => config('common-variables.mulnayak_bhagwan'),
|
||||
'number_of_members' => config('common-variables.number_of_members'),
|
||||
'number_of_students' => config('common-variables.number_of_students'),
|
||||
'number_of_books' => config('common-variables.number_of_books'),
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
40
app/Http/Controllers/Api/V1/Access/CountryController.php
Normal file
40
app/Http/Controllers/Api/V1/Access/CountryController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Country\CountryInterface as CountryRepository;
|
||||
|
||||
class CountryController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param CountryRepository $countryRepository
|
||||
* CountryController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(CountryRepository $countryRepository)
|
||||
{
|
||||
$this->countryRepository = $countryRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCountryCodeList()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->countryRepository->getCountryCodeList();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
40
app/Http/Controllers/Api/V1/Access/DharmaController.php
Normal file
40
app/Http/Controllers/Api/V1/Access/DharmaController.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Dharma\DharmaInterface as DharmaRepository;
|
||||
|
||||
class DharmaController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param DharmaRepository $dharmaRepository
|
||||
* DharmaController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(DharmaRepository $dharmaRepository)
|
||||
{
|
||||
$this->dharmaRepository = $dharmaRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDharmaDetail()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->dharmaRepository->getDharmaDetail();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
20
app/Http/Controllers/Api/V1/Access/HospitalController.php
Normal file
20
app/Http/Controllers/Api/V1/Access/HospitalController.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Hospital\HospitalRepository;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class HospitalController extends ApiController
|
||||
{
|
||||
public function __construct(protected HospitalRepository $hospitalRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
$response = $this->hospitalRepository->getAll();
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
61
app/Http/Controllers/Api/V1/Access/JatiController.php
Normal file
61
app/Http/Controllers/Api/V1/Access/JatiController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Jati\JatiInterface as JatiRepository;
|
||||
|
||||
class JatiController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param JatiRepository $jatiRepository
|
||||
* JatiController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(JatiRepository $jatiRepository)
|
||||
{
|
||||
$this->jatiRepository = $jatiRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getJatiDetail(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->jatiRepository->getJatiDetail($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $request
|
||||
* @return array
|
||||
*/
|
||||
public function storeJati(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->jatiRepository->storeJati($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
182
app/Http/Controllers/Api/V1/Access/MessageController.php
Normal file
182
app/Http/Controllers/Api/V1/Access/MessageController.php
Normal file
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use App\Constant\Constant;
|
||||
use App\Models\UserBlocked;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Message\MessageInterface as MessageRepository;
|
||||
|
||||
class MessageController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param MessageRepository $messageRepository
|
||||
* MessageController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(MessageRepository $messageRepository)
|
||||
{
|
||||
$this->messageRepository = $messageRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function sendMessage(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->messageRepository->sendMessage($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function messageThreadList(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->messageRepository->messageThreadList($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function messageList(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
$messageListing = $this->messageRepository->messageList($request);
|
||||
$messageData = (!empty($messageListing['data'])) ? $messageListing['data']->toArray() : $messageListing['data'];
|
||||
$temp = (!empty($messageListing['data'])) ? array_reverse($messageData['data']) : [];
|
||||
unset($messageData['data']);
|
||||
|
||||
$messageData['data'] = collect($temp)
|
||||
->groupBy(function ($val) {
|
||||
$val['created_at'] = Carbon::parse($val['created_at'])->format('Y/m/d');
|
||||
return Carbon::parse($val['created_at'])->format('Y/m/d');
|
||||
});
|
||||
|
||||
// $messageData['data'] = $messageData['data']->reverse();
|
||||
$user = getUserByID($request->user_id);
|
||||
|
||||
if ($user) {
|
||||
$messageData['receiver_image'] = !empty($user['avatar']) ? $user['avatar'] : url('media/avatars/avatar0.jpg');
|
||||
} else {
|
||||
$messageData['receiver_image'] = asset('/images/misc/shravak.png');
|
||||
}
|
||||
$messageData['unread_count'] = messagesCounter();
|
||||
|
||||
$userBlocked = UserBlocked::where('user_id', $user->id)->orWhere('blocked_by', loggedInUser()->id)->first();
|
||||
|
||||
//When user profile is blocked
|
||||
if (!empty($userBlocked)) {
|
||||
$isBlocked = Constant::STATUS_ONE;
|
||||
|
||||
//When profile is not blocked
|
||||
} else {
|
||||
$isBlocked = Constant::STATUS_ZERO;
|
||||
}
|
||||
|
||||
$messageData['is_blocked'] = $isBlocked;
|
||||
|
||||
if ($messageListing['status']) {
|
||||
$response = [
|
||||
'status' => __('api.messages.list'),
|
||||
'code' => 200,
|
||||
'data' => $messageData
|
||||
];
|
||||
} else {
|
||||
$response = [
|
||||
'status' => __('auth.something_went_wrong'),
|
||||
'code' => 500,
|
||||
'message' => $messageListing['error']
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($response, $response['code']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $data
|
||||
* @param $id
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function searchMessage(Request $data, $id)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->messageRepository->searchMessage($data, $id);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $messageThreadId
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function clearMessageConversation($messageThreadId)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->messageRepository->clearMessageConversation($messageThreadId);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function deleteMessageThread($id)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->messageRepository->deleteMessageThread($id);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\MotherTongue\MotherTongueInterface as MotherTongueRepository;
|
||||
|
||||
class MotherTongueController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param MotherTongueRepository $motherTongueRepository
|
||||
* MotherTongueController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(MotherTongueRepository $motherTongueRepository)
|
||||
{
|
||||
$this->motherTongueRepository = $motherTongueRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMotherTongueList()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->motherTongueRepository->getMotherTongueList();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
133
app/Http/Controllers/Api/V1/Access/NotificationsController.php
Normal file
133
app/Http/Controllers/Api/V1/Access/NotificationsController.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Notification\NotificationsInterface as NotificationsRepository;
|
||||
|
||||
class NotificationsController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @var NotificationsRepository
|
||||
*/
|
||||
protected $notificationsRepository;
|
||||
|
||||
/**
|
||||
* @param NotificationsRepository $notificationsRepository
|
||||
* NotificationsController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(NotificationsRepository $notificationsRepository)
|
||||
{
|
||||
$this->notificationsRepository = $notificationsRepository;
|
||||
}
|
||||
|
||||
public function notificationListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->notificationsRepository->notificationListing($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
public function deleteNotification($id)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->notificationsRepository->deleteNotification($id);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
public function deleteAllNotifications()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->notificationsRepository->deleteAllNotifications();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
public function pushNotificationRegister(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->notificationsRepository->pushNotificationRegister($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
public function deleteUserToken(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->notificationsRepository->deleteUserToken($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
public function deleteExistingToken(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->notificationsRepository->deleteExistingDeviceToken($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
public function getUnreadCounts()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->notificationsRepository->getUnreadCounts();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
334
app/Http/Controllers/Api/V1/Access/PostController.php
Normal file
334
app/Http/Controllers/Api/V1/Access/PostController.php
Normal file
@@ -0,0 +1,334 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Post;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\Api\Post\StorePostRequest;
|
||||
use App\Http\Requests\Api\Post\UpdatePostRequest;
|
||||
use App\Repositories\Api\Access\Post\PostInterface as PostRepository;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\Post\GetSantPostRequest;
|
||||
use App\Http\Requests\Api\Post\PostAddCommentRequest;
|
||||
use App\Http\Requests\Api\Post\PostLikeRequest;
|
||||
use App\Http\Requests\Api\Post\PostRemoveCommentRequest;
|
||||
use App\Http\Requests\Api\Post\PostUpdateCommentRequest;
|
||||
use App\Models\PostComment;
|
||||
use App\Policies\ReplyPolicy;
|
||||
|
||||
class PostController extends ApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Post
|
||||
*/
|
||||
protected $postRepository;
|
||||
|
||||
/**
|
||||
* @param PostRepository $userRepo
|
||||
* PostController constructor.
|
||||
*/
|
||||
public function __construct(PostRepository $postRepository)
|
||||
{
|
||||
$this->postRepository = $postRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->getAllPosts($request);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getUserPost(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->getUserPost($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->storePost($request);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Post $post)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->showPost($post);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdatePostRequest $request, Post $post)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->updatePost($request, $post);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Post $post)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->destroyPost($post);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the categorty.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->getCategory();
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like on post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function likePost(PostLikeRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->likePost($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like on post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function addComment(PostAddCommentRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->addComment($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like on post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function updateComment(PostUpdateCommentRequest $request)
|
||||
{
|
||||
try {
|
||||
$reply = PostComment::findOrFail($request['comment_id']);
|
||||
$this->authorize(ReplyPolicy::UPDATE, $reply);
|
||||
$response = $this->postRepository->updateComment($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Like on post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function removeComment(PostRemoveCommentRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->removeComment($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a previous draft post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getDraftPost()
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->getDraftPost();
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the sant post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getSantPost(GetSantPostRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->getSantPost($request);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the sant post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getPostComments(Request $request, Post $post)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->getPostComments($request->all(), $post);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the sant post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getSanghPost(GetSantPostRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->getSanghPost($request);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide post.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function hidePost(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepository->hidePost($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
44
app/Http/Controllers/Api/V1/Access/ProfessionController.php
Normal file
44
app/Http/Controllers/Api/V1/Access/ProfessionController.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Repositories\Api\Access\Profession\ProfessionInterface as ProfessionRepository;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ProfessionController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param ProfessionRepository $professionRepository
|
||||
* ProfessionController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(ProfessionRepository $professionRepository)
|
||||
{
|
||||
$this->professionRepository = $professionRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->professionRepository->index($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
154
app/Http/Controllers/Api/V1/Access/RelationshipController.php
Normal file
154
app/Http/Controllers/Api/V1/Access/RelationshipController.php
Normal file
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\FriendRequest\UpdateFriendRequest;
|
||||
use App\Repositories\Api\Access\Relationship\RelationshipInterface as RelationshipRepository;
|
||||
|
||||
class RelationshipController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param RelationshipRepository $requestRepository
|
||||
* RelationshipController constructor.
|
||||
*/
|
||||
public function __construct(RelationshipRepository $relationshipRepository)
|
||||
{
|
||||
$this->relationshipRepository = $relationshipRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function getRelationships()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->relationshipRepository->getRelationships();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function sendRelationshipRequest(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->relationshipRepository->sendRelationshipRequest($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function acceptRelationshipRequest(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->relationshipRepository->acceptRelationshipRequest($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function listRelationshipRequest()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->relationshipRepository->listRelationshipRequest();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function sentRelationshipRequestList()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->relationshipRepository->sentRelationshipRequestList();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function updateRelationshipRequest($id, Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->relationshipRepository->updateRelationshipRequest($id, $request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function userList(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->relationshipRepository->userList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
42
app/Http/Controllers/Api/V1/Access/ReportController.php
Normal file
42
app/Http/Controllers/Api/V1/Access/ReportController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Report\ReportInterface as ReportRepository;
|
||||
|
||||
class ReportController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param ReportRepository $reportRepository
|
||||
* ReportController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(ReportRepository $reportRepository)
|
||||
{
|
||||
$this->reportRepository = $reportRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $request
|
||||
* @return array
|
||||
*/
|
||||
public function storeReport(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->reportRepository->create($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
211
app/Http/Controllers/Api/V1/Access/RequestController.php
Normal file
211
app/Http/Controllers/Api/V1/Access/RequestController.php
Normal file
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\FriendRequest\StoreFriendRequest;
|
||||
use App\Http\Requests\Api\FriendRequest\UpdateFriendRequest;
|
||||
use App\Models\User;
|
||||
use App\Repositories\Api\Access\Request\RequestInterface as RequestRepository;
|
||||
|
||||
class RequestController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param RequestRepository $requestRepository
|
||||
* RequestController constructor.
|
||||
*/
|
||||
public function __construct(RequestRepository $requestRepository)
|
||||
{
|
||||
$this->requestRepository = $requestRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function sendFriendRequest(StoreFriendRequest $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->sendFriendRequest($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function acceptFriendRequest(UpdateFriendRequest $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->acceptFriendRequest($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function listFriendRequest()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->listFriendRequest();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function myListFriendRequest(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->myListFriendRequest($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function sentRequestList()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->sentRequestList();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function mySentRequestList(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->mySentRequestList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function friendList(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->friendList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function myFriendList(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->myFriendList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return json
|
||||
*/
|
||||
public function userFriendList(Request $request, User $user)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->requestRepository->userFriendList($request, $user);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get suuggestion sant.
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function friendSuggestion(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->requestRepository->friendSuggestion($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
}
|
||||
80
app/Http/Controllers/Api/V1/Access/SampradayController.php
Normal file
80
app/Http/Controllers/Api/V1/Access/SampradayController.php
Normal file
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Models\Sampraday;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Repositories\Api\Access\Sampraday\SampradayInterface as SampradayRepository;
|
||||
|
||||
class SampradayController extends ApiController
|
||||
{
|
||||
public function __construct(SampradayRepository $sampradayRepository)
|
||||
{
|
||||
$this->sampradayRepository = $sampradayRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sampradayRepository->getSampradayList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Sampraday $sampraday
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Sampraday $sampraday)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Sampraday $sampraday
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Sampraday $sampraday)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Sampraday $sampraday
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Sampraday $sampraday)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
409
app/Http/Controllers/Api/V1/Access/SanghController.php
Normal file
409
app/Http/Controllers/Api/V1/Access/SanghController.php
Normal file
@@ -0,0 +1,409 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Http\Requests\Api\Sangh\StoreSanghRequest;
|
||||
use App\Http\Requests\Sangh\CreateSanghMemberCard;
|
||||
use App\Models\Sangh;
|
||||
use App\Constant\Constant;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\Sangh\SanghFollowRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Requests\Api\Sant\UpdateSantRequest;
|
||||
use App\Models\SanghMember;
|
||||
use App\Repositories\Api\Access\Sangh\SanghInterface as SanghRepository;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SanghController extends ApiController
|
||||
{
|
||||
|
||||
public function __construct(SanghRepository $sanghRepository)
|
||||
{
|
||||
$this->sanghRepository = $sanghRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->getSanghList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreSanghRequest $request)
|
||||
{
|
||||
try {
|
||||
$request->validate([
|
||||
'avatar' => 'required',
|
||||
]);
|
||||
$response = $this->sanghRepository->createSangh($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Sangh $sangh
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Sangh $sangh)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->showSangh($sangh);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param UpdateSantRequest $request
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Sangh $sangh)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->updateSangh($sangh, $request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Sangh $sangh
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->deleteSangh($id);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get list of in review sant.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function userSanghList(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->userSanghList($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
public function inReviewSangh(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->inReviewSangh($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Follow sant.
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function sanghFollow(SanghFollowRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->sanghFollow($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get suuggestion sant.
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function sanghSuggestion(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->sanghSuggestion($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get suuggestion sangh.
|
||||
* @param \App\Models\Sant $sangh
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function sanghFollowers(Request $request,Sangh $sangh)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->sanghFollowers($request->all(), $sangh);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add sangh member.
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function addSanghMember(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->addSanghMember($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update sangh member.
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function updateSanghMember(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->updateSanghMember($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sangh member.
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getSanghMembers(Request $request, Sangh $sangh)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->getSanghMembers($request->all(), $sangh);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get committee sangh member.
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getSanghCommitteeMembers(Request $request, Sangh $sangh)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->getSanghCommitteeMembers($request->all(), $sangh);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete sangh member.
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function deleteSanghMember(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->deleteSanghMember($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* user list.
|
||||
* @param SanghFollowRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getUserList(SanghFollowRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->getUserList($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept/Reject sangh member request.
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function acceptMemberRequest(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->acceptMemberRequest($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Invited sangh members list.
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getInvitedSanghMembers()
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->getInvitedSanghMembers();
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get names of sangh if logged in user is member of any sangh
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getSanghNames()
|
||||
{
|
||||
try {
|
||||
$response = $this->sanghRepository->getSanghNames();
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get member card data
|
||||
* @return void
|
||||
*/
|
||||
public function getMemberCard($id)
|
||||
{
|
||||
|
||||
try{
|
||||
$response = $this->sanghRepository->getMemberCard($id);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update member card data
|
||||
*/
|
||||
|
||||
public function createSanghMemberCard(CreateSanghMemberCard $request)
|
||||
{
|
||||
try{
|
||||
$response = $this->sanghRepository->createSanghMemberCard($request);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
305
app/Http/Controllers/Api/V1/Access/SantController.php
Normal file
305
app/Http/Controllers/Api/V1/Access/SantController.php
Normal file
@@ -0,0 +1,305 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Models\Sant;
|
||||
use App\Models\SantTemp;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\Sant\StoreSantRequest;
|
||||
use App\Http\Requests\Api\Sant\SantFollowRequest;
|
||||
use App\Http\Requests\Api\Sant\UpdateSantRequest;
|
||||
use App\Repositories\Api\Access\Sant\SantInterface as SantRepository;
|
||||
|
||||
class SantController extends ApiController
|
||||
{
|
||||
|
||||
public function __construct(SantRepository $santRepository)
|
||||
{
|
||||
$this->santRepository = $santRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->getSantList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreSantRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->createSant($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Sant $sant)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->showSant($sant);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function showInReviewSant(Sant $sant)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->inReviewSantDetail($sant);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param UpdateSantRequest $request
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateSantRequest $request, Sant $sant)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->updateSant($sant,$request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Sant $sant)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get list of father.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function santFatherList(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->santFatherList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of father.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function santMotherList(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->santMotherList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of in review sant.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inReviewSant(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->inReviewSant($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list of in review sant.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function userSantList(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->userSantList($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Follow sant.
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function santFollow(SantFollowRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->santFollow($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get suuggestion sant.
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function santSuggestion(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->santSuggestion($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get suuggestion sant.
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function santFollowers(Request $request,Sant $sant)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->santFollowers($request->all(), $sant);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getSantFeeds(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->getSantFeeds($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store/updates sant's current location.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function updateSantLocation(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santRepository->updateSantLocation($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
176
app/Http/Controllers/Api/V1/Access/ThanaController.php
Normal file
176
app/Http/Controllers/Api/V1/Access/ThanaController.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\Thana\UpdateThanaRequest;
|
||||
use App\Http\Requests\Api\Thana\StoreThanaRequest;
|
||||
use App\Repositories\Api\Access\Thana\ThanaInterface as ThanaRepository;
|
||||
use App\Models\Thana;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ThanaController extends ApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param ThanaRepository $thanaRepository
|
||||
* ThanaController constructor.
|
||||
*/
|
||||
public function __construct(ThanaRepository $thanaRepository)
|
||||
{
|
||||
$this->thanaRepository = $thanaRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$response = $this->thanaRepository->getThanaList($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param StoreThanaRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreThanaRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->thanaRepository->storeThana($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Thana $thana)
|
||||
{
|
||||
try {
|
||||
$response = $this->thanaRepository->showThana($thana);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param UpdateThanaRequest $request
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateThanaRequest $request, Thana $thana)
|
||||
{
|
||||
try {
|
||||
$response = $this->thanaRepository->updateThana($request->all(), $thana);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function thanaMember(StoreThanaRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->thanaRepository->thanaMember($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(StoreThanaRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->thanaRepository->destroyThana($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function thanaMakeLeader(StoreThanaRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->thanaRepository->thanaMakeLeader($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getListOfSant(StoreThanaRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->thanaRepository->getListOfSant($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
|
||||
}
|
||||
}
|
||||
449
app/Http/Controllers/Api/V1/Access/UserController.php
Normal file
449
app/Http/Controllers/Api/V1/Access/UserController.php
Normal file
@@ -0,0 +1,449 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\FriendRequest\StoreFriendRequest;
|
||||
use App\Http\Requests\Api\FriendRequest\UpdateFriendRequest;
|
||||
use App\Http\Requests\Api\PassiveUser\StorePassiveUserRequest;
|
||||
use App\Http\Requests\Api\PassiveUser\UpdatePassiveUserRequest;
|
||||
use App\Http\Requests\ChangePassword\ChangePasswordRequest;
|
||||
use App\Models\User;
|
||||
use App\Repositories\Api\Access\User\UserInterface as UserRepo;
|
||||
|
||||
class UserController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param UserRepo $userRepo
|
||||
* UserController constructor.
|
||||
*/
|
||||
public function __construct(UserRepo $userRepo)
|
||||
{
|
||||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getUserDetail()
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->getUserDetail();
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getUserDetailById($id)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->getUserDetailById($id);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function updateUser(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->updateUser($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function logout(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->logoutUser($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getUserList(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->getUserList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function userFollowing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->userFollowing($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function sanghFollowing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->sanghFollowing($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function storeChildUser(StorePassiveUserRequest $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->storeChildUser($request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function updateChildUser(UpdatePassiveUserRequest $request, User $user)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->updateChildUser($user, $request);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function destroyChildUser(User $user)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->destroyChildUser($user);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function showChildUser(User $user)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->showChildUser($user);
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function resetPassword(ChangePasswordRequest $request)
|
||||
{
|
||||
$response = [];
|
||||
try{
|
||||
$response = $this->userRepo->resetPassword($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function destroyWorkDetails(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->deleteWorkDetail($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function destroyQualificationDetails(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->deleteQualificationDetail($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function globalSearch(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->globalSearch($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getGLobalUserlist(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->getGLobalUserlist($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getGLobalSanghlist(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->getGLobalSanghlist($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getGLobalSantlist(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->getGLobalSantlist($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getUserSangh(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->getUserSangh($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function deleteUserAccount(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->deleteUserAccount($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function blockUser(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->blockUser($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function blockedUserList(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try{
|
||||
$response = $this->userRepo->getblockedUserList($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\Insurance\StoreInsuranceRequest;
|
||||
use App\Repositories\Api\Access\User\UserHealthInsuranceRepository;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class UserHealthInsuranceController extends ApiController
|
||||
{
|
||||
public function __construct(protected UserHealthInsuranceRepository $healthInsuranceRepository)
|
||||
{
|
||||
}
|
||||
|
||||
public function store(StoreInsuranceRequest $request): JsonResponse
|
||||
{
|
||||
$result = $this->healthInsuranceRepository->storeCertificate($request);
|
||||
$this->setStatusCode($result['status']);
|
||||
|
||||
$response['message'] = $result['message'];
|
||||
$response['data'] = $result['data'];
|
||||
$response['status'] = $result['status'];
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function show() : JsonResponse
|
||||
{
|
||||
$result = $this->healthInsuranceRepository->showCertificate();
|
||||
$this->setStatusCode($result['status']);
|
||||
$response['data'] = $result['data'];
|
||||
$response['status'] = $result['status'];
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
139
app/Http/Controllers/Api/V1/Access/ViharController.php
Normal file
139
app/Http/Controllers/Api/V1/Access/ViharController.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Access;
|
||||
|
||||
use App\Http\Requests\Api\Vihar\UpdateViharRequest;
|
||||
use App\Http\Requests\Api\Vihar\StoreViharRequest;
|
||||
use App\Repositories\Api\Access\Vihar\ViharInterface as ViharRepository;
|
||||
use App\Models\Vihar;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\Api\Vihar\DeleteViharRequest;
|
||||
use App\Http\Requests\Api\Vihar\GetViharRequest;
|
||||
use Exception;
|
||||
|
||||
class ViharController extends ApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @param ViharRepository $viharRepository
|
||||
* ViharController constructor.
|
||||
*/
|
||||
public function __construct(ViharRepository $viharRepository)
|
||||
{
|
||||
$this->viharRepository = $viharRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(GetViharRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->viharRepository->getViharList($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function getPastViharList(GetViharRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->viharRepository->getPastViharList($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param App\Http\Requests\Api\Vihar\StoreViharRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreViharRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->viharRepository->storeVihar($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Vihar $vihar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Vihar $vihar)
|
||||
{
|
||||
try {
|
||||
$response = $this->viharRepository->showVihar($vihar);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param App\Http\Requests\Api\Vihar\UpdateViharRequest $request
|
||||
* @param \App\Models\Vihar $vihar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateViharRequest $request, Vihar $vihar)
|
||||
{
|
||||
try {
|
||||
$response = $this->viharRepository->updateVihar($request->all(), $vihar);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Vihar $vihar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(DeleteViharRequest $request, Vihar $vihar)
|
||||
{
|
||||
try {
|
||||
$response = $this->viharRepository->destroyVihar($vihar);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
}
|
||||
262
app/Http/Controllers/Api/V1/AuthController.php
Normal file
262
app/Http/Controllers/Api/V1/AuthController.php
Normal file
@@ -0,0 +1,262 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers\Api\V1;
|
||||
use App\Models\User;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use App\Http\Requests\ChangePassword\SetPasswordRequest;
|
||||
use App\Jobs\Notifications\Shravak\SendNewSignUp;
|
||||
use App\Repositories\Api\Access\User\UserInterface as UserRepo;
|
||||
|
||||
|
||||
class AuthController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param UserRepo $userRepo
|
||||
* AuthController constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(UserRepo $userRepo)
|
||||
{
|
||||
$this->userRepo = $userRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $request
|
||||
* @return array
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
try {
|
||||
$validation = Validator::make($request->all(), [
|
||||
'email' => 'required',
|
||||
'country_code' => 'sometimes',
|
||||
'via' => 'required|in:OTP,PASSWORD',
|
||||
'password' => 'required_if:via,=,PASSWORD'
|
||||
]);
|
||||
|
||||
if ($validation->fails()) {
|
||||
return $this->throwValidation($validation->messages()->first());
|
||||
}
|
||||
$response = $this->userRepo->loginVerification($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $request
|
||||
* @return array
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
$verified = $request['verified'] ?? Constant::NULL;
|
||||
$validation = Validator::make($request->all(), [
|
||||
'name' => 'required|string',
|
||||
'email' => 'required|unique:users',
|
||||
'country_code' => 'required',
|
||||
'dharma' => 'required'
|
||||
]);
|
||||
|
||||
if ($validation->fails()) {
|
||||
return $this->throwValidation($validation->messages()->first());
|
||||
}
|
||||
|
||||
try {
|
||||
$emailHash = md5(strtolower($request->email)); //converted to hash
|
||||
|
||||
if (filter_var($request->email, FILTER_VALIDATE_EMAIL)) {
|
||||
$checkUser = User::where([
|
||||
'email_hash' => $emailHash,
|
||||
'deleted_at' => Constant::NULL
|
||||
])->first();
|
||||
} else {
|
||||
$checkUser = User::where([
|
||||
'mobile' => $request->email,
|
||||
'country_code' => $request->country_code,
|
||||
'deleted_at' => Constant::NULL
|
||||
])->first();
|
||||
}
|
||||
|
||||
//To send the verification code to the unverified user
|
||||
if (!empty($checkUser)) {
|
||||
//Remove confirmation code
|
||||
removeUserMetaValue($checkUser->id, 'confirmation_code');
|
||||
|
||||
$otp = generateOtp();
|
||||
$dataConfirmationCode['user_id'] = $checkUser->id;
|
||||
$dataConfirmationCode['meta_key'] = 'confirmation_code';
|
||||
$dataConfirmationCode['meta_value'] = bcrypt($otp);
|
||||
|
||||
$dataRegister['user_id'] = $checkUser->id;
|
||||
$dataRegister['meta_key'] = 'registered_from';
|
||||
$dataRegister['meta_value'] = 'Mobile';
|
||||
|
||||
$dataRegisterOs['user_id'] = $checkUser->id;
|
||||
$dataRegisterOs['meta_key'] = 'registered_os';
|
||||
$dataRegisterOs['meta_value'] = 'Android';
|
||||
|
||||
$dataRegisterWith['user_id'] = $checkUser->id;
|
||||
$dataRegisterWith['meta_key'] = 'registered_with';
|
||||
$dataRegisterWith['meta_value'] = 'Normal';
|
||||
|
||||
//Adding details to user meta
|
||||
addUserMultipleMetaValue([$dataRegister, $dataRegisterOs, $dataRegisterWith]);
|
||||
|
||||
//event for sending mail of email verification
|
||||
// event(new \App\Events\Frontend\Auth\UserConfirmation($checkUser, $otp));
|
||||
|
||||
$response['status'] = Constant::CODE_403;
|
||||
$response['message'] = trans('auth.contact_exists');
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
if ($verified == Constant::STATUS_ONE) {
|
||||
$response = $this->userRepo->createUser($request->all(), $emailHash);
|
||||
} else {
|
||||
$response['status'] = Constant::CODE_200;
|
||||
$response['message'] = trans('auth.register_success');
|
||||
}
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $request
|
||||
* @return array
|
||||
*/
|
||||
public function confirmOtp(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$validation = Validator::make($request->all(), [
|
||||
'email' => 'required',
|
||||
'otp' => 'required',
|
||||
]);
|
||||
|
||||
if ($validation->fails()) {
|
||||
return $this->throwValidation($validation->messages()->first());
|
||||
}
|
||||
$response = $this->userRepo->confirmOtp($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object $request
|
||||
* @return array
|
||||
*/
|
||||
public function resendOtp(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$validation = Validator::make($request->all(), [
|
||||
'email' => 'required',
|
||||
]);
|
||||
|
||||
if ($validation->fails()) {
|
||||
return $this->throwValidation($validation->messages()->first());
|
||||
}
|
||||
$response = $this->userRepo->resendOtp($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*
|
||||
* Social Login User
|
||||
*
|
||||
*/
|
||||
public function socialLogin(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$validation = Validator::make($request->all(), [
|
||||
'provider' => 'required',
|
||||
'id' => 'required',
|
||||
'email' => 'required|email|unique:users,email,null,id,deleted_at,null',
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
if ($validation->fails()) {
|
||||
return $this->throwValidation($validation->messages()->first());
|
||||
}
|
||||
$response = $this->userRepo->findOrCreateSocial($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function setPassword(SetPasswordRequest $request)
|
||||
{
|
||||
$response = [];
|
||||
try{
|
||||
$response = $this->userRepo->setPassword($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function userExist(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
try{
|
||||
$response = $this->userRepo->userExist($request->all());
|
||||
$this->setStatusCode($response['status']);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
$response['message'] = $ex->getMessage();
|
||||
$response['success'] = Constant::STATUS_FALSE;
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
return $this->respond($response);
|
||||
}
|
||||
}
|
||||
214
app/Http/Controllers/Backend/AdminController.php
Normal file
214
app/Http/Controllers/Backend/AdminController.php
Normal file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\User\AdminStoreRequest;
|
||||
use App\Http\Requests\User\AdminUpdateRequest;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Repositories\Backend\User\AdminService;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AdminController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var AdminService
|
||||
*/
|
||||
protected $adminService;
|
||||
|
||||
/**
|
||||
* AdminController constructor.
|
||||
*
|
||||
* @param AdminService $adminService
|
||||
*/
|
||||
public function __construct(AdminService $adminService)
|
||||
{
|
||||
$this->adminService = $adminService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getUserListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->adminService->getForDataTable($request->all());
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for to get listing of user
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.admin.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for to get create form of user
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
$roles = Role::pluck('name', 'id');
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.admin.create', compact('roles'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for to create user
|
||||
*
|
||||
* @param AdminStoreRequest $request
|
||||
* @return Application|RedirectResponse|Redirector
|
||||
*/
|
||||
public function store(AdminStoreRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->adminService->create($request->all());
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.admin.user.index'))
|
||||
->with('flash_success', __('message.create_admin_success'));
|
||||
}
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_admin_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for get detail view of user
|
||||
*
|
||||
* @param User $user
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function show(User $user)
|
||||
{
|
||||
return view('backend.admin.details',compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for to edit user
|
||||
*
|
||||
* @param User $user
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function edit(User $user)
|
||||
{
|
||||
try {
|
||||
$roles = Role::pluck('name', 'id');
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.admin.edit', compact('user', 'roles'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for update user
|
||||
*
|
||||
* @param AdminUpdateRequest $request
|
||||
* @param User $user
|
||||
* @return Application|Redirector|RedirectResponse
|
||||
*/
|
||||
public function update(AdminUpdateRequest $request, User $user)
|
||||
{
|
||||
try {
|
||||
$response = $this->adminService->update($user, $request->all());
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.admin.user.index'))
|
||||
->with('flash_success', __('message.update_admin_success'));
|
||||
}
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_admin_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for delete user
|
||||
*
|
||||
* @param User $user
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy(User $user): JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
if (request()->user()->cannot('destroy', $user)) {
|
||||
return response()->json(['error' => true, 'message' => __('message.access_denied')]);
|
||||
}
|
||||
|
||||
$user->removeRole($user->roles[0]->id);
|
||||
$response = $user->forceDelete();
|
||||
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_admin_success')]);
|
||||
}
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_admin_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->adminService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_admin_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
112
app/Http/Controllers/Backend/Auth/AccountSettingController.php
Normal file
112
app/Http/Controllers/Backend/Auth/AccountSettingController.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\ChangePassword\ChangePasswordRequest;
|
||||
use App\Repositories\Backend\Auth\ChangePasswordService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class AccountSettingController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var ChangePasswordService
|
||||
*/
|
||||
protected $changePasswordService;
|
||||
|
||||
/**
|
||||
* AccountSettingController constructor.
|
||||
*
|
||||
* @param ChangePasswordService $changePasswordService
|
||||
*/
|
||||
public function __construct(ChangePasswordService $changePasswordService)
|
||||
{
|
||||
$this->changePasswordService = $changePasswordService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $currentTab
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
protected function accountSetting(string $currentTab = 'change-currency')
|
||||
{
|
||||
try {
|
||||
$user = loggedInUser();
|
||||
$allowedCompanyUsersPermission = loggedInUser()->hasRole('admin-user') ? true : false;
|
||||
|
||||
if(!$allowedCompanyUsersPermission) {
|
||||
if ($currentTab == 'change-currency' || $currentTab == 'api') {
|
||||
$currentTab = 'change-email';
|
||||
}
|
||||
}
|
||||
|
||||
return view('backend.auth.account_setting.account_setting', [
|
||||
'current_tab' => $currentTab,
|
||||
'allowed_company_users_permission' => $allowedCompanyUsersPermission,
|
||||
]);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ChangePasswordRequest $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function updatePassword(ChangePasswordRequest $request)
|
||||
{
|
||||
try {
|
||||
$data = $request->all();
|
||||
$response = $this->changePasswordService->updatePassword($data);
|
||||
|
||||
if ($response['status']) {
|
||||
return redirect(route('admin.account-setting.index',['change-password']))->withFlashSuccess($response['message']);
|
||||
} else {
|
||||
return redirect()->back()->withInput($data)->withFlashError($response['message']);
|
||||
}
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ChangePasswordRequest $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function checkEmailAddress(Request $request)
|
||||
{
|
||||
try {
|
||||
$data = $request->all();
|
||||
return $this->updateEmailService->checkEmailAddress($data);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function updateEmailAddress(Request $request)
|
||||
{
|
||||
try {
|
||||
$data = $request->all();
|
||||
$response = $this->updateEmailService->updateEmailAddress($data);
|
||||
|
||||
if ($response['status']) {
|
||||
return redirect()->back()->withFlashSuccess($response['message']);
|
||||
} else {
|
||||
return redirect()->back()->withInput($data)->withFlashError($response['message']);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||
|
||||
class ConfirmPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Confirm Password Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password confirmations and
|
||||
| uses a simple trait to include the behavior. You're free to explore
|
||||
| this trait and override any functions that require customization.
|
||||
|
|
||||
*/
|
||||
|
||||
use ConfirmsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users when the intended url fails.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend\Auth;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function showLinkRequestForm()
|
||||
{
|
||||
return view('backend.auth.passwords.email');
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a reset link to the given user.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function sendResetLinkEmail(Request $request)
|
||||
{
|
||||
$this->validateEmail($request);
|
||||
$email = strtolower($request->get('email'));
|
||||
$hashed = md5($email);
|
||||
$user = User::where('email_hash', $hashed)->first();
|
||||
|
||||
// We will send the password reset link to this user. Once we have attempted
|
||||
// to send the link, we will examine the response then see the message we
|
||||
// need to show to the user. Finally, we'll send out a proper response.
|
||||
|
||||
if (!is_null($user)) {
|
||||
$response = Password::sendResetLink(
|
||||
['email_hash' => $hashed]
|
||||
);
|
||||
} else {
|
||||
$response = Password::INVALID_USER;
|
||||
}
|
||||
|
||||
return $response == Password::RESET_LINK_SENT
|
||||
? $this->sendResetLinkResponse($request, $response)
|
||||
: $this->sendResetLinkFailedResponse($request, $response);
|
||||
}
|
||||
}
|
||||
94
app/Http/Controllers/Backend/Auth/LoginController.php
Normal file
94
app/Http/Controllers/Backend/Auth/LoginController.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend\Auth;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest')->except('logout');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function showLoginForm()
|
||||
{
|
||||
return view('backend.auth.login');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $credentials
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function attemptLogin(Request $request)
|
||||
{
|
||||
$credentials = $request->all();
|
||||
|
||||
if (!isset($credentials['password']) or !isset($credentials['email'])) {
|
||||
return false;
|
||||
}
|
||||
$email = strtolower($credentials['email']);
|
||||
$user = User::where('email_hash', md5($email))->first();
|
||||
|
||||
if ($user) {
|
||||
if (!Hash::check($credentials['password'], $user->password)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user) {
|
||||
Auth::login($user);
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function logout(Request $request)
|
||||
{
|
||||
$this->guard()->logout();
|
||||
$request->session()->invalidate();
|
||||
$request->session()->regenerateToken();
|
||||
|
||||
if ($response = $this->loggedOut($request)) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
return $request->wantsJson() ? new JsonResponse([], 204) : redirect('/login');
|
||||
}
|
||||
}
|
||||
73
app/Http/Controllers/Backend/Auth/RegisterController.php
Normal file
73
app/Http/Controllers/Backend/Auth/RegisterController.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a validator for an incoming registration request.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \Illuminate\Contracts\Validation\Validator
|
||||
*/
|
||||
protected function validator(array $data)
|
||||
{
|
||||
return Validator::make($data, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new user instance after a valid registration.
|
||||
*
|
||||
* @param array $data
|
||||
* @return \App\Models\User
|
||||
*/
|
||||
protected function create(array $data)
|
||||
{
|
||||
return User::create([
|
||||
'name' => $data['name'],
|
||||
'email' => $data['email'],
|
||||
'password' => Hash::make($data['password']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
100
app/Http/Controllers/Backend/Auth/ResetPasswordController.php
Normal file
100
app/Http/Controllers/Backend/Auth/ResetPasswordController.php
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use App\Rules\Password as PasswordRule;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset requests
|
||||
| and uses a simple trait to include this behavior. You're free to
|
||||
| explore this trait and override any methods you wish to tweak.
|
||||
|
|
||||
*/
|
||||
|
||||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Where to redirect users after resetting their password.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
public function showResetForm(Request $request)
|
||||
{
|
||||
$token = $request->route()->parameter('token');
|
||||
|
||||
return view('backend.auth.passwords.reset')->with(
|
||||
['token' => $token, 'email' => $request->email]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the given user's password.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse
|
||||
*/
|
||||
public function reset(Request $request)
|
||||
{
|
||||
$request->validate($this->rules($request->all()), $this->validationErrorMessages());
|
||||
|
||||
// Here we will attempt to reset the user's password. If it is successful we
|
||||
// will update the password on an actual user model and persist it to the
|
||||
// database. Otherwise we will parse the error and return the response.
|
||||
$response = $this->broker()->reset(
|
||||
$this->credentials($request), function ($user, $password) {
|
||||
$this->resetPassword($user, $password);
|
||||
}
|
||||
);
|
||||
|
||||
// If the password was successfully reset, we will redirect the user back to
|
||||
// the application's home authenticated view. If there is an error we can
|
||||
// redirect them back to where they came from with their error message.
|
||||
return $response == Password::PASSWORD_RESET
|
||||
? $this->sendResetResponse($request, $response)
|
||||
: $this->sendResetFailedResponse($request, $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password reset validation rules.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function rules(array $data)
|
||||
{
|
||||
return [
|
||||
'token' => ['required'],
|
||||
'email' => ['required','email'],
|
||||
'password' => ['required','confirmed', PasswordRule::min(8)]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password reset credentials from the request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
protected function credentials(Request $request)
|
||||
{
|
||||
$email = strtolower($request->get('email'));
|
||||
return [
|
||||
'email_hash' => md5($email),
|
||||
'password' => $request->get('password'),
|
||||
'password_confirmation' => $request->get('password_confirmation'),
|
||||
'token' => $request->get('token')
|
||||
];
|
||||
}
|
||||
}
|
||||
42
app/Http/Controllers/Backend/Auth/VerificationController.php
Normal file
42
app/Http/Controllers/Backend/Auth/VerificationController.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||
|
||||
class VerificationController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Email Verification Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling email verification for any
|
||||
| user that recently registered with the application. Emails may also
|
||||
| be re-sent if the user didn't receive the original email message.
|
||||
|
|
||||
*/
|
||||
|
||||
use VerifiesEmails;
|
||||
|
||||
/**
|
||||
* Where to redirect users after verification.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = RouteServiceProvider::HOME;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('signed')->only('verify');
|
||||
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||
}
|
||||
}
|
||||
60
app/Http/Controllers/Backend/CertificateController.php
Normal file
60
app/Http/Controllers/Backend/CertificateController.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repositories\Backend\Certificate\CertificateService;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\View\View;
|
||||
|
||||
class CertificateController extends Controller
|
||||
{
|
||||
public function __construct(protected CertificateService $certificateService)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
return view('backend.certificate.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return View
|
||||
*/
|
||||
public function show($id): View
|
||||
{
|
||||
$details = $this->certificateService->query()->findOrFail($id);
|
||||
return view('backend.certificate.detail', compact('details'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return object
|
||||
*/
|
||||
public function listing(Request $request): object
|
||||
{
|
||||
return $this->certificateService->getListing($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param Request $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function statusUpdate($id, Request $request) : RedirectResponse
|
||||
{
|
||||
$response = $this->certificateService->statusUpdate($id, $request);
|
||||
|
||||
if ($response['status']) {
|
||||
return redirect()->route('admin.certificates.index')
|
||||
->with('flash_success', __('message.update_certificate_success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_certificate_error'));
|
||||
}
|
||||
}
|
||||
208
app/Http/Controllers/Backend/ChaturmasController.php
Normal file
208
app/Http/Controllers/Backend/ChaturmasController.php
Normal file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use App\Models\Chaturmas;
|
||||
use App\Models\Sangh;
|
||||
use App\Models\Sant;
|
||||
use App\Http\Requests\Chaturmas\StoreChaturmasRequest;
|
||||
use App\Http\Requests\Chaturmas\UpdateChaturmasRequest;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Repositories\Backend\Chaturmas\ChaturmasService;
|
||||
use Illuminate\Http\Request;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Constant\Constant;
|
||||
use App\Models\ThanaMember;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class ChaturmasController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var ChaturmasService
|
||||
*/
|
||||
protected $chaturmasService;
|
||||
|
||||
/**
|
||||
* ChaturmasController constructor.
|
||||
* @param ChaturmasService $chaturmasService
|
||||
*/
|
||||
public function __construct(ChaturmasService $chaturmasService)
|
||||
{
|
||||
$this->chaturmasService = $chaturmasService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getChaturmasListing(Request $request, Sant $sant)//Sant given to perform ajax request
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->chaturmasService->getForDataTable($request->all(), $sant);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Sant $sant)//Sant given to pass in view
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sant.sant-chaturmas.list', compact('sant'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create(Sant $sant)//Sant given to create method form
|
||||
{
|
||||
try {
|
||||
$years = getChaturmasYears();
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
return view('backend.sant.sant-chaturmas.create',compact('sant', 'years'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreChaturmasRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreChaturmasRequest $request, Sant $sant)//
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasService->create($request->all(), $sant);
|
||||
if ($response) {
|
||||
return redirect(route('admin.sant.chaturmas.index', compact('sant')))
|
||||
->with('flash_success', __('message.create_chaturmas_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_chaturmas_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Chaturmas $chaturmas
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Chaturmas $chaturmas)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Chaturmas $chaturma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Sant $sant,Chaturmas $chaturma)
|
||||
{
|
||||
try {
|
||||
$sanghAddress = '';
|
||||
if ($chaturma->sangh_id) {
|
||||
$sanghAddress = Sangh::find($chaturma->sangh_id);
|
||||
$sanghAddress = $sanghAddress->address;
|
||||
}
|
||||
$thanaID = Chaturmas::where('sant_id', $sant->id)->where('thana_sant_id', '!=', null)->value('thana_sant_id');
|
||||
$thanaSantID = ThanaMember::where('thana_id', $thanaID)->pluck('sant_id');
|
||||
$santName = Sant::whereIn('id', $thanaSantID)->pluck('name')->toArray();
|
||||
$years = getChaturmasYears();
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sant.sant-chaturmas.edit', compact('sant', 'chaturma', 'years', 'santName', 'sanghAddress'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateChaturmasRequest $request
|
||||
* @param \App\Models\Chaturmas $chaturmas
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateChaturmasRequest $request, Sant $sant, Chaturmas $chaturma)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasService->update($chaturma, $request->all(), $sant);
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.sant.chaturmas.index', compact('sant')))
|
||||
->with('flash_success', __('message.update_chaturmas_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_chaturmas_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Chaturmas $chaturmas
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Chaturmas $chaturmas)
|
||||
{
|
||||
try {
|
||||
|
||||
$response = $chaturmas->delete();
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_chaturmas_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_chaturmas_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->chaturmasService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_chaturmas_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
195
app/Http/Controllers/Backend/ChaturmasDateController.php
Normal file
195
app/Http/Controllers/Backend/ChaturmasDateController.php
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Models\ChaturmasDate;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\ChaturmasDate\StoreChaturmasDateRequest;
|
||||
use App\Http\Requests\ChaturmasDate\UpdateChaturmasDateRequest;
|
||||
use App\Repositories\Backend\ChaturmasDate\ChaturmasDateService;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class ChaturmasDateController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var ChaturmasDateService
|
||||
*/
|
||||
protected $chaturmasDateService;
|
||||
|
||||
/**
|
||||
* ChaturmasDateController constructor.
|
||||
* @param ChaturmasDateService $chaturmasDateService
|
||||
*/
|
||||
public function __construct(ChaturmasDateService $chaturmasDateService)
|
||||
{
|
||||
$this->chaturmasDateService = $chaturmasDateService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getChaturmasDateListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->chaturmasDateService->getForDataTable($request->all());
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.chaturmas-date.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
//
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
return view('backend.chaturmas-date.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreChaturmasDateRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreChaturmasDateRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasDateService->create($request->all());
|
||||
if ($response) {
|
||||
return redirect(route('admin.chaturmas-date.index'))
|
||||
->with('flash_success', __('message.create_chaturmas_date_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_chaturmas_date_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\ChaturmasDate $chaturmas_date
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ChaturmasDate $chaturmas_date)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\ChaturmasDate $chaturmas_date
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ChaturmasDate $chaturmas_date)
|
||||
{
|
||||
try {
|
||||
//
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.chaturmas-date.edit', compact('chaturmas_date'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateChaturmasDateRequest $request
|
||||
* @param \App\Models\ChaturmasDate $chaturmas_date
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateChaturmasDateRequest $request, ChaturmasDate $chaturmas_date)
|
||||
{
|
||||
try {
|
||||
$response = $this->chaturmasDateService->update($chaturmas_date, $request->all());
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.chaturmas-date.index'))
|
||||
->with('flash_success', __('message.update_chaturmas_date_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_chaturmas_date_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\ChaturmasDate $chaturmas_date
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ChaturmasDate $chaturmas_date)
|
||||
{
|
||||
try {
|
||||
|
||||
$response = $chaturmas_date->delete();
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_chaturmas_date_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_chaturmas_date_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->chaturmasDateService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_chaturmas_date_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
43
app/Http/Controllers/Backend/DashboardController.php
Normal file
43
app/Http/Controllers/Backend/DashboardController.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Repositories\Backend\Dashboard\DashboardService;
|
||||
|
||||
class DashboardController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var dashboardService
|
||||
*/
|
||||
protected $dashboardService;
|
||||
|
||||
/**
|
||||
* DashboardController constructor.
|
||||
* @param SantService $dashboardService
|
||||
*/
|
||||
public function __construct(DashboardService $dashboardService)
|
||||
{
|
||||
$this->dashboardService = $dashboardService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function dashboard()
|
||||
{
|
||||
try {
|
||||
$data = [
|
||||
'statistics' => $this->dashboardService->getDashboardStatistics()
|
||||
];
|
||||
|
||||
return view('backend.dashboard', compact(
|
||||
'data'
|
||||
));
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
218
app/Http/Controllers/Backend/DharmaController.php
Normal file
218
app/Http/Controllers/Backend/DharmaController.php
Normal file
@@ -0,0 +1,218 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Dharma;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Dharma\StoreDharmaRequest;
|
||||
use App\Http\Requests\Dharma\UpdateDharmaRequest;
|
||||
use App\Repositories\Backend\Dharma\DharmaService;
|
||||
|
||||
class DharmaController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var DharmaService
|
||||
*/
|
||||
protected $dharmaService;
|
||||
|
||||
/**
|
||||
* DharmaController constructor.
|
||||
* @param DharmaService $dharmaService
|
||||
*/
|
||||
public function __construct(DharmaService $dharmaService)
|
||||
{
|
||||
$this->dharmaService = $dharmaService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getDharmaListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->dharmaService->getForDataTable($request->all());
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.dharma.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
try {
|
||||
//
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
return view('backend.dharma.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreDharmaRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreDharmaRequest $request)
|
||||
{
|
||||
//
|
||||
try {
|
||||
$response = $this->dharmaService->create($request->all());
|
||||
if ($response) {
|
||||
return redirect(route('admin.dharma.index'))
|
||||
->with('flash_success', __('message.create_dharma_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_dharma_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Dharma $dharma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Dharma $dharma)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Dharma $dharma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Dharma $dharma)
|
||||
{
|
||||
try {
|
||||
//
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.dharma.edit', compact('dharma'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateDharmaRequest $request
|
||||
* @param \App\Models\Dharma $dharma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateDharmaRequest $request, Dharma $dharma)
|
||||
{
|
||||
try {
|
||||
$response = $this->dharmaService->update($dharma, $request->all());
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.dharma.index'))
|
||||
->with('flash_success', __('message.update_dharma_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_dharma_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Dharma $dharma
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Dharma $dharma)
|
||||
{
|
||||
try {
|
||||
|
||||
$response = $dharma->delete();
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_dharma_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_dharma_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->dharmaService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_dharm_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Sampraday of related dharma.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getSampradayByDharma(Request $request)
|
||||
{
|
||||
try {
|
||||
$sampraday = $this->dharmaService->getSampradayByDharma($request->all());
|
||||
|
||||
return response()->json([
|
||||
'sampradaies' => $sampraday
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
116
app/Http/Controllers/Backend/HospitalController.php
Normal file
116
app/Http/Controllers/Backend/HospitalController.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Hospital\HospitalStoreRequest;
|
||||
use App\Models\Hospital;
|
||||
use App\Repositories\Backend\Hospital\HospitalService;
|
||||
use Exception;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HospitalController extends Controller
|
||||
{
|
||||
public function __construct(protected HospitalService $hospitalService)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
return view('backend.hospital.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
return view('backend.hospital.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param HospitalStoreRequest $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function store(HospitalStoreRequest $request): RedirectResponse
|
||||
{
|
||||
$response = $this->hospitalService->storeHospital($request);
|
||||
|
||||
if ($response['status']) {
|
||||
return redirect()->route('admin.hospitals.index')
|
||||
->with('flash_success', __('message.create_hospital_success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_hospital_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return View
|
||||
*/
|
||||
public function edit($id): View
|
||||
{
|
||||
$hospital = $this->hospitalService->find($id);
|
||||
return view('backend.hospital.edit', compact('hospital'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param $id
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
$response = $this->hospitalService->updateHospital($request, $id);
|
||||
|
||||
if ($response['status']) {
|
||||
return redirect()->route('admin.hospitals.index')
|
||||
->with('flash_success', __('message.update_hospital_success'));
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_hospital_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function destroy($id): JsonResponse
|
||||
{
|
||||
if ($this->hospitalService->find($id)->delete()) {
|
||||
return response()->json([
|
||||
'success' => Constant::STATUS_TRUE,
|
||||
'message' => __('message.delete_hospital_success')
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'error' => Constant::STATUS_TRUE,
|
||||
'message' => __('message.delete_hospital_error')
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @return object
|
||||
* @throws Exception
|
||||
*/
|
||||
public function listing(Request $request): object
|
||||
{
|
||||
return $this->hospitalService->getListing($request);
|
||||
}
|
||||
|
||||
}
|
||||
197
app/Http/Controllers/Backend/JatiController.php
Normal file
197
app/Http/Controllers/Backend/JatiController.php
Normal file
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Jati;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Jati\StoreJatiRequest;
|
||||
use App\Http\Requests\Jati\UpdateJatiRequest;
|
||||
use App\Models\Dharma;
|
||||
use App\Repositories\Backend\Jati\JatiService;
|
||||
|
||||
class JatiController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var JatiService
|
||||
*/
|
||||
protected $jatiService;
|
||||
|
||||
/**
|
||||
* JatiController constructor.
|
||||
* @param JatiService $jatiService
|
||||
*/
|
||||
public function __construct(JatiService $jatiService)
|
||||
{
|
||||
$this->jatiService = $jatiService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getJatiListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->jatiService->getForDataTable($request->all());
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.jati.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
$dharma = Dharma::pluck('name', 'id');
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
return view('backend.jati.create', compact('dharma'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreJatiRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreJatiRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->jatiService->create($request->all());
|
||||
if ($response) {
|
||||
return redirect(route('admin.jati.index'))
|
||||
->with('flash_success', __('message.create_jati_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_jati_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Jati $jati
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Jati $jati)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Jati $jati
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Jati $jati)
|
||||
{
|
||||
try {
|
||||
$dharma = Dharma::pluck('name', 'id');
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.jati.edit', compact('jati', 'dharma'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateJatiRequest $request
|
||||
* @param \App\Models\Jati $jati
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateJatiRequest $request, Jati $jati)
|
||||
{
|
||||
try {
|
||||
$response = $this->jatiService->update($jati, $request->all());
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.jati.index'))
|
||||
->with('flash_success', __('message.update_jati_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_jati_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Jati $jati
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Jati $jati)
|
||||
{
|
||||
try {
|
||||
|
||||
$response = $jati->delete();
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_jati_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_jati_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->jatiService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_jati_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
214
app/Http/Controllers/Backend/RoleController.php
Normal file
214
app/Http/Controllers/Backend/RoleController.php
Normal file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Role;
|
||||
use App\Models\Permission;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Role\StoreRoleRequest;
|
||||
use App\Http\Requests\Role\UpdateRoleRequest;
|
||||
use App\Repositories\Backend\Role\RoleService;
|
||||
|
||||
class RoleController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var RoleService
|
||||
*/
|
||||
protected $roleService;
|
||||
|
||||
/**
|
||||
* RoleController constructor.
|
||||
* @param RoleService $roleService
|
||||
*/
|
||||
public function __construct(RoleService $roleService)
|
||||
{
|
||||
$this->roleService = $roleService;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getRoleListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->roleService->getForDataTable($request->all());
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.role.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
try {
|
||||
$permission = Permission::all();
|
||||
$permissions = [];
|
||||
foreach ($permission as $key => $value) {
|
||||
$permissions[$value->type][] = $value;
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
return view('backend.role.create', compact('permissions'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreRoleRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreRoleRequest $request)
|
||||
{
|
||||
//
|
||||
try {
|
||||
$response = $this->roleService->create($request->all());
|
||||
if ($response) {
|
||||
return redirect(route('admin.roles.index'))
|
||||
->with('flash_success', __('message.create_role_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_role_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Role $role
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Role $role)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Role $role
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Role $role)
|
||||
{
|
||||
try {
|
||||
$role = Role::find($role->id);
|
||||
$rolePermissions = $role->permissions;
|
||||
$rolePermissions = $rolePermissions->pluck('id')->toArray();
|
||||
$permission = Permission::all();
|
||||
$permissions = [];
|
||||
foreach ($permission as $key => $value) {
|
||||
$permissions[$value->type][] = $value;
|
||||
}
|
||||
|
||||
// $allPermissions = $permissions;
|
||||
|
||||
// dd($rolePermissions, $allPermissions);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.role.edit', compact('role', 'permissions', 'rolePermissions'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateRoleRequest $request
|
||||
* @param \App\Models\Role $role
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateRoleRequest $request, Role $role)
|
||||
{
|
||||
try {
|
||||
$response = $this->roleService->update($role, $request->all());
|
||||
if ($response) {
|
||||
return redirect(route('admin.roles.index'))
|
||||
->with('flash_success', __('message.update_role_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_role_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Role $role
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Role $role)
|
||||
{
|
||||
try {
|
||||
|
||||
$response = $role->delete();
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_role_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_role_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->roleService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_role_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
219
app/Http/Controllers/Backend/SampradayController.php
Normal file
219
app/Http/Controllers/Backend/SampradayController.php
Normal file
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Sampraday;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Sampraday\StoreSampradayRequest;
|
||||
use App\Http\Requests\Sampraday\UpdateSampradayRequest;
|
||||
use App\Models\Dharma;
|
||||
use App\Models\Sant;
|
||||
use App\Repositories\Backend\Sampraday\SampradayService;
|
||||
|
||||
class SampradayController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var SampradayService
|
||||
*/
|
||||
protected $sampradayService;
|
||||
|
||||
/**
|
||||
* SampradayController constructor.
|
||||
* @param SampradayService $sampradayService
|
||||
*/
|
||||
public function __construct(SampradayService $sampradayService)
|
||||
{
|
||||
$this->sampradayService = $sampradayService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getSampradayListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->sampradayService->getForDataTable($request->all());
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sampraday.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
$sants = Sant::pluck('name', 'id');
|
||||
$dharma = Dharma::pluck('name', 'id');
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
return view('backend.sampraday.create', compact('sants', 'dharma'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreSampradayRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreSampradayRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->sampradayService->create($request->all());
|
||||
if ($response) {
|
||||
return redirect(route('admin.sampraday.index'))
|
||||
->with('flash_success', __('message.create_sampraday_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_sampraday_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Sampraday $sampraday
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Sampraday $sampraday)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Sampraday $sampraday
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Sampraday $sampraday)
|
||||
{
|
||||
try {
|
||||
$sants = Sant::pluck('name', 'id');
|
||||
$dharma = Dharma::pluck('name', 'id');
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sampraday.edit', compact('sampraday', 'sants', 'dharma'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateSampradayRequest $request
|
||||
* @param \App\Models\Sampraday $sampraday
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateSampradayRequest $request, Sampraday $sampraday)
|
||||
{
|
||||
try {
|
||||
$response = $this->sampradayService->update($sampraday, $request->all());
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.sampraday.index'))
|
||||
->with('flash_success', __('message.update_sampraday_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_sampraday_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Sampraday $sampraday
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Sampraday $sampraday)
|
||||
{
|
||||
try {
|
||||
|
||||
$response = $sampraday->delete();
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_sampraday_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_sampraday_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->sampradayService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_sampraday_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Gachadhi Pati of related dharma.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function getGachadhiPatiByDharma(Request $request)
|
||||
{
|
||||
try {
|
||||
$gachadhiPaties = $this->sampradayService->getGachadhiPatiByDharma($request->all());
|
||||
|
||||
return response()->json([
|
||||
'gachadhi_paties' => $gachadhiPaties
|
||||
]);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
145
app/Http/Controllers/Backend/SanghController.php
Normal file
145
app/Http/Controllers/Backend/SanghController.php
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use App\Jobs\Notifications\Sangh\SendApproveSangh;
|
||||
use App\Jobs\Notifications\Sangh\SendCreateSanghUser;
|
||||
use App\Jobs\Notifications\Sangh\SendRejectSangh;
|
||||
use App\Models\Dharma;
|
||||
use App\Models\Sampraday;
|
||||
use App\Models\Sangh;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Sangh\StoreSanghRequest;
|
||||
use App\Http\Requests\Sangh\UpdateSanghRequest;
|
||||
use App\Models\User;
|
||||
use App\Models\UserDetail;
|
||||
use App\Repositories\Backend\Sangh\SanghService;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class SanghController extends BaseController
|
||||
{
|
||||
public function __construct(protected SanghService $sanghService)
|
||||
{}
|
||||
|
||||
/**
|
||||
* @return Application|Factory|View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('backend.sangh.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreSanghRequest $request
|
||||
* @return Response
|
||||
*/
|
||||
public function store(StoreSanghRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Sangh $sangh
|
||||
* @return Application|Factory|View
|
||||
*/
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
|
||||
$sangh = $this->sanghService->query()->find($id);
|
||||
$sangh->load('dharma', 'sampraday', 'createdBy');
|
||||
|
||||
$dharma = dharma::all();
|
||||
$sampraday = sampraday::all();
|
||||
|
||||
return view('backend.sangh.detail',compact('sangh', 'dharma', 'sampraday'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param Sangh $sangh
|
||||
* @return Response
|
||||
*/
|
||||
public function edit(Sangh $sangh)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateSanghRequest $request
|
||||
* @param Sangh $sangh
|
||||
* @return Response
|
||||
*/
|
||||
public function update(UpdateSanghRequest $request, Sangh $sangh, $id)
|
||||
{
|
||||
\Log::info('Sangh update started', ['id' => $id, 'status' => $request->status]);
|
||||
|
||||
$allUser = User::all();
|
||||
$user = loggedInUser();
|
||||
|
||||
$sangh = $this->sanghService->query()->find($id);
|
||||
$sangh->name = $request['sangh_name'];
|
||||
$sangh->address = $request['sangh_address'];
|
||||
$sangh->latitude = $request['latitude'];
|
||||
$sangh->longitude = $request['longitude'];
|
||||
|
||||
if ($request->status === 'Approved') {
|
||||
$sangh->sangh_status = 1;
|
||||
$sangh->reject_reason = null;
|
||||
$sangh->save();
|
||||
|
||||
dispatch(new SendApproveSangh($user, $sangh));
|
||||
dispatch(new SendCreateSanghUser($sangh, $allUser));
|
||||
|
||||
return redirect(route('admin.sanghs.index'))
|
||||
->with('flash_success', __('message.approved_sangh_success'));
|
||||
} elseif ($request->status === 'Rejected') {
|
||||
$sangh->sangh_status = 2;
|
||||
$sangh->reject_reason = $request->reject_reason;
|
||||
$sangh->save();
|
||||
|
||||
dispatch(new SendRejectSangh($user, $sangh));
|
||||
|
||||
return redirect(route('admin.sanghs.index'))
|
||||
->with('flash_success', __('message.reject_sangh_success'));
|
||||
} else {
|
||||
$sangh->save();
|
||||
return redirect(route('admin.sanghs.index'))->with('flash_success', __('Sangh details updated successfully'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param Sangh $sangh
|
||||
* @return Response
|
||||
*/
|
||||
public function destroy(Sangh $sangh)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function listing(Request $request)
|
||||
{
|
||||
return $this->sanghService->getListing($request);
|
||||
}
|
||||
}
|
||||
254
app/Http/Controllers/Backend/SantController.php
Normal file
254
app/Http/Controllers/Backend/SantController.php
Normal file
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use Exception;
|
||||
use App\Models\Sant;
|
||||
use App\Models\Thana;
|
||||
use App\Models\Dharma;
|
||||
use App\Models\SantTemp;
|
||||
use App\Models\Sampraday;
|
||||
use App\Constant\Constant;
|
||||
use App\Models\ThanaMember;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Sant\StoreSantRequest;
|
||||
use App\Http\Requests\Sant\UpdateSantRequest;
|
||||
use App\Repositories\Backend\Sant\SantService;
|
||||
|
||||
class SantController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var SantService
|
||||
*/
|
||||
protected $santService;
|
||||
|
||||
/**
|
||||
* SantController constructor.
|
||||
* @param SantService $santService
|
||||
*/
|
||||
public function __construct(SantService $santService)
|
||||
{
|
||||
$this->santService = $santService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getSantListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$response = $this->santService->getForDataTable($request->all());
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$dharmas = Dharma::pluck('name','id');
|
||||
$sampradaies = [];
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sant.list', compact('dharmas', 'sampradaies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
$guruName = Sant::pluck('name','id');
|
||||
$dharmaName = Dharma::pluck('name','id');
|
||||
$sampradayName = [];
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sant.create', compact('guruName', 'dharmaName', 'sampradayName'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreSantRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreSantRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santService->create($request);
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.sant.index'))
|
||||
->with('flash_success', __('message.create_sant_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_sant_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Sant $sant)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(SantTemp $sant)
|
||||
{
|
||||
try {
|
||||
$thanaMembers = [];
|
||||
$thana = [];
|
||||
$santLive = Sant::find($sant->sant_id);
|
||||
$thanaMemberExist = ThanaMember::where('sant_id', $sant->sant_id)->select('thana_id')->first();
|
||||
|
||||
if (!empty($thanaMemberExist)) {
|
||||
$thanaOfSant = $santLive->ownedThana()->first();
|
||||
$thana = Thana::find($thanaMemberExist->thana_id);
|
||||
$thanaMembers = $thana->getThanaMember()->with(['dharm', 'sampraday'])->get();
|
||||
}
|
||||
|
||||
$guruName = SantTemp::pluck('name','sant_id');
|
||||
$dharmaName = Dharma::pluck('name','id');
|
||||
$sampradayName = Sampraday::pluck('name','id');
|
||||
$sant = $sant->load(['sampraday', 'createdBy:id,name', 'updatedBy:id,name']);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sant.edit', compact('guruName', 'dharmaName', 'sampradayName', 'sant', 'thana', 'thanaMembers', 'santLive'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateSantRequest $request
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateSantRequest $request, SantTemp $sant)
|
||||
{
|
||||
try {
|
||||
$response = $this->santService->update($sant, $request);
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.sant.index'))
|
||||
->with('flash_success', __('message.update_sant_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_sant_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Sant $sant
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Sant $sant)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->santService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_sant_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Import bulk sant data from excel.
|
||||
*
|
||||
* @param \App\Http\Requests\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function import(Request $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->santService->importSant($request);
|
||||
|
||||
// if ($response) {
|
||||
return redirect(route('admin.sant.index'))
|
||||
->with('flash_success', __('message.sant_import_success'));
|
||||
// }
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.something_went_wrong'));
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is to remove thana memeber
|
||||
*
|
||||
* @param \App\Http\Requests\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function removeThanaMember($santID, $thanaID)
|
||||
{
|
||||
try {
|
||||
$response = $this->santService->removeThanaMember($santID, $thanaID);
|
||||
|
||||
if ($response) {
|
||||
return redirect()->back()->with('flash_success', __('message.remove_thana_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
}
|
||||
202
app/Http/Controllers/Backend/UserController.php
Normal file
202
app/Http/Controllers/Backend/UserController.php
Normal file
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use Exception;
|
||||
use App\Models\User;
|
||||
use App\Models\UserDetail;
|
||||
use App\Models\Dharma;
|
||||
use App\Models\Jati;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\User\StoreUserRequest;
|
||||
use App\Http\Requests\User\UpdateUserRequest;
|
||||
use App\Repositories\Backend\User\UserService;
|
||||
|
||||
class UserController extends BaseController
|
||||
{
|
||||
/**
|
||||
* @var UserService
|
||||
*/
|
||||
protected $userService;
|
||||
|
||||
/**
|
||||
* UserController constructor.
|
||||
* @param UserService $userService
|
||||
*/
|
||||
public function __construct(UserService $userService)
|
||||
{
|
||||
$this->userService = $userService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getUserListing(Request $request)
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->userService->getForDataTable($request->all());
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.user.list');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
try {
|
||||
//
|
||||
$dharmaList = Dharma::pluck('name','id');
|
||||
$jatiList = Jati::pluck('name','id');
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
return view('backend.user.create', compact('dharmaList', 'jatiList'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreUserRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreUserRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->userService->create($request);
|
||||
if ($response) {
|
||||
return redirect(route('admin.user.index'))
|
||||
->with('flash_success', __('message.create_user_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_user_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(user $user)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(User $user)
|
||||
{
|
||||
try {
|
||||
$dharmaList = Dharma::pluck('name','id');
|
||||
$jatiList = Jati::pluck('name','id');
|
||||
$userDetail = UserDetail::where('user_id',$user->id)->first();
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
return view('backend.user.edit', compact('dharmaList','jatiList','user','userDetail'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateUserRequest $request
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateUserRequest $request, User $user)
|
||||
{
|
||||
try {
|
||||
$response = $this->userService->update($user, $request);
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.user.index'))
|
||||
->with('flash_success', __('message.update_user_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_user_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\User $user
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(User $user)
|
||||
{
|
||||
try {
|
||||
|
||||
$response = $user->delete();
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_user_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_user_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->userService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_user_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
}
|
||||
199
app/Http/Controllers/Backend/ViharController.php
Normal file
199
app/Http/Controllers/Backend/ViharController.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Backend;
|
||||
|
||||
use App\Models\Sant;
|
||||
use App\Models\Vihar;
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use App\Http\Controllers\BaseController;
|
||||
use App\Http\Requests\Vihar\StoreViharRequest;
|
||||
use App\Http\Requests\Vihar\UpdateViharRequest;
|
||||
use App\Repositories\Backend\Vihar\ViharService;
|
||||
|
||||
class ViharController extends BaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* @var ViharService
|
||||
*/
|
||||
protected $viharService;
|
||||
|
||||
/**
|
||||
* ViharController constructor.
|
||||
* @param ViharService $viharService
|
||||
*/
|
||||
public function __construct(ViharService $viharService)
|
||||
{
|
||||
$this->viharService = $viharService;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is returning the Datatable columns response
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array|object
|
||||
*/
|
||||
public function getViharListing(Request $request, Sant $sant)
|
||||
{
|
||||
$response = [];
|
||||
try {
|
||||
$response = $this->viharService->getForDataTable($request->all(), $sant->id);
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Sant $sant)
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sant.sant-vihar.list', compact('sant'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create(Sant $sant)
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sant.sant-vihar.create', compact('sant'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreViharRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Sant $sant,StoreViharRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->viharService->create($request,$sant->id);
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.sant.vihar.index',compact('sant')))
|
||||
->with('flash_success', __('message.create_vihar_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.create_vihar_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Vihar $vihar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Sant $sant,Vihar $vihar)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Vihar $vihar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Sant $sant,Vihar $vihar)
|
||||
{
|
||||
try {
|
||||
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return view('backend.sant.sant-vihar.edit', compact('vihar', 'sant'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateViharRequest $request
|
||||
* @param \App\Models\Vihar $vihar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateViharRequest $request, Sant $sant, Vihar $vihar)
|
||||
{
|
||||
try {
|
||||
$response = $this->viharService->update($vihar, $request->all(), $sant->id);
|
||||
|
||||
if ($response) {
|
||||
return redirect(route('admin.sant.vihar.index',compact('sant')))
|
||||
->with('flash_success', __('message.update_vihar_success'));
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return redirect()->back()->with('flash_error', __('message.update_vihar_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Vihar $vihar
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Sant $sant,Vihar $vihar)
|
||||
{
|
||||
try {
|
||||
|
||||
$response = $vihar->delete();
|
||||
if ($response) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.delete_vihar_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.delete_vihar_error')]);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is for the grid checkbox multiple records actions
|
||||
*
|
||||
* @param Request $request
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function gridRecordsAction(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$actionType = $request->action_type ?? Constant::NULL;
|
||||
$checkedRecords = $request->checked_records ?? [];
|
||||
$updateStatus = $this->viharService->gridActions($actionType, $checkedRecords);
|
||||
|
||||
if ($updateStatus) {
|
||||
return response()->json(['success' => Constant::STATUS_TRUE, 'message' => __('message.update_vihar_success')]);
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
Log::error($ex->getMessage());
|
||||
}
|
||||
|
||||
return response()->json(['error' => Constant::STATUS_TRUE, 'message' => __('message.something_went_wrong')]);
|
||||
}
|
||||
|
||||
}
|
||||
133
app/Http/Controllers/BaseController.php
Normal file
133
app/Http/Controllers/BaseController.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use App\Models\Post;
|
||||
use App\Models\Sangh;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BaseController extends ApiController
|
||||
{
|
||||
/**
|
||||
* Boolean status code
|
||||
*/
|
||||
const STATUS_ZERO = 0;
|
||||
const STATUS_ONE = 1;
|
||||
const STATUS_TRUE = true;
|
||||
const STATUS_FALSE = false;
|
||||
const STATUS_ACTIVE = 'active';
|
||||
const STATUS_INACTIVE = 'inactive';
|
||||
const STATUS_DELETE = 'delete';
|
||||
|
||||
/**
|
||||
* HTTP status code
|
||||
*/
|
||||
const HTTP_STATUS_CODE_200 = 200; // 200: OK. The standard success code and default option.
|
||||
const HTTP_STATUS_CODE_201 = 201; // 201: Object created. Useful for the store actions.
|
||||
const HTTP_STATUS_CODE_204 = 204; // 204: No content. When an action was executed successfully, but there is no content to return.
|
||||
const HTTP_STATUS_CODE_206 = 206; // 206: Partial content. Useful when you have to return a paginated list of resources.
|
||||
const HTTP_STATUS_CODE_400 = 400; // 400: Bad request. The standard option for requests that fail to pass validation.
|
||||
const HTTP_STATUS_CODE_401 = 401; // 401: Unauthorized. The user needs to be authenticated.
|
||||
const HTTP_STATUS_CODE_403 = 403; // 403: Forbidden. The user is authenticated, but does not have the permissions to perform an action.
|
||||
const HTTP_STATUS_CODE_422 = 422; // 403: Forbidden. The user is authenticated, but does not have the permissions to perform an action.
|
||||
const HTTP_STATUS_CODE_404 = 404; // 403: Forbidden. The user is authenticated, but does not have the permissions to perform an action.
|
||||
const HTTP_STATUS_CODE_500 = 500; // 404: Not found. This will be returned automatically by Laravel when the resource is not found.
|
||||
const HTTP_STATUS_CODE_503 = 503; // 500: Internal server error. Ideally you're not going to be explicitly returning this, but if something unexpected breaks, this is what your user is going to receive.
|
||||
|
||||
|
||||
public function getInformativePage(Request $request)
|
||||
{
|
||||
try {
|
||||
$page = $request->page;
|
||||
$response['content'] = trans('informative-page.'.$page);
|
||||
|
||||
return $this->respond(['content' => $response['content'], 'status_code' => $this->getStatusCode()]);
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
$this->setStatusCode(Constant::CODE_403);
|
||||
}
|
||||
}
|
||||
|
||||
public function getLandingPage()
|
||||
{
|
||||
try {
|
||||
return view('web.landing');
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
|
||||
public function getLandingPageWithMeta($id)
|
||||
{
|
||||
$post = [];
|
||||
$createdBy = "";
|
||||
|
||||
try {
|
||||
$post = Post::with([
|
||||
'tagUsers:id,name,avatar',
|
||||
'postImages',
|
||||
'category',
|
||||
'postMention',
|
||||
'createdBy:id,name,avatar,created_at,updated_at',
|
||||
'updatedBy:id,name,avatar,created_at,updated_at'
|
||||
])->find($id);
|
||||
|
||||
if (!empty(request()->type) && request()->type == Constant::STATUS_ONE) {
|
||||
$createdBy = $post->createdBy->name;
|
||||
} else if (!empty(request()->type) && request()->type == Constant::STATUS_THREE) {
|
||||
$createdById = $post->created_by;
|
||||
$createdBy = Sangh::where('id', $createdById)->value('name');
|
||||
} else {
|
||||
$createdBy = env('APP_NAME');
|
||||
}
|
||||
|
||||
return view('web.landing-new', compact('post', 'createdBy'));
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
|
||||
public function getTermsAndConditionsPage()
|
||||
{
|
||||
try {
|
||||
return view('web.terms-and-conditions');
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
|
||||
public function getPrivacyPolicyPage()
|
||||
{
|
||||
try {
|
||||
return view('web.privacy-policy');
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
|
||||
public function getContributionPage()
|
||||
{
|
||||
try {
|
||||
return view('web.contribution');
|
||||
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAppleAppSiteID()
|
||||
{
|
||||
try {
|
||||
return response(view('web.apple-app-site-association'), 200, ['Content-Type' => 'application/json']);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
86
app/Http/Controllers/CategoryController.php
Normal file
86
app/Http/Controllers/CategoryController.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Http\Requests\StoreCategoryRequest;
|
||||
use App\Http\Requests\UpdateCategoryRequest;
|
||||
|
||||
class CategoryController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreCategoryRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreCategoryRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Category $category
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Category $category)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Category $category
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Category $category)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateCategoryRequest $request
|
||||
* @param \App\Models\Category $category
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateCategoryRequest $request, Category $category)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Category $category
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Category $category)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
13
app/Http/Controllers/Controller.php
Normal file
13
app/Http/Controllers/Controller.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
86
app/Http/Controllers/DesignationController.php
Normal file
86
app/Http/Controllers/DesignationController.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Designation;
|
||||
use App\Http\Requests\StoreDesignationRequest;
|
||||
use App\Http\Requests\UpdateDesignationRequest;
|
||||
|
||||
class DesignationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreDesignationRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreDesignationRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Designation $designation
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Designation $designation)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Designation $designation
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Designation $designation)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateDesignationRequest $request
|
||||
* @param \App\Models\Designation $designation
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateDesignationRequest $request, Designation $designation)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Designation $designation
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Designation $designation)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
28
app/Http/Controllers/HomeController.php
Normal file
28
app/Http/Controllers/HomeController.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Support\Renderable
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('home');
|
||||
}
|
||||
}
|
||||
121
app/Http/Controllers/PostController.php
Normal file
121
app/Http/Controllers/PostController.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Post;
|
||||
use App\Http\Requests\Api\Post\StorePostRequest;
|
||||
use App\Http\Requests\Api\Post\UpdatePostRequest;
|
||||
use App\Repositories\Api\Access\Post\PostInterface as PostRepo;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use App\Http\Controllers\Api\ApiController;
|
||||
|
||||
class PostController extends ApiController
|
||||
{
|
||||
/**
|
||||
* @param PostRepo $userRepo
|
||||
* PostController constructor.
|
||||
*/
|
||||
public function __construct(PostRepo $postRepo)
|
||||
{
|
||||
$this->postRepo = $postRepo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepo->getAllPosts();
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StorePostRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StorePostRequest $request)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepo->storePost($request->all());
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Post $post)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Post $post)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdatePostRequest $request
|
||||
* @param \App\Models\Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdatePostRequest $request, Post $post)
|
||||
{
|
||||
try {
|
||||
$response = $this->postRepo->updatePost($request->all(), $post);
|
||||
$this->updateStatusCode($response);
|
||||
|
||||
return $this->respond($response);
|
||||
} catch (\Exception $ex) {
|
||||
Log::error($ex);
|
||||
return $this->respondInternalError(trans('api.something_went_wrong'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Post $post
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Post $post)
|
||||
{ //
|
||||
}
|
||||
}
|
||||
86
app/Http/Controllers/PostImageController.php
Normal file
86
app/Http/Controllers/PostImageController.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\PostImage;
|
||||
use App\Http\Requests\StorePostImageRequest;
|
||||
use App\Http\Requests\UpdatePostImageRequest;
|
||||
|
||||
class PostImageController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StorePostImageRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StorePostImageRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\PostImage $postImage
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(PostImage $postImage)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\PostImage $postImage
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(PostImage $postImage)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdatePostImageRequest $request
|
||||
* @param \App\Models\PostImage $postImage
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdatePostImageRequest $request, PostImage $postImage)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\PostImage $postImage
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(PostImage $postImage)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
86
app/Http/Controllers/ThanaController.php
Normal file
86
app/Http/Controllers/ThanaController.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Thana;
|
||||
use App\Http\Requests\StoreThanaRequest;
|
||||
use App\Http\Requests\UpdateThanaRequest;
|
||||
|
||||
class ThanaController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreThanaRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreThanaRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Thana $thana)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Thana $thana)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateThanaRequest $request
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateThanaRequest $request, Thana $thana)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Thana $thana
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Thana $thana)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
86
app/Http/Controllers/ThanaMemberController.php
Normal file
86
app/Http/Controllers/ThanaMemberController.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\ThanaMember;
|
||||
use App\Http\Requests\StoreThanaMemberRequest;
|
||||
use App\Http\Requests\UpdateThanaMemberRequest;
|
||||
|
||||
class ThanaMemberController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\StoreThanaMemberRequest $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(StoreThanaMemberRequest $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\ThanaMember $thanaMember
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(ThanaMember $thanaMember)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\ThanaMember $thanaMember
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(ThanaMember $thanaMember)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \App\Http\Requests\UpdateThanaMemberRequest $request
|
||||
* @param \App\Models\ThanaMember $thanaMember
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(UpdateThanaMemberRequest $request, ThanaMember $thanaMember)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\ThanaMember $thanaMember
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(ThanaMember $thanaMember)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
67
app/Http/Kernel.php
Normal file
67
app/Http/Kernel.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\Cors::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
// \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
||||
21
app/Http/Middleware/Authenticate.php
Normal file
21
app/Http/Middleware/Authenticate.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('admin.login');
|
||||
}
|
||||
}
|
||||
}
|
||||
31
app/Http/Middleware/Cors.php
Normal file
31
app/Http/Middleware/Cors.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Cors
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next)
|
||||
{
|
||||
$response = $next($request);
|
||||
|
||||
$response->header("Access-Control-Allow-Origin","*");
|
||||
$response->header("Access-Control-Allow-Credentials","true");
|
||||
$response->header("Access-Control-Max-Age","600"); // cache for 10 minutes
|
||||
|
||||
$response->header("Access-Control-Allow-Methods","POST, GET, OPTIONS, DELETE, PUT"); //Make sure you remove those you do not want to support
|
||||
|
||||
$response->header("Access-Control-Allow-Headers", "Content-Type, Accept, Authorization, X-Requested-With, Application");
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
17
app/Http/Middleware/EncryptCookies.php
Normal file
17
app/Http/Middleware/EncryptCookies.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
||||
32
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
32
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param string|null ...$guards
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
19
app/Http/Middleware/TrimStrings.php
Normal file
19
app/Http/Middleware/TrimStrings.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
||||
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
||||
28
app/Http/Middleware/TrustProxies.php
Normal file
28
app/Http/Middleware/TrustProxies.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
||||
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'api/*'
|
||||
];
|
||||
}
|
||||
32
app/Http/Requests/Api/Chaturmas/GetChaturmasRequest.php
Normal file
32
app/Http/Requests/Api/Chaturmas/GetChaturmasRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\Chaturmas;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class GetChaturmasRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'page' => 'integer',
|
||||
'limit' => 'integer',
|
||||
'sant_id' => 'required|exists:sants,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
45
app/Http/Requests/Api/Chaturmas/StoreChaturmasRequest.php
Normal file
45
app/Http/Requests/Api/Chaturmas/StoreChaturmasRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\Chaturmas;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreChaturmasRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'sant_id' => 'exists:sants,id',
|
||||
'sagh_id' => 'exists:sanghs,id',
|
||||
'place' => 'nullable',
|
||||
'year' => 'required|exists:chaturmas_dates,id|date_format:Y',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return [
|
||||
'year.exists' => 'Chaturmas already exist for selected year.',
|
||||
];
|
||||
}
|
||||
}
|
||||
45
app/Http/Requests/Api/Chaturmas/UpdateChaturmasRequest.php
Normal file
45
app/Http/Requests/Api/Chaturmas/UpdateChaturmasRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\Chaturmas;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateChaturmasRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'sant_id' => 'exists:sants,id',
|
||||
'sagh_id' => 'exists:sanghs,id',
|
||||
'place' => 'nullable',
|
||||
'year' => 'required|exists:chaturmas_dates,id|date_format:Y',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function message()
|
||||
{
|
||||
return [
|
||||
'year.exists' => 'Chaturmas already exist for selected year.',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\ChaturmasReview;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreChaturmasReviewRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'sant_id' => 'required|exists:sants,id',
|
||||
'comment' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\ChaturmasReview;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateChaturmasReviewRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
31
app/Http/Requests/Api/FriendRequest/StoreFriendRequest.php
Normal file
31
app/Http/Requests/Api/FriendRequest/StoreFriendRequest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\FriendRequest;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreFriendRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Constant::STATUS_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'receiver_id' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Http/Requests/Api/FriendRequest/UpdateFriendRequest.php
Normal file
32
app/Http/Requests/Api/FriendRequest/UpdateFriendRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\FriendRequest;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateFriendRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Constant::STATUS_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'receiver_id' => 'required',
|
||||
'status' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
37
app/Http/Requests/Api/Insurance/StoreInsuranceRequest.php
Normal file
37
app/Http/Requests/Api/Insurance/StoreInsuranceRequest.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\Insurance;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StoreInsuranceRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'hospital_id' => 'required',
|
||||
'full_name' => 'required',
|
||||
'address' => 'required',
|
||||
'email' => 'required|email',
|
||||
'medical_problem' => 'required',
|
||||
'aadhar_card_number' => 'required|max:12|min:12',
|
||||
'aadhar_card_front_photo' => 'required|image|mimes:jpeg,png,jpg,webp|max:2048',
|
||||
'aadhar_card_back_photo' => 'required|image|mimes:jpeg,png,jpg,webp|max:2048',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\PassiveUser;
|
||||
|
||||
use App\Constant\Constant;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class StorePassiveUserRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Constant::STATUS_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'relationship' => 'required',
|
||||
'birth_date' => 'required|date_format:Y-m-d|lessThan:14',
|
||||
'avatar' => 'mimes:jpeg,png,jpg',
|
||||
// 'school_name' => 'required',
|
||||
// 'about' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'birth_date.less_than' => "Age must me less than 14 years",
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\PassiveUser;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use App\Constant\Constant;
|
||||
|
||||
class UpdatePassiveUserRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return Constant::STATUS_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'name' => 'required',
|
||||
'relationship' => 'required',
|
||||
'birth_date' => 'required|date_format:Y-m-d|lessThan:14',
|
||||
'avatar' => 'mimes:jpeg,png,jpg',
|
||||
// 'school_name' => 'required',
|
||||
// 'about' => 'required'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation messages that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function messages()
|
||||
{
|
||||
return [
|
||||
'birth_date.less_than' => "Age must me less than 14 years",
|
||||
];
|
||||
}
|
||||
}
|
||||
32
app/Http/Requests/Api/Post/GetSantPostRequest.php
Normal file
32
app/Http/Requests/Api/Post/GetSantPostRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\Post;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class GetSantPostRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$array = [
|
||||
'sant_id' => 'nullable|exists:sants,id',
|
||||
];
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
31
app/Http/Requests/Api/Post/PostAddCommentRequest.php
Normal file
31
app/Http/Requests/Api/Post/PostAddCommentRequest.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\Api\Post;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class PostAddCommentRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'post_id' => 'required|exists:posts,id',
|
||||
'reply_id' => 'nullable|exists:post_comments,id',
|
||||
];
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user