Commit c72cd274 authored by Viral Solani's avatar Viral Solani Committed by StyleCI Bot

Apply fixes from StyleCI

parent 4b342088
......@@ -2,24 +2,24 @@
namespace App\Api\V1\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Api\CmsPage\CmsPageRepository;
class CmsPageController extends Controller
{
public function __construct(CmsPageRepository $cmsgpage)
public function __construct(CmsPageRepository $cmsgpage)
{
$this->cmsgpage=$cmsgpage;
$this->cmsgpage = $cmsgpage;
}
public function showCmsPage($page_slug)
public function showCmsPage($page_slug)
{
$result = $this->cmsgpage->findBySlug($page_slug);
return response()
$result = $this->cmsgpage->findBySlug($page_slug);
return response()
->json([
'status' => 'ok',
'data' => $result
'status' => 'ok',
'data' => $result,
]);
}
}
<?php
namespace App\Api\V1\Controllers;
use Illuminate\Http\Request;
use App\Api\V1\Requests\ForgotPasswordRequest;
use App\Http\Controllers\Controller;
use Tymon\JWTAuth\JWTAuth;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use App\Repositories\Api\User\UserRepository;
use App\Mail\ForgotPasswordMail;
use App\Api\V1\Requests\ForgotPasswordRequest;
use App\Repositories\Api\User\PasswordResetRepository;
use Illuminate\Support\Facades\Password;
use App\Repositories\Api\User\UserRepository;
use Carbon\Carbon;
use Illuminate\Support\Facades\Password;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Class ForgotPasswordController.
......@@ -18,51 +17,48 @@ use Carbon\Carbon;
class ForgotPasswordController extends Controller
{
/**
* @var UserRepository
*/
* @var UserRepository
*/
protected $user;
/**
* ForgotPasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user,PasswordResetRepository $passwordreset)
* ForgotPasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user, PasswordResetRepository $passwordreset)
{
$this->user = $user;
$this->passwordreset=$passwordreset;
$this->user = $user;
$this->passwordreset = $passwordreset;
}
/**
* Recovery password api.
*/
* Recovery password api.
*/
public function forgotpassword(ForgotPasswordRequest $request)
{
$check_user=$this->user->checkUser($request->get('email'));
if(!(empty($check_user)))
{
$otp=$this->user->generateOTP();
$attributes=array(
'email' => $request->get('email'),
'token' => $otp,
'created_at' => Carbon::now()
);
$check_reset=$this->passwordreset->getByEmail($request->get('email'));
if(empty($check_reset))
{
$token=$this->passwordreset->create($attributes);
}
else
{
$token=$this->passwordreset->update($attributes);
$check_user = $this->user->checkUser($request->get('email'));
if (!(empty($check_user))) {
$otp = $this->user->generateOTP();
$attributes = [
'email' => $request->get('email'),
'token' => $otp,
'created_at' => Carbon::now(),
];
$check_reset = $this->passwordreset->getByEmail($request->get('email'));
if (empty($check_reset)) {
$token = $this->passwordreset->create($attributes);
} else {
$token = $this->passwordreset->update($attributes);
}
$forgot_mail=\Mail::to($request->get('email'))->send(new ForgotPasswordMail($otp));
$forgot_mail = \Mail::to($request->get('email'))->send(new ForgotPasswordMail($otp));
return response()->json([
'status' => 'ok',
'data' => ['token' => $otp]
'status' => 'ok',
'data' => ['token' => $otp],
], 200);
}
throw new HttpException(500,trans('validation.api.forgotpassword.email_not_valid'));
throw new HttpException(500, trans('validation.api.forgotpassword.email_not_valid'));
}
}
\ No newline at end of file
<?php
namespace App\Api\V1\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\http\Controllers\Controller;
use Tymon\JWTAuth\JWTAuth;
use App\Api\V1\Requests\LoginRequest;
use App\http\Controllers\Controller;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Tymon\JWTAuth\Exceptions\JWTException;
use Tymon\JWTAuth\JWTAuth;
/**
* Class LoginController.
......@@ -18,29 +18,27 @@ class LoginController extends Controller
*/
public function login(LoginRequest $request, JWTAuth $JWTAuth)
{
$credentials=array(
'email' => $request->email,
'password' => $request->password
);
try {
/**
* check credentials valid or not
*/
$token = $JWTAuth->attempt($credentials);
if(!$token)
{
$credentials = [
'email' => $request->email,
'password' => $request->password,
];
try {
/**
* check credentials valid or not.
*/
$token = $JWTAuth->attempt($credentials);
if (!$token) {
throw new AccessDeniedHttpException(trans('validation.api.login.username_password_didnt_match'));
}
}catch (JWTException $e) {
} catch (JWTException $e) {
throw new HttpException(500);
}
return response()
return response()
->json([
'status' => 'ok',
'token' => $token
'status' => 'ok',
'token' => $token,
]);
}
}
\ No newline at end of file
<?php
namespace App\Api\V1\Controllers;
use Illuminate\Http\Request;
use App\Api\V1\Requests\ConfirmAccountRequest;
use App\Api\V1\Requests\RegisterRequest;
use App\Http\Controllers\Controller;
use App\Repositories\Api\User\UserRepository;
use App\Api\V1\Requests\RegisterRequest;
use App\Api\V1\Requests\ConfirmAccountRequest;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
......@@ -13,65 +14,59 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
class RegisterController extends Controller
{
/**
* @var UserRepository
*/
* @var UserRepository
*/
protected $user;
/**
* RegisterController constructor.
*
* @param UserRepository $user
*/
* RegisterController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user)
{
$this->user = $user;
$this->user = $user;
}
/*
* Register api.
*/
public function Register(RegisterRequest $request)
{
$user=$this->user->create($request->all());
return response()
$user = $this->user->create($request->all());
return response()
->json([
'status' => 'ok'
'status' => 'ok',
]);
}
/*
* Confirm account api
*/
public function confirmAccount(ConfirmAccountRequest $request)
{
$user=$this->user->checkUser($request->get('email'));
if(!(empty($user)))
{
if($user[0]['confirmation_code']!='')
{
if(md5($request->get('otp'))==$user[0]['confirmation_code'])
{
$checkconfirmation=$this->user->checkconfirmation($request->get('email'));
if($checkconfirmation[0]['confirmed']==0)
{
$confirmuser=$this->user->confirmUser($request->get('email'));
}
else
{
throw new HttpException(500,trans('validation.api.confirmaccount.already_confirmed'));
{
$user = $this->user->checkUser($request->get('email'));
if (!(empty($user))) {
if ($user[0]['confirmation_code'] != '') {
if (md5($request->get('otp')) == $user[0]['confirmation_code']) {
$checkconfirmation = $this->user->checkconfirmation($request->get('email'));
if ($checkconfirmation[0]['confirmed'] == 0) {
$confirmuser = $this->user->confirmUser($request->get('email'));
} else {
throw new HttpException(500, trans('validation.api.confirmaccount.already_confirmed'));
}
}
else
{
throw new HttpException(500,trans('validation.api.confirmaccount.invalid_otp'));
} else {
throw new HttpException(500, trans('validation.api.confirmaccount.invalid_otp'));
}
}
}
else
{
throw new HttpException(500,trans('validation.api.confirmaccount.invalid_email'));
} else {
throw new HttpException(500, trans('validation.api.confirmaccount.invalid_email'));
}
return response()
->json([
'status' => 'ok'
'status' => 'ok',
]);
}
}
<?php
namespace App\Api\V1\Controllers;
use Illuminate\Http\Request;
use App\Api\V1\Requests\ResetPasswordRequest;
use App\Http\Controllers\Controller;
use Tymon\JWTAuth\JWTAuth;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use App\Repositories\Api\User\UserRepository;
use App\Repositories\Api\User\PasswordResetRepository;
use App\Repositories\Api\User\UserRepository;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use App\Api\V1\Requests\ResetPasswordRequest;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
* Class ResetPasswordController.
......@@ -16,45 +16,50 @@ use App\Api\V1\Requests\ResetPasswordRequest;
class ResetPasswordController extends Controller
{
/**
* @var UserRepository
*/
* @var UserRepository
*/
protected $user;
/**
* ResetPasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user,PasswordResetRepository $passwordreset)
* ResetPasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user, PasswordResetRepository $passwordreset)
{
$this->user = $user;
$this->passwordreset=$passwordreset;
$this->passwordreset = $passwordreset;
}
/**
* Resetpassword api.
*/
* Resetpassword api.
*/
public function resetpassword(ResetPasswordRequest $request)
{
$check_user=$this->user->checkUser($request->get('email'));
if(!(empty($check_user)))
{
$check_user = $this->user->checkUser($request->get('email'));
if (!(empty($check_user))) {
$response = $this->passwordreset->checkUser($this->credentials($request));
if(!(empty($response)))
{
$resetpassword=$this->user->resetpassword($this->credentials($request));
$remove_token=$this->passwordreset->delete($this->credentials($request));
if (!(empty($response))) {
$resetpassword = $this->user->resetpassword($this->credentials($request));
$remove_token = $this->passwordreset->delete($this->credentials($request));
return response()
->json([
'status' => 'ok',
]);
}
throw new HttpException(500,trans('validation.api.resetpassword.token_not_valid'));
throw new HttpException(500, trans('validation.api.resetpassword.token_not_valid'));
}
throw new HttpException(500,trans('validation.api.resetpassword.email_not_valid'));
throw new HttpException(500, trans('validation.api.resetpassword.email_not_valid'));
}
/**
* Get the password reset credentials from the request.
*
* @param ResetPasswordRequest $request
* @param ResetPasswordRequest $request
*
* @return array
*/
protected function credentials(ResetPasswordRequest $request)
......@@ -63,5 +68,4 @@ class ResetPasswordController extends Controller
'email', 'password', 'password_confirmation', 'token'
);
}
}
<?php
namespace App\Api\V1\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\http\Controllers\Controller;
use JWTAuth;
use Dingo\Api\Routing\Helpers;
use App\Repositories\Api\User\UserRepository;
use Dingo\Api\Routing\Helpers;
use Illuminate\Http\Request;
use JWTAuth;
/**
* Class UserDetailController.
*/
class UserDetailController extends Controller
{
use Helpers;
/**
* @var UserRepository
*/
* @var UserRepository
*/
protected $user;
/**
* ResetPasswordController constructor.
*
* @param UserRepository $user
*/
* ResetPasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user)
{
$this->user = $user;
}
/*
* User details api
*/
public function userDetails(Request $request)
{
{
$currentUser = JWTAuth::parseToken()->authenticate();
$user=$this->user->getById($currentUser->id);
$user = $this->user->getById($currentUser->id);
return response()
->json([
'status' => 'ok',
'data' => $user
'status' => 'ok',
'data' => $user,
]);
}
}
<?php
namespace App\Api\V1\Requests;
use Config;
use Dingo\Api\Http\FormRequest;
......
<?php
namespace App\Api\V1\Requests;
use Config;
use Dingo\Api\Http\FormRequest;
......@@ -24,15 +26,17 @@ class ForgotPasswordRequest extends FormRequest
{
return Config::get('api_validation.forgotpassword.rules');
}
/**
* Get the messages for validation rules.
*
* @return array
*/
public function messages(){
return[
'email.required' => trans('validation.api.login.email_required'),
'email.email' => trans('validation.api.login.valid_email'),
];
public function messages()
{
return[
'email.required' => trans('validation.api.login.email_required'),
'email.email' => trans('validation.api.login.valid_email'),
];
}
}
<?php
namespace App\Api\V1\Requests;
use Config;
use Dingo\Api\Http\FormRequest;
......@@ -24,16 +26,18 @@ class LoginRequest extends FormRequest
{
return Config::get('api_validation.login.rules');
}
/**
* Get the messages for validation rules.
*
* @return array
*/
public function messages(){
return[
'email.required' => trans('validation.api.login.email_required'),
'email.email' => trans('validation.api.login.valid_email'),
'password.required' => trans('validation.api.login.password_required'),
];
public function messages()
{
return[
'email.required' => trans('validation.api.login.email_required'),
'email.email' => trans('validation.api.login.valid_email'),
'password.required' => trans('validation.api.login.password_required'),
];
}
}
<?php
namespace App\Api\V1\Requests;
use Config;
use Dingo\Api\Http\FormRequest;
......@@ -22,9 +23,10 @@ class RegisterRequest extends FormRequest
* @return array
*/
public function rules()
{
{
return Config::get('api_validation.register.rules');
}
/**
* Get the validation massages that apply to the rules.
*
......@@ -34,7 +36,7 @@ class RegisterRequest extends FormRequest
{
return [
'state_id.required' => trans('validation.api.register.state_required'),
'city_id.required' => trans('validation.api.register.city_required'),
'city_id.required' => trans('validation.api.register.city_required'),
];
}
}
<?php
namespace App\Api\V1\Requests;
use Config;
use Dingo\Api\Http\FormRequest;
......@@ -24,19 +26,21 @@ class ResetPasswordRequest extends FormRequest
{
return Config::get('api_validation.resetpassword.rules');
}
/**
* Get the messages for validation rules.
*
* @return array
*/
public function messages(){
return[
'email.required' => trans('validation.api.resetpassword.email_required'),
'email.email' => trans('validation.api.resetpassword.valid_email'),
'password.required' => trans('validation.api.resetpassword.password_required'),
'password.confirmed' => trans('validation.api.resetpassword.password_confirmed'),
'token.required' => trans('validation.api.resetpassword.token_required'),
public function messages()
{
return[
'email.required' => trans('validation.api.resetpassword.email_required'),
'email.email' => trans('validation.api.resetpassword.valid_email'),
'password.required' => trans('validation.api.resetpassword.password_required'),
'password.confirmed' => trans('validation.api.resetpassword.password_confirmed'),
'token.required' => trans('validation.api.resetpassword.token_required'),
'password_confirmation.required' => trans('validation.api.resetpassword.confirm_password_required'),
];
}
];
}
}
......@@ -3,9 +3,9 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Console\DetectsApplicationNamespace;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Console\DetectsApplicationNamespace;
class ModuleGenerator extends Command
{
......@@ -15,7 +15,7 @@ class ModuleGenerator extends Command
*
* @var string
*/
protected $signature = "generate:module {--model= : Model Name} {--controller= : Name of the controller} {--t= : If table Controller should be made} {--res : If the controller should be resourceful} {--table= : Name of the table} {--routes= : Route Name} {--route_controller= : Route Controller} {--views= : If the views should be made} {--el= : If events and listeners should be made} {--repo= : If Repository should be made}";
protected $signature = 'generate:module {--model= : Model Name} {--controller= : Name of the controller} {--t= : If table Controller should be made} {--res : If the controller should be resourceful} {--table= : Name of the table} {--routes= : Route Name} {--route_controller= : Route Controller} {--views= : If the views should be made} {--el= : If events and listeners should be made} {--repo= : If Repository should be made}';
/**
* The console command description.
......@@ -50,148 +50,149 @@ class ModuleGenerator extends Command
public function handle()
{
//Making model
if( $this->option('model') ) {
if ($this->option('model')) {
$model = $this->parseModel($this->option('model'));
$a = Artisan::call("make:model", ["name" => $model]);
$a = Artisan::call('make:model', ['name' => $model]);
$this->line(Artisan::output());
}
//Making Controller
if( $this->option( 'controller' ) ) {
if ($this->option('controller')) {
$controller = $this->parseModel($this->option('controller'));
Artisan::call("make:controller", ["name" => $controller, '--resource' => $this->option('res')]);
Artisan::call('make:controller', ['name' => $controller, '--resource' => $this->option('res')]);
$this->line(Artisan::output());
//Making Table Controller
if( $this->option( 't' ) ) {
if ($this->option('t')) {
$tableController = $this->parseModel($this->option('t'));
Artisan::call("make:controller", ["name" => $tableController]);
$this->line("Table ".Artisan::output());
Artisan::call('make:controller', ['name' => $tableController]);
$this->line('Table '.Artisan::output());
}
}
//Making Migration
if( $table = $this->option( 'table' ) ) {
Artisan::call("make:migration", [
"name" => 'create_'.$table.'_table',
"--create" => $table
if ($table = $this->option('table')) {
Artisan::call('make:migration', [
'name' => 'create_'.$table.'_table',
'--create' => $table,
]);
$this->line(Artisan::output());
}
//Making Events and Listeners
if( $this->option( 'el' ) ) {
if ($this->option('el')) {
$el = explode(',', $this->option('el'));
$el = explode(',', $this->option( 'el' ) );
foreach($el as $e) {
foreach ($el as $e) {
$event = $this->parseModel($e);
Artisan::call('make:event', [
'name' => $event
'name' => $event,
]);
$this->line(Artisan::output());
Artisan::call('make:listener', [
'name' => $event.'Listener',
'--event' => $event
'name' => $event.'Listener',
'--event' => $event,
]);
$this->line(Artisan::output());
}
}
//Creating Routes
if( ( $route_name = $this->option( 'routes' ) ) && $this->option( 'route_controller' ) ) {
if (($route_name = $this->option('routes')) && $this->option('route_controller')) {
$base_path = base_path('routes/Backend');
$controller = class_basename( $this->option( 'controller' ) );
$controller = class_basename($this->option('controller'));
if( $this->option( 'model' ) ) {
$filename = class_basename( $this->option( 'model' ) );
if ($this->option('model')) {
$filename = class_basename($this->option('model'));
} else {
$filename = ucfirst($route_name);
}
$this->checkAndCreateDir($base_path);
$file_content = $this->files->get( $this->getStub( $this->option( 'res' ) ? 'resource' : false ) );
$file_content = $this->files->get($this->getStub($this->option('res') ? 'resource' : false));
$file_content = str_replace(
['dummy_name', 'DummyModel', 'DummyController'],
[$route_name, $filename, $controller],
$file_content
);
$this->files->put( $base_path.'/'.$filename.'.php', $file_content);
$this->line("Route File generated Successfully");
$this->files->put($base_path.'/'.$filename.'.php', $file_content);
$this->line('Route File generated Successfully');
}
//Creating Views
if( $this->option( 'views' ) ) {
$view_folder_name = strtolower( $this->option( 'views' ) );
if ($this->option('views')) {
$view_folder_name = strtolower($this->option('views'));
$base_path = resource_path('views/backend');
$path = $base_path.'/'.$view_folder_name;
$this->checkAndCreateDir($path);
$this->createViewFiles($path);
$this->line("View Files generated successfully");
$this->line('View Files generated successfully');
}
//Creating Repository
if( $repo = $this->option( 'repo' ) ) {
if ($repo = $this->option('repo')) {
$class_name = class_basename($repo);
$repo = str_replace($class_name, '', $repo);
$base_path = base_path('app/Repositories/'.$repo);
$this->checkAndCreateDir($base_path);
$this->createRepoFile($repo, $class_name);
$this->line("Repository generated successfully");
$this->line('Repository generated successfully');
}
}
/**
* Creating REpository File
*
* @param string $path
* @param string $class
* Creating REpository File.
*
* @param string $path
* @param string $class
*
* @return none
*/
*/
public function createRepoFile($path, $class)
{
$rootNamespace = $this->laravel->getNamespace().'Repositories\\';
$newPath = str_replace( '/', '\\', $path );
$namespace = trim( str_replace( '/', '\\', $rootNamespace.$newPath ), '\\' );
$file_contents = $this->files->get( __DIR__.'/Stubs/repository.stub' );
$newPath = str_replace('/', '\\', $path);
$namespace = trim(str_replace('/', '\\', $rootNamespace.$newPath), '\\');
$file_contents = $this->files->get(__DIR__.'/Stubs/repository.stub');
$file_contents = str_replace(
[ 'DummyNamespace', 'DummyClass' ],
[ $namespace, $class ],
['DummyNamespace', 'DummyClass'],
[$namespace, $class],
$file_contents
);
$path = base_path( 'app/Repositories/'.$path.'/'.$class );
$this->files->put( $path, $file_contents );
}
$path = base_path('app/Repositories/'.$path.'/'.$class);
$this->files->put($path, $file_contents);
}
/**
* Creating View Files (index, create, edit, form)
*
* @param string $path
* Creating View Files (index, create, edit, form).
*
* @param string $path
*
* @return none
*/
*/
public function createViewFiles($path)
{
$files = [ "/index.blade.php", "/create.blade.php", "/edit.blade.php", "/form.blade.php" ];
$files = ['/index.blade.php', '/create.blade.php', '/edit.blade.php', '/form.blade.php'];
foreach($files as $file) {
$this->files->put( $path.$file, $this->files->get( $this->getStub( false, true ) ) );
foreach ($files as $file) {
$this->files->put($path.$file, $this->files->get($this->getStub(false, true)));
}
}
/**
* Return Stub
*
* @param boolean $res
* Return Stub.
*
* @param bool $res
*
* @return file
*/
*/
public function getStub($res = false, $view = false)
{
if($view) {
if ($view) {
return __DIR__.'/Stubs/view.stub';
} else {
if( $res && $res == 'resource') {
if ($res && $res == 'resource') {
return __DIR__.'/Stubs/resourceRoute.stub';
} else {
return __DIR__.'/Stubs/route.stub';
......@@ -200,15 +201,15 @@ class ModuleGenerator extends Command
}
/**
* Creating Directory
* Creating Directory.
*
* @param string $model
*
* @param string $model
* @return string
*/
*/
public function checkAndCreateDir($path)
{
if(is_dir($path))
{
if (is_dir($path)) {
return $path;
}
......@@ -220,7 +221,8 @@ class ModuleGenerator extends Command
/**
* Get the fully-qualified model class name.
*
* @param string $model
* @param string $model
*
* @return string
*/
protected function parseModel($model)
......
......@@ -13,13 +13,14 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
'App\Console\Commands\ModuleGenerator'
'App\Console\Commands\ModuleGenerator',
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*/
protected function schedule(Schedule $schedule)
......
......@@ -4,8 +4,8 @@ namespace App\Exceptions;
use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Illuminate\Session\TokenMismatchException;
class Handler extends ExceptionHandler
{
......@@ -28,7 +28,8 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $exception
* @param \Exception $exception
*
* @return void
*/
public function report(Exception $exception)
......@@ -39,8 +40,9 @@ class Handler extends ExceptionHandler
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
......@@ -60,15 +62,15 @@ class Handler extends ExceptionHandler
return redirect()->back()->withInput()->withFlashDanger($exception->getMessage());
}
return parent::render($request, $exception);
}
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Auth\AuthenticationException $exception
*
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request, AuthenticationException $exception)
......
......@@ -2,8 +2,8 @@
namespace App\Helpers\Macros;
use Collective\Html\FormBuilder;
use App\Helpers\Macros\Traits\Dropdowns;
use Collective\Html\FormBuilder;
/**
* Class Macros.
......
......@@ -17,4 +17,4 @@ require __DIR__.'/Blog_Management.php';
require __DIR__.'/Faqs.php';
require __DIR__.'/Module.php';
require __DIR__.'/Menu.php';
require __DIR__.'/LogViewer.php';
\ No newline at end of file
require __DIR__.'/LogViewer.php';
......@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Backend\Access\Permission;
use App\Models\Access\Permission\Permission;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
use App\Http\Requests\Backend\Access\Permission\StorePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\ManagePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\CreatePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\EditPermissionRequest;
use App\Http\Requests\Backend\Access\Permission\DeletePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\EditPermissionRequest;
use App\Http\Requests\Backend\Access\Permission\ManagePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\StorePermissionRequest;
use App\Http\Requests\Backend\Access\Permission\UpdatePermissionRequest;
use App\Models\Access\Permission\Permission;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
/**
* Class PermissionController.
......@@ -65,7 +64,7 @@ class PermissionController extends Controller
}
/**
* @param Permission $permission
* @param Permission $permission
* @param EditPermissionRequest $request
*
* @return mixed
......
......@@ -3,9 +3,9 @@
namespace App\Http\Controllers\Backend\Access\Permission;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
use App\Http\Requests\Backend\Access\Permission\ManagePermissionRequest;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
use Yajra\DataTables\Facades\DataTables;
/**
* Class PermissionTableController.
......
......@@ -2,16 +2,16 @@
namespace App\Http\Controllers\Backend\Access\Role;
use App\Models\Access\Role\Role;
use App\Http\Controllers\Controller;
use App\Repositories\Backend\Access\Role\RoleRepository;
use App\Http\Requests\Backend\Access\Role\StoreRoleRequest;
use App\Http\Requests\Backend\Access\Role\ManageRoleRequest;
use App\Http\Requests\Backend\Access\Role\CreateRoleRequest;
use App\Http\Requests\Backend\Access\Role\DeleteRoleRequest;
use App\Http\Requests\Backend\Access\Role\EditRoleRequest;
use App\Http\Requests\Backend\Access\Role\ManageRoleRequest;
use App\Http\Requests\Backend\Access\Role\StoreRoleRequest;
use App\Http\Requests\Backend\Access\Role\UpdateRoleRequest;
use App\Http\Requests\Backend\Access\Role\DeleteRoleRequest;
use App\Models\Access\Role\Role;
use App\Repositories\Backend\Access\Permission\PermissionRepository;
use App\Repositories\Backend\Access\Role\RoleRepository;
/**
* Class RoleController.
......@@ -73,7 +73,7 @@ class RoleController extends Controller
}
/**
* @param Role $role
* @param Role $role
* @param EditRoleRequest $request
*
* @return mixed
......
......@@ -3,9 +3,9 @@
namespace App\Http\Controllers\Backend\Access\Role;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Access\Role\RoleRepository;
use App\Http\Requests\Backend\Access\Role\ManageRoleRequest;
use App\Repositories\Backend\Access\Role\RoleRepository;
use Yajra\DataTables\Facades\DataTables;
/**
* Class RoleTableController.
......@@ -38,6 +38,7 @@ class RoleTableController extends Controller
if ($role->all) {
return '<span class="label label-success">'.trans('labels.general.all').'</span>';
}
return $role->permission_name;
})
->addColumn('users', function ($role) {
......
......@@ -2,11 +2,11 @@
namespace App\Http\Controllers\Backend\Access\User;
use App\Helpers\Auth\Auth;
use App\Models\Access\User\User;
use App\Exceptions\GeneralException;
use App\Helpers\Auth\Auth;
use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Models\Access\User\User;
/**
* Class UserAccessController.
......
......@@ -2,10 +2,10 @@
namespace App\Http\Controllers\Backend\Access\User;
use App\Models\Access\User\User;
use App\Http\Controllers\Controller;
use App\Notifications\Frontend\Auth\UserNeedsConfirmation;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Models\Access\User\User;
use App\Notifications\Frontend\Auth\UserNeedsConfirmation;
/**
* Class UserConfirmationController.
......
......@@ -2,17 +2,17 @@
namespace App\Http\Controllers\Backend\Access\User;
use App\Models\Access\User\User;
use App\Http\Controllers\Controller;
use App\Repositories\Backend\Access\Role\RoleRepository;
use App\Repositories\Backend\Access\User\UserRepository;
use App\Http\Requests\Backend\Access\User\StoreUserRequest;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Http\Requests\Backend\Access\User\CreateUserRequest;
use App\Http\Requests\Backend\Access\User\DeleteUserRequest;
use App\Http\Requests\Backend\Access\User\EditUserRequest;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Http\Requests\Backend\Access\User\ShowUserRequest;
use App\Http\Requests\Backend\Access\User\DeleteUserRequest;
use App\Http\Requests\Backend\Access\User\StoreUserRequest;
use App\Http\Requests\Backend\Access\User\UpdateUserRequest;
use App\Models\Access\User\User;
use App\Repositories\Backend\Access\Role\RoleRepository;
use App\Repositories\Backend\Access\User\UserRepository;
use Illuminate\Support\Facades\DB;
/**
......@@ -74,7 +74,7 @@ class UserController extends Controller
}
/**
* @param User $user
* @param User $user
* @param ShowUserRequest $request
*
* @return mixed
......@@ -86,7 +86,7 @@ class UserController extends Controller
}
/**
* @param User $user
* @param User $user
* @param EditUserRequest $request
*
* @return mixed
......
......@@ -2,11 +2,11 @@
namespace App\Http\Controllers\Backend\Access\User;
use App\Models\Access\User\User;
use App\Http\Controllers\Controller;
use App\Repositories\Backend\Access\User\UserRepository;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Http\Requests\Backend\Access\User\UpdateUserPasswordRequest;
use App\Models\Access\User\User;
use App\Repositories\Backend\Access\User\UserRepository;
/**
* Class UserPasswordController.
......@@ -48,6 +48,6 @@ class UserPasswordController extends Controller
{
$this->users->updatePassword($user, $request->all());
return redirect()->route('admin.access.user.change-password',access()->user()->id)->withFlashSuccess(trans('alerts.backend.users.updated_password'));
return redirect()->route('admin.access.user.change-password', access()->user()->id)->withFlashSuccess(trans('alerts.backend.users.updated_password'));
}
}
......@@ -2,9 +2,9 @@
namespace App\Http\Controllers\Backend\Access\User;
use App\Models\Access\User\User;
use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Models\Access\User\User;
use App\Repositories\Backend\Access\User\UserSessionRepository;
/**
......
......@@ -2,13 +2,13 @@
namespace App\Http\Controllers\Backend\Access\User;
use App\Models\Access\User\User;
use App\Http\Controllers\Controller;
use App\Repositories\Backend\Access\User\UserRepository;
use App\Http\Requests\Backend\Access\User\EditUserRequest;
use App\Http\Requests\Backend\Access\User\DeleteUserRequest;
use App\Http\Requests\Backend\Access\User\ManageDeletedRequest;
use App\Http\Requests\Backend\Access\User\EditUserRequest;
use App\Http\Requests\Backend\Access\User\ManageDeactivatedRequest;
use App\Http\Requests\Backend\Access\User\ManageDeletedRequest;
use App\Models\Access\User\User;
use App\Repositories\Backend\Access\User\UserRepository;
/**
* Class UserStatusController.
......
......@@ -3,10 +3,10 @@
namespace App\Http\Controllers\Backend\Access\User;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Access\User\UserRepository;
use App\Http\Requests\Backend\Access\User\ManageUserRequest;
use App\Repositories\Backend\Access\User\UserRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/**
* Class UserTableController.
......
......@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Backend\BlogCategories;
use App\Models\BlogCategories\BlogCategory;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\BlogCategories\BlogCategoriesRepository;
use App\Http\Requests\Backend\BlogCategories\StoreBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\CreateBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\DeleteBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\EditBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\StoreBlogCategoriesRequest;
use App\Http\Requests\Backend\BlogCategories\UpdateBlogCategoriesRequest;
use App\Models\BlogCategories\BlogCategory;
use App\Repositories\Backend\BlogCategories\BlogCategoriesRepository;
/**
* Class BlogCategoriesController.
......@@ -76,7 +75,7 @@ class BlogCategoriesController extends Controller
}
/**
* @param BlogCategory $blogcategory
* @param BlogCategory $blogcategory
* @param UpdateBlogCategoriesRequest $request
*
* @return mixed
......@@ -89,7 +88,7 @@ class BlogCategoriesController extends Controller
}
/**
* @param BlogCategory $blogcategory
* @param BlogCategory $blogcategory
* @param DeleteBlogCategoriesRequest $request
*
* @return mixed
......
......@@ -3,10 +3,10 @@
namespace App\Http\Controllers\Backend\BlogCategories;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\BlogCategories\BlogCategoriesRepository;
use App\Http\Requests\Backend\BlogCategories\ManageBlogCategoriesRequest;
use App\Repositories\Backend\BlogCategories\BlogCategoriesRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/**
* Class BlogCategoriesTableController.
......@@ -39,6 +39,7 @@ class BlogCategoriesTableController extends Controller
if ($blogcategories->status) {
return '<span class="label label-success">Active</span>';
}
return '<span class="label label-danger">Inactive</span>';
})
->addColumn('created_by', function ($blogcategories) {
......
......@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Backend\BlogTags;
use App\Models\BlogTags\BlogTag;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\BlogTags\BlogTagsRepository;
use App\Http\Requests\Backend\BlogTags\StoreBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\ManageBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\DeleteBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\CreateBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\DeleteBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\EditBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\ManageBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\StoreBlogTagsRequest;
use App\Http\Requests\Backend\BlogTags\UpdateBlogTagsRequest;
use App\Models\BlogTags\BlogTag;
use App\Repositories\Backend\BlogTags\BlogTagsRepository;
/**
* Class BlogTagsController.
......@@ -64,7 +63,7 @@ class BlogTagsController extends Controller
}
/**
* @param BlogTag $blogtag
* @param BlogTag $blogtag
* @param EditBlogTagsRequest $request
*
* @return mixed
......@@ -76,7 +75,7 @@ class BlogTagsController extends Controller
}
/**
* @param BlogTag $blogtag
* @param BlogTag $blogtag
* @param UpdateblogtagsRequest $request
*
* @return mixed
......@@ -89,7 +88,7 @@ class BlogTagsController extends Controller
}
/**
* @param BlogTag $blogtag
* @param BlogTag $blogtag
* @param DeleteBlogTagsRequest $request
*
* @return mixed
......
......@@ -3,10 +3,10 @@
namespace App\Http\Controllers\Backend\BlogTags;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\BlogTags\BlogTagsRepository;
use App\Http\Requests\Backend\BlogTags\ManageBlogTagsRequest;
use App\Repositories\Backend\BlogTags\BlogTagsRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/**
* Class BlogTagsTableController.
......@@ -39,6 +39,7 @@ class BlogTagsTableController extends Controller
if ($blogtags->status) {
return '<span class="label label-success">Active</span>';
}
return '<span class="label label-danger">Inactive</span>';
})
->addColumn('created_by', function ($blogtags) {
......
......@@ -2,15 +2,14 @@
namespace App\Http\Controllers\Backend\Blogs;
use App\Models\Blogs\Blog;
use App\Models\BlogTags\BlogTag;
use App\Models\BlogCategories\BlogCategory;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Blogs\BlogsRepository;
use App\Http\Requests\Backend\Blogs\StoreBlogsRequest;
use App\Http\Requests\Backend\Blogs\ManageBlogsRequest;
use App\Http\Requests\Backend\Blogs\StoreBlogsRequest;
use App\Http\Requests\Backend\Blogs\UpdateBlogsRequest;
use App\Models\BlogCategories\BlogCategory;
use App\Models\Blogs\Blog;
use App\Models\BlogTags\BlogTag;
use App\Repositories\Backend\Blogs\BlogsRepository;
/**
* Class BlogsController.
......@@ -38,10 +37,10 @@ class BlogsController extends Controller
public function index(ManageBlogsRequest $request)
{
$status = [
"Published" => "Published",
"Draft" => "Draft",
"Inactive" => "Inactive",
"Scheduled" => "Scheduled"
'Published' => 'Published',
'Draft' => 'Draft',
'Inactive' => 'Inactive',
'Scheduled' => 'Scheduled',
];
return view('backend.blogs.index', compact('status'));
......@@ -57,13 +56,13 @@ class BlogsController extends Controller
$blogCategories = BlogCategory::where('status', 1)->pluck('name', 'id');
$blogTags = BlogTag::where('status', 1)->pluck('name', 'id');
$status = [
"Published" => "Published",
"Draft" => "Draft",
"Inactive" => "Inactive",
"Scheduled" => "Scheduled"
'Published' => 'Published',
'Draft' => 'Draft',
'Inactive' => 'Inactive',
'Scheduled' => 'Scheduled',
];
return view('backend.blogs.create', compact("blogCategories", "blogTags", "status"));
return view('backend.blogs.create', compact('blogCategories', 'blogTags', 'status'));
}
/**
......@@ -82,7 +81,7 @@ class BlogsController extends Controller
}
/**
* @param Blog $blog
* @param Blog $blog
* @param ManageBlogsRequest $request
*
* @return mixed
......@@ -92,26 +91,26 @@ class BlogsController extends Controller
$blogCategories = BlogCategory::where('status', 1)->pluck('name', 'id');
$blogTags = BlogTag::where('status', 1)->pluck('name', 'id');
$status = [
"Published" => "Published",
"Draft" => "Draft",
"InActive" => "InActive",
"Scheduled" => "Scheduled"
'Published' => 'Published',
'Draft' => 'Draft',
'InActive' => 'InActive',
'Scheduled' => 'Scheduled',
];
$selectedCategories = $blog->categories->pluck('id')->toArray();
$selectedtags = $blog->tags->pluck('id')->toArray();
$selectedtags = $blog->tags->pluck('id')->toArray();
return view('backend.blogs.edit', compact(
"blogCategories",
"blogTags",
"status",
"selectedCategories",
"selectedtags")
'blogCategories',
'blogTags',
'status',
'selectedCategories',
'selectedtags')
)
->withBlog($blog);
}
/**
* @param Blog $blog
* @param Blog $blog
* @param UpdateBlogsRequest $request
*
* @return mixed
......@@ -128,7 +127,7 @@ class BlogsController extends Controller
}
/**
* @param Blog $blog
* @param Blog $blog
* @param ManageBlogsRequest $request
*
* @return mixed
......@@ -141,25 +140,22 @@ class BlogsController extends Controller
}
/**
* Creating Tags Array
* Creating Tags Array.
*
* @param Array($tags)
* @return Array
*
* @return array
*/
public function createTagsArray($tags)
{
//Creating a new array for tags (newly created)
$tags_array = [];
foreach($tags as $tag)
{
if(is_numeric($tag))
{
foreach ($tags as $tag) {
if (is_numeric($tag)) {
$tags_array[] = $tag;
}
else
{
$newTag = BlogTag::create(['name'=>$tag,'status'=>1,'created_by'=>1]);
} else {
$newTag = BlogTag::create(['name'=>$tag, 'status'=>1, 'created_by'=>1]);
$tags_array[] = $newTag->id;
}
}
......@@ -167,26 +163,23 @@ class BlogsController extends Controller
return $tags_array;
}
/**
* Creating Tags Array
/**
* Creating Tags Array.
*
* @param Array($tags)
* @return Array
*
* @return array
*/
public function createCategoriesArray($categories)
{
//Creating a new array for categories (newly created)
$categories_array = [];
foreach($categories as $category)
{
if(is_numeric($category))
{
foreach ($categories as $category) {
if (is_numeric($category)) {
$categories_array[] = $category;
}
else
{
$newCategory = BlogCategory::create(['name' => $category,'status' => 1,'created_by' => 1]);
} else {
$newCategory = BlogCategory::create(['name' => $category, 'status' => 1, 'created_by' => 1]);
$categories_array[] = $newCategory->id;
}
......
......@@ -3,10 +3,10 @@
namespace App\Http\Controllers\Backend\Blogs;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Blogs\BlogsRepository;
use App\Http\Requests\Backend\Blogs\ManageBlogsRequest;
use App\Repositories\Backend\Blogs\BlogsRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/**
* Class BlogsTableController.
......@@ -39,7 +39,7 @@ class BlogsTableController extends Controller
return $blogs->status;
})
->addColumn('publish_datetime', function ($blogs) {
return Carbon::parse($blogs->publish_datetime)->format("d/m/Y h:i A");
return Carbon::parse($blogs->publish_datetime)->format('d/m/Y h:i A');
})
->addColumn('created_by', function ($blogs) {
return $blogs->user_name;
......
......@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Backend\CMSPages;
use App\Models\CMSPages\CMSPage;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\CMSPages\CMSPagesRepository;
use App\Http\Requests\Backend\CMSPages\StoreCMSPagesRequest;
use App\Http\Requests\Backend\CMSPages\ManageCMSPagesRequest;
use App\Http\Requests\Backend\CMSPages\CreateCMSPagesRequest;
use App\Http\Requests\Backend\CMSPages\EditCMSPagesRequest;
use App\Http\Requests\Backend\CMSPages\DeleteCMSPagesRequest;
use App\Http\Requests\Backend\CMSPages\EditCMSPagesRequest;
use App\Http\Requests\Backend\CMSPages\ManageCMSPagesRequest;
use App\Http\Requests\Backend\CMSPages\StoreCMSPagesRequest;
use App\Http\Requests\Backend\CMSPages\UpdateCMSPagesRequest;
use App\Models\CMSPages\CMSPage;
use App\Repositories\Backend\CMSPages\CMSPagesRepository;
/**
* Class CMSPagesController.
......@@ -64,7 +63,7 @@ class CMSPagesController extends Controller
}
/**
* @param CMSPage $cmspage
* @param CMSPage $cmspage
* @param EditCMSPagesRequest $request
*
* @return mixed
......@@ -76,7 +75,7 @@ class CMSPagesController extends Controller
}
/**
* @param CMSPage $cmspage
* @param CMSPage $cmspage
* @param EditCMSPagesRequest $request
*
* @return mixed
......@@ -89,7 +88,7 @@ class CMSPagesController extends Controller
}
/**
* @param Permission $permission
* @param Permission $permission
* @param DeleteCMSPagesRequest $request
*
* @return mixed
......
......@@ -3,10 +3,10 @@
namespace App\Http\Controllers\Backend\CMSPages;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\CMSPages\CMSPagesRepository;
use App\Http\Requests\Backend\CMSPages\ManageCMSPagesRequest;
use App\Repositories\Backend\CMSPages\CMSPagesRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/**
* Class CMSPagesTableController.
......@@ -39,6 +39,7 @@ class CMSPagesTableController extends Controller
if ($cmspages->status) {
return '<span class="label label-success">Active</span>';
}
return '<span class="label label-danger">Inactive</span>';
})
->addColumn('created_at', function ($cmspages) {
......
......@@ -3,12 +3,12 @@
namespace App\Http\Controllers\Backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Access\Permission\Permission;
use App\Models\Access\Role\Role;
use App\Models\Access\User\User;
use App\Models\Cities\City;
use App\Models\States\State;
use App\Models\Access\User\User;
use App\Models\Access\Role\Role;
use App\Models\Access\Permission\Permission;
use Illuminate\Http\Request;
/**
* Class DashboardController.
......@@ -24,50 +24,52 @@ class DashboardController extends Controller
}
/**
* Used to get the states of default country
*
* Used to get the states of default country.
*
* @param Request $request
*
* @return JSON
*/
public function getStates(Request $request)
{
$states = State::where("country_id", config("access.constants.default_country"))->pluck('state', 'id')->toArray();
$states = State::where('country_id', config('access.constants.default_country'))->pluck('state', 'id')->toArray();
return array(
"status" => "state",
"data" => $states
);
return [
'status' => 'state',
'data' => $states,
];
}
/**
* Used to get the cities of selected state
*
* Used to get the cities of selected state.
*
* @param Request $request
*
* @return JSON
*/
public function getCities(Request $request)
{
$cities = City::where("state_id", $request->stateId)->pluck('city', 'id')->toArray();
$cities = City::where('state_id', $request->stateId)->pluck('city', 'id')->toArray();
return array(
"status" => "city",
"data" => $cities
);
return [
'status' => 'city',
'data' => $cities,
];
}
/**
* Used to display form for edit profile
* Used to display form for edit profile.
*
* @return view
*/
public function editProfile(Request $request)
{
return view("backend.access.profile-edit")
return view('backend.access.profile-edit')
->withLoggedInUser(access()->user());
}
/**
* Used to update profile
* Used to update profile.
*
* @return view
*/
......@@ -80,21 +82,20 @@ class DashboardController extends Controller
$user->last_name = $input['last_name'];
$user->address = $input['address'];
$user->state_id = $input['state_id'];
$user->country_id = config("access.constants.default_country");
$user->country_id = config('access.constants.default_country');
$user->city_id = $input['city_id'];
$user->zip_code = $input['zip_code'];
$user->ssn = $input['ssn'];
$user->updated_by = access()->user()->id;
if($user->save())
{
if ($user->save()) {
return redirect()->route('admin.profile.edit')
->withFlashSuccess(trans("labels.backend.profile_updated"));
->withFlashSuccess(trans('labels.backend.profile_updated'));
}
}
/**
* This function is used to get permissions details by role
* This function is used to get permissions details by role.
*
* @param Request $request
*/
......
......@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Backend\EmailTemplates;
use App\Models\EmailTemplates\EmailTemplate;
use App\Models\EmailTemplateTypes\EmailTemplateType;
use App\Models\EmailTemplatePlaceholders\EmailTemplatePlaceholder;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\EmailTemplates\EmailTemplatesRepository;
use App\Http\Requests\Backend\EmailTemplates\ManageEmailTemplatesRequest;
use App\Http\Requests\Backend\EmailTemplates\EditEmailTemplatesRequest;
use App\Http\Requests\Backend\EmailTemplates\DeleteEmailTemplatesRequest;
use App\Http\Requests\Backend\EmailTemplates\EditEmailTemplatesRequest;
use App\Http\Requests\Backend\EmailTemplates\ManageEmailTemplatesRequest;
use App\Http\Requests\Backend\EmailTemplates\UpdateEmailTemplatesRequest;
use App\Models\EmailTemplatePlaceholders\EmailTemplatePlaceholder;
use App\Models\EmailTemplates\EmailTemplate;
use App\Models\EmailTemplateTypes\EmailTemplateType;
use App\Repositories\Backend\EmailTemplates\EmailTemplatesRepository;
/**
* Class EmailTemplatesController.
......@@ -24,7 +23,7 @@ class EmailTemplatesController extends Controller
protected $emailtemplates;
/**
* Setting the EmailTemplatesRepository instance to class variable
* Setting the EmailTemplatesRepository instance to class variable.
*
* @param EmailTemplatesRepository $emailtemplates
*/
......@@ -34,7 +33,7 @@ class EmailTemplatesController extends Controller
}
/**
* Use to load index view of EmailTmplates
* Use to load index view of EmailTmplates.
*
* @param ManageEmailTemplatesRequest $request
*
......@@ -46,9 +45,9 @@ class EmailTemplatesController extends Controller
}
/**
* Use to load edit form of Emailtemplate
* Use to load edit form of Emailtemplate.
*
* @param EmailTemplate $emailtemplate
* @param EmailTemplate $emailtemplate
* @param EditEmailTemplatesRequest $request
*
* @return mixed
......@@ -56,18 +55,19 @@ class EmailTemplatesController extends Controller
public function edit(EmailTemplate $emailtemplate, EditEmailTemplatesRequest
$request)
{
$emailtemplateTypes = EmailTemplateType::pluck('name', 'id');
$emailtemplatePlaceholders = EmailTemplatePlaceholder::pluck('name', 'id');
$emailtemplateTypes = EmailTemplateType::pluck('name', 'id');
$emailtemplatePlaceholders = EmailTemplatePlaceholder::pluck('name', 'id');
return view('backend.emailtemplates.edit')
->withEmailtemplate($emailtemplate)
->withEmailtemplatetypes($emailtemplateTypes)
->withEmailtemplateplaceholders($emailtemplatePlaceholders);
}
}
/**
* Use to update an Emailtemplate
* Use to update an Emailtemplate.
*
* @param EmailTemplate $emailtemplate
* @param EmailTemplate $emailtemplate
* @param UpdateEmailTemplatesRequest $request
*
* @return mixed
......@@ -76,14 +76,15 @@ class EmailTemplatesController extends Controller
$request)
{
$this->emailtemplates->update($emailtemplate, $request->all());
return redirect()->route('admin.emailtemplates.index')
->withFlashSuccess(trans('alerts.backend.emailtemplates.updated'));
}
/**
* Use to delete an Emailtemplate
* Use to delete an Emailtemplate.
*
* @param EmailTemplate $emailtemplate
* @param EmailTemplate $emailtemplate
* @param DeleteEmailTemplatesRequest $request
*
* @return mixed
......@@ -92,6 +93,7 @@ class EmailTemplatesController extends Controller
$request)
{
$this->emailtemplates->delete($emailtemplate);
return redirect()->route('admin.emailtemplates.index')
->withFlashSuccess(trans('alerts.backend.emailtemplates.deleted'));
}
......
......@@ -3,10 +3,10 @@
namespace App\Http\Controllers\Backend\EmailTemplates;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\EmailTemplates\EmailTemplatesRepository;
use App\Http\Requests\Backend\EmailTemplates\ManageEmailTemplatesRequest;
use App\Repositories\Backend\EmailTemplates\EmailTemplatesRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/**
* Class EmailTemplatesTableController.
......@@ -39,6 +39,7 @@ class EmailTemplatesTableController extends Controller
if ($emailtemplates->status) {
return '<span class="label label-success">Active</span>';
}
return '<span class="label label-danger">Inactive</span>';
})
->addColumn('created_at', function ($emailtemplates) {
......
......@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Backend\Faqs;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\Backend\Faqs\StoreFaqsRequest;
use App\Http\Requests\Backend\Faqs\UpdateFaqsRequest;
use App\Http\Requests\Backend\Faqs\ManageFaqsRequest;
use App\Http\Requests\Backend\Faqs\CreateFaqsRequest;
use App\Http\Requests\Backend\Faqs\EditFaqsRequest;
use App\Http\Requests\Backend\Faqs\DeleteFaqsRequest;
use App\Repositories\Backend\Faqs\FaqsRepository;
use App\Http\Requests\Backend\Faqs\EditFaqsRequest;
use App\Http\Requests\Backend\Faqs\ManageFaqsRequest;
use App\Http\Requests\Backend\Faqs\StoreFaqsRequest;
use App\Http\Requests\Backend\Faqs\UpdateFaqsRequest;
use App\Models\Faqs\Faq;
use App\Repositories\Backend\Faqs\FaqsRepository;
class FaqsController extends Controller
{
......@@ -37,6 +36,7 @@ class FaqsController extends Controller
{
//Status array
$status = [1 => 'Active', 0 => 'Inactive'];
return view('backend.faqs.index')->withStatus($status);
}
......@@ -53,13 +53,14 @@ class FaqsController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(StoreFaqsRequest $request)
{
$input = $request->all();
$this->faqs->create($input);
return redirect()->route('admin.faqs.index')->withFlashSuccess(trans('alerts.backend.faqs.created'));
......@@ -68,21 +69,22 @@ class FaqsController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit(Faq $faq,EditFaqsRequest $request)
public function edit(Faq $faq, EditFaqsRequest $request)
{
return view('backend.faqs.edit')->withItem($faq);
}
......@@ -90,15 +92,16 @@ class FaqsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(UpdateFaqsRequest $request, Faq $faq)
{
$input = $request->all();
$this->faqs->update($faq,$input);
$this->faqs->update($faq, $input);
return redirect()->route('admin.faqs.index')->withFlashSuccess(trans('alerts.backend.faqs.updated'));
}
......@@ -106,7 +109,8 @@ class FaqsController extends Controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy(Faq $faq, DeleteFaqsRequest $request)
......
......@@ -2,12 +2,11 @@
namespace App\Http\Controllers\Backend\Faqs;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Faqs\FaqsRepository;
use App\Http\Requests\Backend\Faqs\ManageFaqsRequest;
use App\Repositories\Backend\Faqs\FaqsRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
class FaqsTableController extends Controller
{
......@@ -33,7 +32,7 @@ class FaqsTableController extends Controller
{
return Datatables::of($this->faqs->getForDataTable())
->escapeColumns(['question'])
->addColumn('answer', function($faqs) {
->addColumn('answer', function ($faqs) {
return $faqs->answer;
})
->addColumn('status', function ($faqs) {
......
......@@ -2,16 +2,15 @@
namespace App\Http\Controllers\Backend\Menu;
use App\Models\Menu\Menu;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Repositories\Backend\Menu\MenuRepository;
use App\Http\Requests\Backend\Menu\StoreMenuRequest;
use App\Http\Requests\Backend\Menu\ManageMenuRequest;
use App\Http\Requests\Backend\Menu\CreateMenuRequest;
use App\Http\Requests\Backend\Menu\EditMenuRequest;
use App\Http\Requests\Backend\Menu\DeleteMenuRequest;
use App\Http\Requests\Backend\Menu\EditMenuRequest;
use App\Http\Requests\Backend\Menu\ManageMenuRequest;
use App\Http\Requests\Backend\Menu\StoreMenuRequest;
use App\Http\Requests\Backend\Menu\UpdateMenuRequest;
use App\Models\Menu\Menu;
use App\Repositories\Backend\Menu\MenuRepository;
use Illuminate\Support\Facades\DB;
class MenuController extends Controller
......@@ -47,17 +46,19 @@ class MenuController extends Controller
public function create(CreateMenuRequest $request)
{
$types = [
"backend" => "Backend",
"frontend" => "Frontend"
'backend' => 'Backend',
'frontend' => 'Frontend',
];
$modules = DB::table('modules')->get();
return view('backend.menus.create')->withTypes($types)->withModules($modules);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(StoreMenuRequest $request)
......@@ -70,7 +71,8 @@ class MenuController extends Controller
/**
* Display the specified resource.
*
* @param \App\Models\Menu\Menu $menu
* @param \App\Models\Menu\Menu $menu
*
* @return \Illuminate\Http\Response
*/
public function show()
......@@ -81,16 +83,18 @@ class MenuController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Menu\Menu $menu
* @param \App\Models\Menu\Menu $menu
*
* @return \Illuminate\Http\Response
*/
public function edit(Menu $menu, EditMenuRequest $request)
{
$types = [
"backend" => "Backend",
"frontend" => "Frontend"
'backend' => 'Backend',
'frontend' => 'Frontend',
];
$modules = DB::table('modules')->get();
return view('backend.menus.edit')->withTypes($types)
->withMenu($menu)
->withModules($modules);
......@@ -99,8 +103,9 @@ class MenuController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Menu\Menu $menu
* @param \Illuminate\Http\Request $request
* @param \App\Models\Menu\Menu $menu
*
* @return \Illuminate\Http\Response
*/
public function update(Menu $menu, UpdateMenuRequest $request)
......@@ -113,7 +118,8 @@ class MenuController extends Controller
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Menu\Menu $menu
* @param \App\Models\Menu\Menu $menu
*
* @return \Illuminate\Http\Response
*/
public function destroy(Menu $menu, DeleteMenuRequest $request)
......@@ -130,10 +136,10 @@ class MenuController extends Controller
*/
public function getForm($formName, CreateMenuRequest $request)
{
if(in_array($formName, ['_add_custom_url_form']))
{
if (in_array($formName, ['_add_custom_url_form'])) {
return view('backend.menus.'.$formName);
}
return abort(404);
}
}
......@@ -2,12 +2,11 @@
namespace App\Http\Controllers\Backend\Menu;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Menu\MenuRepository;
use App\Http\Requests\Backend\Menu\ManageMenuRequest;
use App\Repositories\Backend\Menu\MenuRepository;
use Carbon\Carbon;
use Yajra\DataTables\Facades\DataTables;
/**
* Class MenuTableController.
......
......@@ -2,11 +2,10 @@
namespace App\Http\Controllers\Backend\Module;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Yajra\DataTables\Facades\DataTables;
use App\Repositories\Backend\Module\ModuleRepository;
use App\Http\Requests\Backend\Modules\ManageModuleRequest;
use App\Repositories\Backend\Module\ModuleRepository;
use Yajra\DataTables\Facades\DataTables;
class ModuleTableController extends Controller
{
......
......@@ -2,34 +2,30 @@
namespace App\Http\Controllers\Backend;
use App\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Config;
use App\Http\Controllers\Controller;
use App\Models\Notification\Notification;
use App\Http\Requests\Backend\Notification\StoreNotificationRequest;
use App\Http\Requests\Backend\Notification\CreateNotificationRequest;
use App\Http\Requests\Backend\Notification\MarkNotificationRequest;
use App\Models\Notification\Notification;
use App\Repositories\Backend\Notification\NotificationRepository;
use Maatwebsite\Excel\Facades\Excel;
use App\Http\Utilities\Jqgrid;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class NotificationController extends Controller
{
/**
* @var EmailTemplateContract
*/
protected $notification;
function __construct(NotificationRepository $notification) {
public function __construct(NotificationRepository $notification)
{
$this->notification = $notification;
}
/*
* Ajax data fetch function
*/
public function ajaxNotifications(){
public function ajaxNotifications()
{
/*
* get user id
*/
......@@ -37,25 +33,25 @@ class NotificationController extends Controller
/*
* where conditions to get count
*/
$where = array('user_id' => $userId,'is_read' => 0);
$where = ['user_id' => $userId, 'is_read' => 0];
/*
* get unread count
*/
$getUnreadNotificationCount = $this->notification->getNotification($where,'count');
$getUnreadNotificationCount = $this->notification->getNotification($where, 'count');
/*
* where condition to list top notifications
*/
$listWhere = array('user_id' => $userId,'is_read' => 0);
$listWhere = ['user_id' => $userId, 'is_read' => 0];
/*
* get top 5 notifications
*/
$getNotifications = $this->notification->getNotification($listWhere,'get',$limit = 5);
$getNotifications = $this->notification->getNotification($listWhere, 'get', $limit = 5);
/*
* preparing pass array which contain view and count both
*/
$passArray['view'] = view('backend.includes.notification')
->with('notifications',$getNotifications)
->with('unreadNotificationCount',$getUnreadNotificationCount)
$passArray['view'] = view('backend.includes.notification')
->with('notifications', $getNotifications)
->with('unreadNotificationCount', $getUnreadNotificationCount)
->render();
$passArray['count'] = $getUnreadNotificationCount;
/*
......@@ -64,10 +60,12 @@ class NotificationController extends Controller
echo json_encode($passArray);
die;
}
/*
* clearCurrentNotifications
*/
public function clearCurrentNotifications(){
public function clearCurrentNotifications()
{
$userId = Auth::user()->id;
echo $this->notification->clearNotifications(5);
die;
......@@ -76,19 +74,24 @@ class NotificationController extends Controller
/**
* @return mixed
*/
public function index(Request $request) {
public function index(Request $request)
{
$notifications = Notification::where('user_id', access()->user()->id)->get();
return view('backend.notification.index', compact('notifications'));
}
/**
* @param type $id
* @param type $status
* @param MarkNotificationRequest $request
* @return type
*/
public function mark($id, $status, MarkNotificationRequest $request) {
/**
* @param type $id
* @param type $status
* @param MarkNotificationRequest $request
*
* @return type
*/
public function mark($id, $status, MarkNotificationRequest $request)
{
$this->notification->mark($id, $status);
return response()->json(['status' => 'OK']);
}
}
......@@ -2,8 +2,8 @@
namespace App\Http\Controllers\Backend\Search;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
/**
* Class SearchController.
......@@ -17,7 +17,7 @@ class SearchController extends Controller
*/
public function index(Request $request)
{
if (! $request->filled('q')) {
if (!$request->filled('q')) {
return redirect()
->route('admin.dashboard')
->withFlashDanger(trans('strings.backend.search.empty'));
......
......@@ -2,11 +2,11 @@
namespace App\Http\Controllers\Backend\Settings;
use App\Models\Settings\Setting;
use App\Http\Controllers\Controller;
use App\Repositories\Backend\Settings\SettingsRepository;
use App\Http\Requests\Backend\Settings\ManageSettingsRequest;
use App\Http\Requests\Backend\Settings\UpdateSettingsRequest;
use App\Models\Settings\Setting;
use App\Repositories\Backend\Settings\SettingsRepository;
use Illuminate\Http\Request;
/**
......@@ -28,7 +28,7 @@ class SettingsController extends Controller
}
/**
* @param Setting $setting
* @param Setting $setting
* @param ManageEmailTemplatesRequest $request
*
* @return mixed
......@@ -37,9 +37,10 @@ class SettingsController extends Controller
{
return view('backend.settings.edit')
->withSetting($setting);
}
}
/**
* @param Setting $setting
* @param Setting $setting
* @param UpdateEmailTemplatesRequest $request
*
* @return mixed
......@@ -47,23 +48,25 @@ class SettingsController extends Controller
public function update(Setting $setting, UpdateSettingsRequest $request)
{
$this->settings->update($setting, $request->all());
return redirect()->route('admin.settings.edit', $setting->id)->withFlashSuccess(trans('alerts.backend.settings.updated'));
}
/**
* @param Setting $setting
/**
* @param Setting $setting
* @param Request $request
* Remove logo or favicon icon
* Remove logo or favicon icon
*
* @return mixed
*/
public function removeIcon(Request $request) {
public function removeIcon(Request $request)
{
$this->settings->removeicon($request->data);
return json_encode(
array(
'status' => true
)
[
'status' => true,
]
);
}
}
\ No newline at end of file
}
......@@ -2,10 +2,10 @@
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
......
......@@ -3,8 +3,8 @@
namespace App\Http\Controllers\Frontend\Auth;
use App\Http\Controllers\Controller;
use App\Repositories\Frontend\Access\User\UserRepository;
use App\Http\Requests\Frontend\User\ChangePasswordRequest;
use App\Repositories\Frontend\Access\User\UserRepository;
/**
* Class ChangePasswordController.
......@@ -12,29 +12,29 @@ use App\Http\Requests\Frontend\User\ChangePasswordRequest;
class ChangePasswordController extends Controller
{
/**
* @var UserRepository
*/
protected $user;
* @var UserRepository
*/
protected $user;
/**
* ChangePasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user)
{
$this->user = $user;
}
/**
* ChangePasswordController constructor.
*
* @param UserRepository $user
*/
public function __construct(UserRepository $user)
{
$this->user = $user;
}
/**
* @param ChangePasswordRequest $request
*
* @return mixed
*/
public function changePassword(ChangePasswordRequest $request)
{
$this->user->changePassword($request->all());
/**
* @param ChangePasswordRequest $request
*
* @return mixed
*/
public function changePassword(ChangePasswordRequest $request)
{
$this->user->changePassword($request->all());
return redirect()->route('frontend.user.account')->withFlashSuccess(trans('strings.frontend.user.password_updated'));
}
return redirect()->route('frontend.user.account')->withFlashSuccess(trans('strings.frontend.user.password_updated'));
}
}
......@@ -2,10 +2,10 @@
namespace App\Http\Controllers\Frontend\Auth;
use App\Models\Access\User\User;
use App\Http\Controllers\Controller;
use App\Repositories\Frontend\Access\User\UserRepository;
use App\Models\Access\User\User;
use App\Notifications\Frontend\Auth\UserNeedsConfirmation;
use App\Repositories\Frontend\Access\User\UserRepository;
/**
* Class ConfirmAccountController.
......
......@@ -2,17 +2,16 @@
namespace App\Http\Controllers\Frontend\Auth;
use App\Helpers\Auth\Auth;
use Illuminate\Http\Request;
use App\Exceptions\GeneralException;
use App\Http\Controllers\Controller;
use App\Helpers\Frontend\Auth\Socialite;
use App\Events\Frontend\Auth\UserLoggedIn;
use App\Events\Frontend\Auth\UserLoggedOut;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use App\Exceptions\GeneralException;
use App\Helpers\Auth\Auth;
use App\Helpers\Frontend\Auth\Socialite;
use App\Http\Controllers\Controller;
use App\Http\Utilities\NotificationIos;
use App\Http\Utilities\PushNotification;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
/**
* Class LoginController.
......@@ -33,6 +32,7 @@ class LoginController extends Controller
{
$this->notification = $notification;
}
/**
* Where to redirect users after login.
*
......@@ -71,18 +71,20 @@ class LoginController extends Controller
/*
* Check to see if the users account is confirmed and active
*/
if (! $user->isConfirmed()) {
if (!$user->isConfirmed()) {
access()->logout();
throw new GeneralException(trans('exceptions.frontend.auth.confirmation.resend', ['user_id' => $user->id]));
} elseif (! $user->isActive()) {
} elseif (!$user->isActive()) {
access()->logout();
throw new GeneralException(trans('exceptions.frontend.auth.deactivated'));
}
event(new UserLoggedIn($user));
/*
// Push notification implementation
$deviceToken = "3694d3a6b7258dd6653c6ec0d8488e5fc38577a164af4365b12e5fc0106cc705";
$message = "Testing from php department";
$sendOption = array('Type' => 'Quote');
......@@ -137,7 +139,7 @@ class LoginController extends Controller
public function logoutAs()
{
//If for some reason route is getting hit without someone already logged in
if (! access()->user()) {
if (!access()->user()) {
return redirect()->route('frontend.auth.login');
}
......
......@@ -2,11 +2,11 @@
namespace App\Http\Controllers\Frontend\Auth;
use App\Http\Controllers\Controller;
use App\Events\Frontend\Auth\UserRegistered;
use Illuminate\Foundation\Auth\RegistersUsers;
use App\Http\Controllers\Controller;
use App\Http\Requests\Frontend\Auth\RegisterRequest;
use App\Repositories\Frontend\Access\User\UserRepository;
use Illuminate\Foundation\Auth\RegistersUsers;
/**
* Class RegisterController.
......
......@@ -2,10 +2,10 @@
namespace App\Http\Controllers\Frontend\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\ResetsPasswords;
use App\Repositories\Frontend\Access\User\UserRepository;
use Illuminate\Foundation\Auth\ResetsPasswords;
use Illuminate\Http\Request;
/**
* Class ResetPasswordController.
......
......@@ -2,13 +2,13 @@
namespace App\Http\Controllers\Frontend\Auth;
use Illuminate\Http\Request;
use App\Events\Frontend\Auth\UserLoggedIn;
use App\Exceptions\GeneralException;
use App\Helpers\Frontend\Auth\Socialite as SocialiteHelper;
use App\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;
use App\Events\Frontend\Auth\UserLoggedIn;
use App\Repositories\Frontend\Access\User\UserRepository;
use App\Helpers\Frontend\Auth\Socialite as SocialiteHelper;
use Illuminate\Http\Request;
use Laravel\Socialite\Facades\Socialite;
/**
* Class SocialLoginController.
......@@ -51,7 +51,7 @@ class SocialLoginController extends Controller
$user = null;
// If the provider is not an acceptable third party than kick back
if (! in_array($provider, $this->helper->getAcceptedProviders())) {
if (!in_array($provider, $this->helper->getAcceptedProviders())) {
return redirect()->route('frontend.index')->withFlashDanger(trans('auth.socialite.unacceptable', ['provider' => $provider]));
}
......@@ -60,7 +60,7 @@ class SocialLoginController extends Controller
* It's redirected to the provider and then back here, where request is populated
* So it then continues creating the user
*/
if (! $request->all()) {
if (!$request->all()) {
return $this->getAuthorizationFirst($provider);
}
......@@ -71,12 +71,12 @@ class SocialLoginController extends Controller
return redirect()->route('frontend.index')->withFlashDanger($e->getMessage());
}
if (is_null($user) || ! isset($user)) {
if (is_null($user) || !isset($user)) {
return redirect()->route('frontend.index')->withFlashDanger(trans('exceptions.frontend.auth.unknown'));
}
// Check to see if they are active.
if (! $user->isActive()) {
if (!$user->isActive()) {
throw new GeneralException(trans('exceptions.frontend.auth.deactivated'));
}
......
......@@ -3,11 +3,12 @@
namespace App\Http\Controllers\Frontend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Cities\City;
use App\Models\Settings\Setting;
use App\Models\States\State;
use App\Repositories\Frontend\CMSPages\CMSPagesRepository;
use App\Models\Settings\Setting;
use Illuminate\Http\Request;
/**
* Class FrontendController.
*/
......@@ -20,6 +21,7 @@ class FrontendController extends Controller
{
$settingData = Setting::first();
$google_analytics = $settingData->google_analytics;
return view('frontend.index', compact('google_analytics', $google_analytics));
}
......@@ -32,42 +34,49 @@ class FrontendController extends Controller
}
/**
* Used to get the states of default country
*
* Used to get the states of default country.
*
* @param Request $request
*
* @return JSON
*/
public function getStates(Request $request)
{
$states = State::where("country_id", config("access.constants.default_country"))
$states = State::where('country_id', config('access.constants.default_country'))
->pluck('state', 'id')->toArray();
return array(
"status" => "state",
"data" => $states
);
return [
'status' => 'state',
'data' => $states,
];
}
/**
* Used to get the cities of selected state
*
* Used to get the cities of selected state.
*
* @param Request $request
*
* @return JSON
*/
public function getCities(Request $request)
{
$cities = City::where("state_id", $request->stateId)->pluck('city', 'id')
$cities = City::where('state_id', $request->stateId)->pluck('city', 'id')
->toArray();
return array(
"status" => "city",
"data" => $cities
);
return [
'status' => 'city',
'data' => $cities,
];
}
/**
* show cmspage by pageslug
*/
public function showCMSPage($page_slug,CMSPagesRepository $RepositoryContract) {
* show cmspage by pageslug.
*/
public function showCMSPage($page_slug, CMSPagesRepository $RepositoryContract)
{
$result = $RepositoryContract->findBySlug($page_slug);
return view('frontend.cmspages.index')
->withCmspages($result);
->withCmspages($result);
}
}
......@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Frontend\User;
use App\Http\Controllers\Controller;
use App\Http\Requests\Frontend\User\DashboardViewRequest;
/**
* Class DashboardController.
*/
......
......@@ -60,12 +60,12 @@ class Kernel extends HttpKernel
* @var array
*/
protected $routeMiddleware = [
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
'can' => \Illuminate\Auth\Middleware\Authorize::class,
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'timeout' => \App\Http\Middleware\SessionTimeout::class,
/*
......@@ -73,6 +73,6 @@ class Kernel extends HttpKernel
*/
'access.routeNeedsRole' => \App\Http\Middleware\RouteNeedsRole::class,
'access.routeNeedsPermission' => \App\Http\Middleware\RouteNeedsPermission::class,
'jwt.auth' => \App\Http\Middleware\VerifyJWTToken::class,
'jwt.auth' => \App\Http\Middleware\VerifyJWTToken::class,
];
}
......@@ -2,8 +2,8 @@
namespace App\Http\Middleware;
use Closure;
use Carbon\Carbon;
use Closure;
/**
* Class LocaleMiddleware.
......
......@@ -10,9 +10,10 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
......
......@@ -32,7 +32,7 @@ class RouteNeedsPermission
$access = access()->allow($permission);
}
if (! $access) {
if (!$access) {
return redirect()
->route('frontend.index')
->withFlashDanger(trans('auth.general_error'));
......
......@@ -32,7 +32,7 @@ class RouteNeedsRole
$access = access()->hasRole($role);
}
if (! $access) {
if (!$access) {
return redirect()
->route('frontend.index')
->withFlashDanger(trans('auth.general_error'));
......
......@@ -42,7 +42,7 @@ class SessionTimeout
if (config('session.timeout_status')) {
$isLoggedIn = $request->path() != '/logout';
if (! session('lastActivityTime')) {
if (!session('lastActivityTime')) {
$this->session->put('lastActivityTime', time());
} elseif (time() - $this->session->get('lastActivityTime') > $this->timeout) {
$this->session->forget('lastActivityTime');
......
<?php
namespace App\Http\Middleware;
use Closure;
use JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
class VerifyJWTToken
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
try{
try {
$user = JWTAuth::parseToken()->authenticate();
}catch (JWTException $e) {
if($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
} catch (JWTException $e) {
if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenExpiredException) {
return response()->json(['token_expired'], $e->getStatusCode());
}else if ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
} elseif ($e instanceof \Tymon\JWTAuth\Exceptions\TokenInvalidException) {
return response()->json(['token_invalid'], $e->getStatusCode());
}else{
} else {
return response()->json(['error'=>'Token is required']);
}
}
return $next($request);
return $next($request);
}
}
\ No newline at end of file
}
......@@ -27,7 +27,7 @@ class CreatePermissionRequest extends Request
public function rules()
{
return [
];
}
}
......@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Access\Permission;
use App\Http\Requests\Request;
/**
* Class DeletePermissionRequest
* Class DeletePermissionRequest.
*/
class DeletePermissionRequest extends Request
{
......@@ -27,7 +27,7 @@ class DeletePermissionRequest extends Request
public function rules()
{
return [
];
}
}
......@@ -27,7 +27,7 @@ class EditPermissionRequest extends Request
public function rules()
{
return [
];
}
}
......@@ -27,7 +27,7 @@ class StorePermissionRequest extends Request
public function rules()
{
return [
'name' => 'required|max:191',
'name' => 'required|max:191',
'display_name' => 'required|max:191',
];
}
......
......@@ -27,7 +27,7 @@ class UpdatePermissionRequest extends Request
public function rules()
{
return [
'name' => 'required|max:191',
'name' => 'required|max:191',
'display_name' => 'required|max:191',
];
}
......
......@@ -48,11 +48,11 @@ class StoreUserRequest extends Request
{
return [
'state_id.required' => 'The state field is required.',
'city_id.required' => 'The city field is required.',
'ssn.regex' => 'The SSN field must be 9 digits.',
'ssn.min' => 'The SSN field must be 9 digits.',
'ssn.max' => 'The SSN field must be 9 digits.',
'zip_code.regex' => 'The zip code field must be digit.',
'city_id.required' => 'The city field is required.',
'ssn.regex' => 'The SSN field must be 9 digits.',
'ssn.min' => 'The SSN field must be 9 digits.',
'ssn.max' => 'The SSN field must be 9 digits.',
'zip_code.regex' => 'The zip code field must be digit.',
];
}
}
......@@ -28,9 +28,10 @@ class UpdateUserPasswordRequest extends Request
{
return [
'old_password' => 'required',
'password' => 'required|min:8|confirmed|regex:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$"',
'password' => 'required|min:8|confirmed|regex:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$"',
];
}
/**
* @return array
*/
......
......@@ -27,9 +27,9 @@ class UpdateUserRequest extends Request
public function rules()
{
return [
'email' => 'required|email',
'first_name' => 'required',
'last_name' => 'required',
'email' => 'required|email',
'first_name' => 'required',
'last_name' => 'required',
'state_id' => 'required',
'city_id' => 'required',
'zip_code' => 'required|regex:/^[0-9]+$/',
......@@ -46,12 +46,12 @@ class UpdateUserRequest extends Request
{
return [
'state_id.required' => 'The state field is required.',
'city_id.required' => 'The city field is required.',
'ssn.regex' => 'The SSN field must be 9 digits.',
'ssn.min' => 'The SSN field must be 9 digits.',
'ssn.max' => 'The SSN field must be 9 digits.',
'zip_code.regex' => 'The zip code field must be digit.',
'city_id.required' => 'The city field is required.',
'ssn.regex' => 'The SSN field must be 9 digits.',
'ssn.min' => 'The SSN field must be 9 digits.',
'ssn.max' => 'The SSN field must be 9 digits.',
'zip_code.regex' => 'The zip code field must be digit.',
];
}
}
......@@ -40,7 +40,7 @@ class StoreBlogCategoriesRequest extends Request
{
return [
'name.required' => 'Blog category name must required',
'name.max' => 'Blog category may not be greater than 191 characters.',
'name.max' => 'Blog category may not be greater than 191 characters.',
];
}
}
......@@ -40,7 +40,7 @@ class UpdateBlogCategoriesRequest extends Request
{
return [
'name.required' => 'Blog category name must required',
'name.max' => 'Blog category may not be greater than 191 characters.',
'name.max' => 'Blog category may not be greater than 191 characters.',
];
}
}
......@@ -40,7 +40,7 @@ class StoreBlogTagsRequest extends Request
{
return [
'name.required' => 'Blog Tag name must required',
'name.max' => 'Blog Tag may not be greater than 191 characters.',
'name.max' => 'Blog Tag may not be greater than 191 characters.',
];
}
}
......@@ -40,7 +40,7 @@ class UpdateBlogTagsRequest extends Request
{
return [
'name.required' => 'Blog Tag name must required',
'name.max' => 'Blog Tag may not be greater than 191 characters.',
'name.max' => 'Blog Tag may not be greater than 191 characters.',
];
}
}
......@@ -27,11 +27,11 @@ class StoreBlogsRequest extends Request
public function rules()
{
return [
'name' => 'required|max:191',
'name' => 'required|max:191',
'featured_image' => 'required',
'content' => 'required',
'categories' => 'required',
'tags' => 'required',
'content' => 'required',
'categories' => 'required',
'tags' => 'required',
];
}
......@@ -44,7 +44,7 @@ class StoreBlogsRequest extends Request
{
return [
'name.required' => 'Please insert Blog Title',
'name.max' => 'Blog Title may not be greater than 191 characters.',
'name.max' => 'Blog Title may not be greater than 191 characters.',
];
}
}
......@@ -27,10 +27,10 @@ class UpdateBlogsRequest extends Request
public function rules()
{
return [
'name' => 'required|max:191',
'content' => 'required',
'name' => 'required|max:191',
'content' => 'required',
'categories' => 'required',
'tags' => 'required',
'tags' => 'required',
];
}
......@@ -43,7 +43,7 @@ class UpdateBlogsRequest extends Request
{
return [
'name.required' => 'Please insert Blog Title',
'name.max' => 'Blog Title may not be greater than 191 characters.',
'name.max' => 'Blog Title may not be greater than 191 characters.',
];
}
}
......@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\CMSPages;
use App\Http\Requests\Request;
/**
* Class CreateCMSPagesRequest
* Class CreateCMSPagesRequest.
*/
class CreateCMSPagesRequest extends Request
{
......
......@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\CMSPages;
use App\Http\Requests\Request;
/**
* Class DeleteCMSPagesRequest
* Class DeleteCMSPagesRequest.
*/
class DeleteCMSPagesRequest extends Request
{
......
......@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\CMSPages;
use App\Http\Requests\Request;
/**
* Class EditCMSPagesRequest
* Class EditCMSPagesRequest.
*/
class EditCMSPagesRequest extends Request
{
......
......@@ -27,7 +27,7 @@ class StoreCMSPagesRequest extends Request
public function rules()
{
return [
'title' => 'required|max:191',
'title' => 'required|max:191',
'description' => 'required',
];
}
......
......@@ -27,7 +27,7 @@ class UpdateCMSPagesRequest extends Request
public function rules()
{
return [
'title' => 'required|max:191',
'title' => 'required|max:191',
'description' => 'required',
];
}
......
......@@ -27,10 +27,10 @@ class UpdateEmailTemplatesRequest extends Request
public function rules()
{
return [
'title' => 'required|max:191',
'title' => 'required|max:191',
'type_id' => 'required',
'subject' => 'required|max:191',
'body' => 'required',
'body' => 'required',
];
}
}
......@@ -25,12 +25,12 @@ class StoreFaqsRequest extends FormRequest
{
return [
'question' => 'required|max:191',
'answer' => 'required'
'answer' => 'required',
];
}
/**
* Show the Messages for rules above
* Show the Messages for rules above.
*
* @return array
*/
......@@ -38,8 +38,8 @@ class StoreFaqsRequest extends FormRequest
{
return [
'question.required' => 'Question field is required.',
'question.max' => 'Question may not be grater than 191 character.',
'answer.required' => 'Answer field is required.'
'question.max' => 'Question may not be grater than 191 character.',
'answer.required' => 'Answer field is required.',
];
}
}
......@@ -25,12 +25,12 @@ class UpdateFaqsRequest extends FormRequest
{
return [
'question' => 'required|max:191',
'answer' => 'required'
'answer' => 'required',
];
}
/**
* Show the Messages for rules above
* Show the Messages for rules above.
*
* @return array
*/
......@@ -38,8 +38,8 @@ class UpdateFaqsRequest extends FormRequest
{
return [
'question.required' => 'Question field is required.',
'question.max' => 'Question may not be grater than 191 character.',
'answer.required' => 'Answer field is required.'
'question.max' => 'Question may not be grater than 191 character.',
'answer.required' => 'Answer field is required.',
];
}
}
......@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class CreateMenuRequest
* Class CreateMenuRequest.
*/
class CreateMenuRequest extends Request
{
......
......@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class DeleteMenuRequest
* Class DeleteMenuRequest.
*/
class DeleteMenuRequest extends Request
{
......
......@@ -5,7 +5,7 @@ namespace App\Http\Requests\Backend\Menu;
use App\Http\Requests\Request;
/**
* Class EditMenuRequest
* Class EditMenuRequest.
*/
class EditMenuRequest extends Request
{
......
......@@ -28,9 +28,9 @@ class StoreModuleRequest extends Request
public function rules()
{
return [
'name' => 'required|max:191|unique:modules',
'name' => 'required|max:191|unique:modules',
'directory_name' => 'required',
'model_name' => 'required'
'model_name' => 'required',
];
}
......@@ -42,11 +42,11 @@ class StoreModuleRequest extends Request
public function messages()
{
return [
"name.required" => "Module Name field is required to be filled",
"name.max" => "Module Name should not exceed 191 characters",
"name.unique" => "Module Name is already taken",
"directory_name.required" => "Directory Name field is required to be filled",
"model_name.required" => "Model Name field is required to be filled"
'name.required' => 'Module Name field is required to be filled',
'name.max' => 'Module Name should not exceed 191 characters',
'name.unique' => 'Module Name is already taken',
'directory_name.required' => 'Directory Name field is required to be filled',
'model_name.required' => 'Model Name field is required to be filled',
];
}
}
......@@ -28,9 +28,9 @@ class UpdateModuleRequest extends Request
public function rules()
{
return [
'name' => 'required|max:191|unique:modules,name,'.$this->segment(3).',id',
'url' => 'required',
'view_permission_id' => 'required'
'name' => 'required|max:191|unique:modules,name,'.$this->segment(3).',id',
'url' => 'required',
'view_permission_id' => 'required',
];
}
......
......@@ -27,24 +27,25 @@ class UpdateSettingsRequest extends Request
*/
public function rules()
{
$data = Setting::find(1);
$checkLogo = $data->logo;
$checkFavicon = $data->favicon;
if(!empty($checkLogo)){
$data = Setting::find(1);
$checkLogo = $data->logo;
$checkFavicon = $data->favicon;
if (!empty($checkLogo)) {
$logoValidation = 'image|dimensions:min_width=226,min_height=48';
}else{
} else {
$logoValidation = 'required|image|dimensions:min_width=226,min_height=48';
}
if(!empty($checkFavicon)){
if (!empty($checkFavicon)) {
$faviconValidation = 'mimes:jpg,jpeg,png,ico|dimensions:width=16,height=16';
}else{
} else {
$faviconValidation = 'required|mimes:jpg,jpeg,png,ico|dimensions:width=16,height=16';
}
return [
'logo' => $logoValidation,
'favicon' => $faviconValidation,
'from_name' => 'required',
'from_email' => 'required',
'logo' => $logoValidation,
'favicon' => $faviconValidation,
'from_name' => 'required',
'from_email' => 'required',
];
}
......@@ -56,13 +57,12 @@ class UpdateSettingsRequest extends Request
public function messages()
{
return [
'logo.dimensions' => 'Invalid logo - should be minimum 226*48',
'favicon.dimensions' => 'Invalid icon - should be 16*16',
'logo.required' => 'The logo field is required in seo settings.',
'favicon.required' => 'The favicon field is required in seo settings.',
'from_name.required' => 'The from name field is required in mail settings.',
'from_email.required' => 'The from email field is required in mail settings.',
'logo.dimensions' => 'Invalid logo - should be minimum 226*48',
'favicon.dimensions' => 'Invalid icon - should be 16*16',
'logo.required' => 'The logo field is required in seo settings.',
'favicon.required' => 'The favicon field is required in seo settings.',
'from_name.required' => 'The from name field is required in mail settings.',
'from_email.required' => 'The from email field is required in mail settings.',
];
}
}
......@@ -36,7 +36,7 @@ class RegisterRequest extends Request
'city_id' => 'required',
'zip_code' => 'required',
'ssn' => 'required',
'is_term_accept' => 'required',
'is_term_accept' => 'required',
'g-recaptcha-response' => 'required_if:captcha_status,true|captcha',
];
}
......@@ -48,9 +48,9 @@ class RegisterRequest extends Request
{
return [
'g-recaptcha-response.required_if' => trans('validation.required', ['attribute' => 'captcha']),
'state_id.required' => 'The state field is required.',
'city_id.required' => 'The city field is required.',
'password.regex' => 'Password must contain at least 1 uppercase letter and 1 number.',
'state_id.required' => 'The state field is required.',
'city_id.required' => 'The city field is required.',
'password.regex' => 'Password must contain at least 1 uppercase letter and 1 number.',
];
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -2,10 +2,8 @@
namespace App\Http\Utilities;
use App\Http\Utilities\Notification;
Class NotificationIos extends Notification {
class NotificationIos extends Notification
{
const BADGE_ID = 0;
protected $_passPhrase = null; // for authentication of .pem file or password of .pem file
......@@ -19,11 +17,11 @@ Class NotificationIos extends Notification {
protected $sendNotification = 1; // exception error for connection failed
/**
* send push notification
* send push notification.
*/
public function pushNotification($msg, $deviceToken, $sendData) {
$obj = new NotificationIos();
public function pushNotification($msg, $deviceToken, $sendData)
{
$obj = new self();
$obj->setPassPhrase('Infowelt@123');
$obj->setPemFile();
$deviceId = $deviceToken;
......@@ -41,8 +39,8 @@ Class NotificationIos extends Notification {
* @return boolean
*/
protected function _send($deviceId, $message, $sendOptions = array()) {
protected function _send($deviceId, $message, $sendOptions = [])
{
if (is_null($this->_passPhrase)) {
$this->raiseerror(self::ERROR_PASSPHRASE_EMPTY);
}
......@@ -52,8 +50,9 @@ Class NotificationIos extends Notification {
stream_context_set_option($ctx, 'ssl', 'passphrase', $this->_passPhrase);
$fp = stream_socket_client(self::$_url, $err, $errstr, 60, STREAM_CLIENT_CONNECT, $ctx);
if (!$fp)
if (!$fp) {
$this->raiseerror(self::ERROR_CONNECTION_FAILED);
}
//return 'Connected to APNS' . PHP_EOL;
// Create the payload body
$body['aps'] = $this->_prepareBody($message, $sendOptions);
......@@ -64,38 +63,43 @@ Class NotificationIos extends Notification {
foreach ($deviceId as $singleId) {
// Build the binary notification
$msg = chr(0) . pack('n', 32) . pack('H*', $singleId) . pack('n', strlen($payload)) . $payload;
$msg = chr(0).pack('n', 32).pack('H*', $singleId).pack('n', strlen($payload)).$payload;
// Send it to the server
$result = fwrite($fp, $msg, strlen($msg));
}
//echo "<br>-------<br>";
if (!$result)
return 'Message not delivered' . PHP_EOL;
else
return 'Message successfully delivered' . PHP_EOL;
if (!$result) {
return 'Message not delivered'.PHP_EOL;
} else {
return 'Message successfully delivered'.PHP_EOL;
}
// Close the connection to the server
fclose($fp);
}
protected function _prepareBody($message, $sendOptions) {
protected function _prepareBody($message, $sendOptions)
{
if ($this->sendNotification == 1) {
return array('alert' => $message, 'sound' => 'default', 'badge' => self::BADGE_ID);
return ['alert' => $message, 'sound' => 'default', 'badge' => self::BADGE_ID];
} else {
return array('badge' => 0);
return ['badge' => 0];
}
}
public function sendNotification($sendNotification) {
public function sendNotification($sendNotification)
{
$this->sendNotification = $sendNotification;
}
public function setPassPhrase($passPhrase) {
public function setPassPhrase($passPhrase)
{
$this->_passPhrase = $passPhrase;
}
public function setPemFile($pemFile = 'apns_baseproject_dev.pem') {
$newPemFilePath = dirname(__FILE__) . '/' . $pemFile;
public function setPemFile($pemFile = 'apns_baseproject_dev.pem')
{
$newPemFilePath = dirname(__FILE__).'/'.$pemFile;
// echo $_SERVER['DOCUMENT_ROOT'].'/app/Http/Controllers/Utilities/'.$pemFile;exit;
//echo dirname(__FILE__); exit;
// echo file_get_contents(dirname(__FILE__).'/'.$pemFile); exit;
......@@ -105,14 +109,12 @@ Class NotificationIos extends Notification {
$this->_pemFile = $newPemFilePath;
}
public function getErrorMessages() {
return array(
public function getErrorMessages()
{
return [
self::ERROR_PEM_NOTACCESSIBLE => 'Pem File Not Found',
self::ERROR_PASSPHRASE_EMPTY => 'Pass Phrase empty',
self::ERROR_CONNECTION_FAILED => 'Connect Failed'
);
self::ERROR_PASSPHRASE_EMPTY => 'Pass Phrase empty',
self::ERROR_CONNECTION_FAILED => 'Connect Failed',
];
}
}
?>
This diff is collapsed.
This diff is collapsed.
......@@ -5,7 +5,7 @@ namespace App\Listeners\Backend\Access\Permission;
/**
* Class PermissionEventListener.
*/
class PermissionEventListener
class PermissionEventListner
{
/**
* @var string
......
......@@ -5,7 +5,7 @@ namespace App\Listeners\Backend\BlogCategories;
/**
* Class BlogCategoryEventListener.
*/
class BlogCategoryEventListener
class BlogCategoryEventListner
{
/**
* @var string
......
......@@ -5,7 +5,7 @@ namespace App\Listeners\Backend\BlogTags;
/**
* Class BlogTagEventListener.
*/
class BlogTagEventListener
class BlogTagEventListner
{
/**
* @var string
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment