From ffdf989166a5db7ae794abeb0142087185ce0db6 Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Mon, 30 Sep 2019 13:49:45 +0000 Subject: [PATCH 01/15] Adopt Laravel coding style The Laravel framework adopts the PSR-2 coding style with some additions. Laravel apps *should* adopt this coding style as well. However, Shift allows you to customize the adopted coding style through by using your [PHP CS Fixer][1] config within your project. You may use [Shift's .php_cs][2] file as a base. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200 --- app/Console/Commands/InstallAppCommand.php | 12 +++--- app/Exceptions/Handler.php | 2 +- app/Helpers/helpers.php | 42 +++++++++---------- .../Controllers/Api/V1/AuthController.php | 2 +- .../Api/V1/ForgotPasswordController.php | 2 +- .../Controllers/Api/V1/RegisterController.php | 2 +- .../Controllers/Api/V1/UsersController.php | 2 +- .../Backend/Search/SearchController.php | 2 +- .../Frontend/Auth/LoginController.php | 6 +-- .../Frontend/Auth/ResetPasswordController.php | 2 +- .../Frontend/Auth/SocialLoginController.php | 8 ++-- app/Http/Middleware/RouteNeedsPermission.php | 2 +- app/Http/Middleware/RouteNeedsRole.php | 2 +- app/Http/Middleware/SessionTimeout.php | 4 +- .../Responses/Backend/Blog/CreateResponse.php | 2 + .../Responses/Backend/Blog/EditResponse.php | 3 ++ app/Http/Responses/RedirectResponse.php | 1 + app/Http/Responses/ViewResponse.php | 2 +- app/Http/Utilities/FileUploads.php | 4 +- app/Http/Utilities/Notification.php | 6 ++- app/Http/Utilities/NotificationIos.php | 10 +++-- app/Http/Utilities/PushNotification.php | 8 ++-- .../Access/PasswordReset/PasswordReset.php | 2 + app/Models/Access/Role/Traits/RoleAccess.php | 2 +- .../User/Traits/Attribute/UserAttribute.php | 18 ++++++-- app/Models/Access/User/Traits/UserAccess.php | 4 +- app/Models/Access/User/User.php | 1 + .../Frontend/Auth/UserNeedsPasswordReset.php | 1 + app/Notifications/PasswordReset.php | 1 + .../Backend/Access/Role/RoleRepository.php | 10 ++--- .../Backend/Access/User/UserRepository.php | 8 ++-- .../Backend/Blogs/BlogsRepository.php | 2 +- .../History/EloquentHistoryRepository.php | 11 +++-- .../Notification/NotificationRepository.php | 1 + .../Backend/Settings/SettingsRepository.php | 4 +- .../Frontend/Access/User/UserRepository.php | 6 +-- .../Frontend/Pages/PagesRepository.php | 2 +- .../seeds/Access/PermissionUserSeeder.php | 4 +- routes/Backend/Helpers.php | 2 +- 39 files changed, 122 insertions(+), 83 deletions(-) diff --git a/app/Console/Commands/InstallAppCommand.php b/app/Console/Commands/InstallAppCommand.php index be14862c..9c67b580 100644 --- a/app/Console/Commands/InstallAppCommand.php +++ b/app/Console/Commands/InstallAppCommand.php @@ -94,7 +94,7 @@ public function handle() $this->error('Missing '.ucfirst($missing_extension).' extension'); } - if (!file_exists('.env')) { + if (! file_exists('.env')) { File::copy('.env.example', '.env'); } @@ -149,7 +149,7 @@ protected function setDatabaseInfo() $this->username = env('DB_USERNAME'); $this->password = env('DB_PASSWORD'); - while (!checkDatabaseConnection()) { + while (! checkDatabaseConnection()) { // Ask for database details $this->host = $this->ask('Enter a host name?', config('config-variables.default_db_host')); $this->port = $this->ask('Enter a database port?', config('config-variables.default_db_port')); @@ -173,7 +173,7 @@ protected function setDatabaseInfo() $contents = preg_replace('/('.preg_quote('DB_USERNAME=').')(.*)/', 'DB_USERNAME='.$this->username, $contents); $contents = preg_replace('/('.preg_quote('DB_PASSWORD=').')(.*)/', 'DB_PASSWORD='.$this->password, $contents); - if (!$contents) { + if (! $contents) { throw new Exception('Error while writing credentials to .env file.'); } @@ -187,7 +187,7 @@ protected function setDatabaseInfo() // Clear DB name in config unset($this->laravel['config']['database.connections.mysql.database']); - if (!checkDatabaseConnection()) { + if (! checkDatabaseConnection()) { $this->error('Can not connect to database!'); } else { $this->info('Connected successfully!'); @@ -242,7 +242,7 @@ protected function getKeyFile() */ protected function createDatabase($database) { - if (!$database) { + if (! $database) { $this->info('Skipping creation of database as env(DB_DATABASE) is empty'); return; @@ -271,7 +271,7 @@ protected function createDatabase($database) */ protected function dumpDB($database) { - if (!empty($database)) { + if (! empty($database)) { // Force the new login to be used DB::purge(); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e1cb0956..15e6bbe9 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -54,7 +54,7 @@ public function report(Exception $exception) public function render($request, Exception $exception) { if (strpos($request->url(), '/api/') !== false) { - \Log::debug('API Request Exception - '.$request->url().' - '.$exception->getMessage().(!empty($request->all()) ? ' - '.json_encode($request->except(['password'])) : '')); + \Log::debug('API Request Exception - '.$request->url().' - '.$exception->getMessage().(! empty($request->all()) ? ' - '.json_encode($request->except(['password'])) : '')); if ($exception instanceof AuthorizationException) { return $this->setStatusCode(403)->respondWithError($exception->getMessage()); diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php index 801cfe23..fb77b7b9 100644 --- a/app/Helpers/helpers.php +++ b/app/Helpers/helpers.php @@ -15,7 +15,7 @@ function generateUuid() return uuid::uuid4(); } -if (!function_exists('homeRoute')) { +if (! function_exists('homeRoute')) { /** * Return the route to the "home" page depending on authentication/authorization status. @@ -37,7 +37,7 @@ function homeRoute() /* * Global helpers file with misc functions. */ -if (!function_exists('app_name')) { +if (! function_exists('app_name')) { /** * Helper to grab the application name. * @@ -49,7 +49,7 @@ function app_name() } } -if (!function_exists('access')) { +if (! function_exists('access')) { /** * Access (lol) the Access:: facade as a simple function. */ @@ -59,7 +59,7 @@ function access() } } -if (!function_exists('history')) { +if (! function_exists('history')) { /** * Access the history facade anywhere. */ @@ -69,7 +69,7 @@ function history() } } -if (!function_exists('gravatar')) { +if (! function_exists('gravatar')) { /** * Access the gravatar helper. */ @@ -79,7 +79,7 @@ function gravatar() } } -if (!function_exists('includeRouteFiles')) { +if (! function_exists('includeRouteFiles')) { /** * Loops through a folder and requires all PHP files @@ -107,7 +107,7 @@ function includeRouteFiles($folder) } } -if (!function_exists('getRtlCss')) { +if (! function_exists('getRtlCss')) { /** * The path being passed is generated by Laravel Mix manifest file @@ -129,7 +129,7 @@ function getRtlCss($path) } } -if (!function_exists('settings')) { +if (! function_exists('settings')) { /** * Access the settings helper. */ @@ -137,13 +137,13 @@ function settings() { // Settings Details $settings = Setting::latest()->first(); - if (!empty($settings)) { + if (! empty($settings)) { return $settings; } } } -if (!function_exists('createNotification')) { +if (! function_exists('createNotification')) { /** * create new notification. * @@ -165,7 +165,7 @@ function createNotification($message, $userId) } } -if (!function_exists('escapeSlashes')) { +if (! function_exists('escapeSlashes')) { /** * Access the escapeSlashes helper. */ @@ -179,7 +179,7 @@ function escapeSlashes($path) } } -if (!function_exists('getMenuItems')) { +if (! function_exists('getMenuItems')) { /** * Converts items (json string) to array and return array. */ @@ -187,11 +187,11 @@ function getMenuItems($type = 'backend', $id = null) { $menu = new \App\Models\Menu\Menu(); $menu = $menu->where('type', $type); - if (!empty($id)) { + if (! empty($id)) { $menu = $menu->where('id', $id); } $menu = $menu->first(); - if (!empty($menu) && !empty($menu->items)) { + if (! empty($menu) && ! empty($menu->items)) { return json_decode($menu->items); } @@ -199,14 +199,14 @@ function getMenuItems($type = 'backend', $id = null) } } -if (!function_exists('getRouteUrl')) { +if (! function_exists('getRouteUrl')) { /** * Converts querystring params to array and use it as route params and returns URL. */ function getRouteUrl($url, $url_type = 'route', $separator = '?') { $routeUrl = ''; - if (!empty($url)) { + if (! empty($url)) { if ($url_type == 'route') { if (strpos($url, $separator) !== false) { $urlArray = explode($separator, $url); @@ -225,7 +225,7 @@ function getRouteUrl($url, $url_type = 'route', $separator = '?') } } -if (!function_exists('renderMenuItems')) { +if (! function_exists('renderMenuItems')) { /** * render sidebar menu items after permission check. */ @@ -235,7 +235,7 @@ function renderMenuItems($items, $viewName = 'backend.includes.partials.sidebar- // if(!empty($item->url) && !Route::has($item->url)) { // return; // } - if (!empty($item->view_permission_id)) { + if (! empty($item->view_permission_id)) { if (access()->allow($item->view_permission_id)) { echo view($viewName, compact('item')); } @@ -246,7 +246,7 @@ function renderMenuItems($items, $viewName = 'backend.includes.partials.sidebar- } } -if (!function_exists('isActiveMenuItem')) { +if (! function_exists('isActiveMenuItem')) { /** * checks if current URL is of current menu/sub-menu. */ @@ -259,7 +259,7 @@ function isActiveMenuItem($item, $separator = '?') if (Active::checkRoutePattern($item->clean_url)) { return true; } - if (!empty($item->children)) { + if (! empty($item->children)) { foreach ($item->children as $child) { $child->clean_url = $child->url; if (strpos($child->url, $separator) !== false) { @@ -275,7 +275,7 @@ function isActiveMenuItem($item, $separator = '?') } } -if (!function_exists('checkDatabaseConnection')) { +if (! function_exists('checkDatabaseConnection')) { /** * @return bool diff --git a/app/Http/Controllers/Api/V1/AuthController.php b/app/Http/Controllers/Api/V1/AuthController.php index ad431484..dd953a98 100644 --- a/app/Http/Controllers/Api/V1/AuthController.php +++ b/app/Http/Controllers/Api/V1/AuthController.php @@ -29,7 +29,7 @@ public function login(Request $request) $credentials = $request->only(['email', 'password']); try { - if (!Auth::attempt($credentials)) { + if (! Auth::attempt($credentials)) { return $this->throwValidation(trans('api.messages.login.failed')); } diff --git a/app/Http/Controllers/Api/V1/ForgotPasswordController.php b/app/Http/Controllers/Api/V1/ForgotPasswordController.php index ddaefd73..8bd3a3b1 100644 --- a/app/Http/Controllers/Api/V1/ForgotPasswordController.php +++ b/app/Http/Controllers/Api/V1/ForgotPasswordController.php @@ -39,7 +39,7 @@ public function sendResetLinkEmail(Request $request) $user = $this->repository->findByEmail($request->get('email')); - if (!$user) { + if (! $user) { return $this->respondNotFound(trans('api.messages.forgot_password.validation.email_not_found')); } diff --git a/app/Http/Controllers/Api/V1/RegisterController.php b/app/Http/Controllers/Api/V1/RegisterController.php index 77e9dcb3..cc804bd5 100644 --- a/app/Http/Controllers/Api/V1/RegisterController.php +++ b/app/Http/Controllers/Api/V1/RegisterController.php @@ -45,7 +45,7 @@ public function register(Request $request) $user = $this->repository->create($request->all()); - if (!Config::get('api.register.release_token')) { + if (! Config::get('api.register.release_token')) { return $this->respondCreated([ 'message' => trans('api.messages.registeration.success'), ]); diff --git a/app/Http/Controllers/Api/V1/UsersController.php b/app/Http/Controllers/Api/V1/UsersController.php index 2b6c5374..718d9d0a 100644 --- a/app/Http/Controllers/Api/V1/UsersController.php +++ b/app/Http/Controllers/Api/V1/UsersController.php @@ -124,7 +124,7 @@ public function deleteAll(Request $request) { $ids = $request->get('ids'); - if (isset($ids) && !empty($ids)) { + if (isset($ids) && ! empty($ids)) { $result = $this->repository->deleteAll($ids); } diff --git a/app/Http/Controllers/Backend/Search/SearchController.php b/app/Http/Controllers/Backend/Search/SearchController.php index 358b66bd..20b71387 100755 --- a/app/Http/Controllers/Backend/Search/SearchController.php +++ b/app/Http/Controllers/Backend/Search/SearchController.php @@ -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')); diff --git a/app/Http/Controllers/Frontend/Auth/LoginController.php b/app/Http/Controllers/Frontend/Auth/LoginController.php index e9138986..14f49791 100755 --- a/app/Http/Controllers/Frontend/Auth/LoginController.php +++ b/app/Http/Controllers/Frontend/Auth/LoginController.php @@ -71,11 +71,11 @@ protected function authenticated(Request $request, $user) /* * 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]), true); - } elseif (!$user->isActive()) { + } elseif (! $user->isActive()) { access()->logout(); throw new GeneralException(trans('exceptions.frontend.auth.deactivated')); @@ -139,7 +139,7 @@ public function logout(Request $request) 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'); } diff --git a/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php b/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php index 91eca980..0d354c9c 100755 --- a/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php @@ -50,7 +50,7 @@ public function redirectPath() */ public function showResetForm($token = null) { - if (!$token) { + if (! $token) { return redirect()->route('frontend.auth.password.email'); } diff --git a/app/Http/Controllers/Frontend/Auth/SocialLoginController.php b/app/Http/Controllers/Frontend/Auth/SocialLoginController.php index bee119a3..47182b8a 100755 --- a/app/Http/Controllers/Frontend/Auth/SocialLoginController.php +++ b/app/Http/Controllers/Frontend/Auth/SocialLoginController.php @@ -51,7 +51,7 @@ public function login(Request $request, $provider) $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 @@ public function login(Request $request, $provider) * 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 @@ public function login(Request $request, $provider) 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')); } diff --git a/app/Http/Middleware/RouteNeedsPermission.php b/app/Http/Middleware/RouteNeedsPermission.php index 16f6a0db..648d9dd3 100755 --- a/app/Http/Middleware/RouteNeedsPermission.php +++ b/app/Http/Middleware/RouteNeedsPermission.php @@ -32,7 +32,7 @@ public function handle($request, Closure $next, $permission, $needsAll = false) $access = access()->allow($permission); } - if (!$access) { + if (! $access) { return redirect() ->route('frontend.index') ->withFlashDanger(trans('auth.general_error')); diff --git a/app/Http/Middleware/RouteNeedsRole.php b/app/Http/Middleware/RouteNeedsRole.php index e7b83f16..ec231b59 100755 --- a/app/Http/Middleware/RouteNeedsRole.php +++ b/app/Http/Middleware/RouteNeedsRole.php @@ -32,7 +32,7 @@ public function handle($request, Closure $next, $role, $needsAll = false) $access = access()->hasRole($role); } - if (!$access) { + if (! $access) { return redirect() ->route('frontend.index') ->withFlashDanger(trans('auth.general_error')); diff --git a/app/Http/Middleware/SessionTimeout.php b/app/Http/Middleware/SessionTimeout.php index 8be173d2..9d92fc9d 100755 --- a/app/Http/Middleware/SessionTimeout.php +++ b/app/Http/Middleware/SessionTimeout.php @@ -43,10 +43,10 @@ public function handle($request, Closure $next) //Cookie Name for when 'remember me' is checked $remember_cookie = \Auth::guard()->getRecallerName(); - if (!Cookie::has($remember_cookie) && config('session.timeout_status')) { + if (! Cookie::has($remember_cookie) && 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'); diff --git a/app/Http/Responses/Backend/Blog/CreateResponse.php b/app/Http/Responses/Backend/Blog/CreateResponse.php index 65a6e462..77cdeb79 100644 --- a/app/Http/Responses/Backend/Blog/CreateResponse.php +++ b/app/Http/Responses/Backend/Blog/CreateResponse.php @@ -7,7 +7,9 @@ class CreateResponse implements Responsable { protected $status; + protected $blogTags; + protected $blogCategories; public function __construct($status, $blogCategories, $blogTags) diff --git a/app/Http/Responses/Backend/Blog/EditResponse.php b/app/Http/Responses/Backend/Blog/EditResponse.php index 3366375a..969ab3d2 100644 --- a/app/Http/Responses/Backend/Blog/EditResponse.php +++ b/app/Http/Responses/Backend/Blog/EditResponse.php @@ -7,8 +7,11 @@ class EditResponse implements Responsable { protected $blog; + protected $status; + protected $blogTags; + protected $blogCategories; public function __construct($blog, $status, $blogCategories, $blogTags) diff --git a/app/Http/Responses/RedirectResponse.php b/app/Http/Responses/RedirectResponse.php index 898803a1..02098e7b 100644 --- a/app/Http/Responses/RedirectResponse.php +++ b/app/Http/Responses/RedirectResponse.php @@ -7,6 +7,7 @@ class RedirectResponse implements Responsable { protected $route; + protected $message; public function __construct($route, $message) diff --git a/app/Http/Responses/ViewResponse.php b/app/Http/Responses/ViewResponse.php index 1e31d525..53f52fb1 100644 --- a/app/Http/Responses/ViewResponse.php +++ b/app/Http/Responses/ViewResponse.php @@ -35,7 +35,7 @@ public function __construct($view, $with = []) */ public function toResponse($request) { - if (!empty($this->with)) { + if (! empty($this->with)) { return view($this->view)->with($this->with); } diff --git a/app/Http/Utilities/FileUploads.php b/app/Http/Utilities/FileUploads.php index 8e422fa6..957eef16 100755 --- a/app/Http/Utilities/FileUploads.php +++ b/app/Http/Utilities/FileUploads.php @@ -368,7 +368,7 @@ public function moveFile($source, $destination) $destination = $filePath.DIRECTORY_SEPARATOR.$destination; if (File::exists($source)) { $dir = dirname($destination); - if (!is_dir($dir)) { + if (! is_dir($dir)) { mkdir($dir, 0777, true); } @@ -393,7 +393,7 @@ public function copyFile($source, $destination) $destination = $filePath.DIRECTORY_SEPARATOR.$destination; if (File::exists($source)) { $dir = dirname($destination); - if (!is_dir($dir)) { + if (! is_dir($dir)) { mkdir($dir, 0777, true); } diff --git a/app/Http/Utilities/Notification.php b/app/Http/Utilities/Notification.php index 895ff621..9e33f87c 100755 --- a/app/Http/Utilities/Notification.php +++ b/app/Http/Utilities/Notification.php @@ -18,9 +18,13 @@ abstract class Notification { protected $_message = null; + protected $_devices = null; + protected $_response = null; + protected $_body = null; + protected static $_url = null; /* @@ -126,7 +130,7 @@ public function setOptions(array $options) public function raiseerror($errorCode) { $codeValue = $this->getErrorMessages(); - if (!isset($codeValue[$errorCode])) { + if (! isset($codeValue[$errorCode])) { $errorException = 'Erro code '.$errorCode; } else { $errorException = $codeValue[$errorCode]; diff --git a/app/Http/Utilities/NotificationIos.php b/app/Http/Utilities/NotificationIos.php index a1e0c49d..0e96dad2 100755 --- a/app/Http/Utilities/NotificationIos.php +++ b/app/Http/Utilities/NotificationIos.php @@ -7,11 +7,15 @@ class NotificationIos extends Notification const BADGE_ID = 0; protected $_passPhrase = null; // for authentication of .pem file or password of .pem file + protected $_pemFile = null; // for send notificetion .pem file is must add in that code + protected static $_url = 'ssl://gateway.sandbox.push.apple.com:2195'; // url for send push message const ERROR_PEM_NOTACCESSIBLE = 1; // exception error for file not get + const ERROR_PASSPHRASE_EMPTY = 2; // exception error for passphrese empty + const ERROR_CONNECTION_FAILED = 3; // exception error for connection failed protected $sendNotification = 1; // exception error for connection failed @@ -50,7 +54,7 @@ protected function _send($deviceId, $message, $sendOptions = []) 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; @@ -68,7 +72,7 @@ protected function _send($deviceId, $message, $sendOptions = []) $result = fwrite($fp, $msg, strlen($msg)); } //echo "
-------
"; - if (!$result) { + if (! $result) { return 'Message not delivered'.PHP_EOL; } else { return 'Message successfully delivered'.PHP_EOL; @@ -103,7 +107,7 @@ public function setPemFile($pemFile = 'apns_baseproject_dev.pem') // echo $_SERVER['DOCUMENT_ROOT'].'/app/Http/Controllers/Utilities/'.$pemFile;exit; //echo dirname(__FILE__); exit; // echo file_get_contents(dirname(__FILE__).'/'.$pemFile); exit; - if (!(file_exists($newPemFilePath)) && !(is_readable($newPemFilePath))) { + if (! (file_exists($newPemFilePath)) && ! (is_readable($newPemFilePath))) { $error = $this->raiseerror(self::ERROR_PEM_NOTACCESSIBLE); } $this->_pemFile = $newPemFilePath; diff --git a/app/Http/Utilities/PushNotification.php b/app/Http/Utilities/PushNotification.php index 269cbf42..c10e4f45 100755 --- a/app/Http/Utilities/PushNotification.php +++ b/app/Http/Utilities/PushNotification.php @@ -28,10 +28,12 @@ public function _pushNotification($msg, $type, $devicetoken) return $this->_pushToIos($devicetoken, $msg); return true; + break; case 'android': return $this->_pushToAndroid($devicetoken, $msg); + break; default: @@ -59,7 +61,7 @@ public function _pushNotification($msg, $type, $devicetoken) */ public function _pushToAndroid($registrationIds, $msg) { - if (!is_array($registrationIds)) { + if (! is_array($registrationIds)) { $registrationIds = [$registrationIds]; } $fields = [ @@ -106,7 +108,7 @@ public function _pushtoios($devicetoken, $message) //$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx); - if (!$fp) { + if (! $fp) { exit("Failed to connect amarnew: $err $errstr".PHP_EOL); } @@ -120,7 +122,7 @@ public function _pushtoios($devicetoken, $message) $result = fwrite($fp, $msg, strlen($msg)); - if (!$result) { + if (! $result) { return false; } else { return true; diff --git a/app/Models/Access/PasswordReset/PasswordReset.php b/app/Models/Access/PasswordReset/PasswordReset.php index a2c49793..d3ca7699 100755 --- a/app/Models/Access/PasswordReset/PasswordReset.php +++ b/app/Models/Access/PasswordReset/PasswordReset.php @@ -10,7 +10,9 @@ class PasswordReset extends BaseModel { public $timestamps = false; + protected $table = 'password_resets'; + protected $fillable = [ 'email', 'token', diff --git a/app/Models/Access/Role/Traits/RoleAccess.php b/app/Models/Access/Role/Traits/RoleAccess.php index cbac1bd5..bae9cc53 100755 --- a/app/Models/Access/Role/Traits/RoleAccess.php +++ b/app/Models/Access/Role/Traits/RoleAccess.php @@ -16,7 +16,7 @@ trait RoleAccess */ public function savePermissions($inputPermissions) { - if (!empty($inputPermissions)) { + if (! empty($inputPermissions)) { $this->permissions()->sync($inputPermissions); } else { $this->permissions()->detach(); diff --git a/app/Models/Access/User/Traits/Attribute/UserAttribute.php b/app/Models/Access/User/Traits/Attribute/UserAttribute.php index 8216082f..f511e16a 100755 --- a/app/Models/Access/User/Traits/Attribute/UserAttribute.php +++ b/app/Models/Access/User/Traits/Attribute/UserAttribute.php @@ -20,7 +20,7 @@ public function canChangeEmail() */ public function canChangePassword() { - return !app('session')->has(config('access.socialite_session_name')); + return ! app('session')->has(config('access.socialite_session_name')); } /** @@ -62,7 +62,7 @@ public function getPictureAttribute() */ public function getPicture($size = false) { - if (!$size) { + if (! $size) { $size = config('gravatar.default.size'); } @@ -151,6 +151,7 @@ public function getStatusButtonAttribute($class) return ''.$name.''; } + break; case 1: @@ -159,6 +160,7 @@ public function getStatusButtonAttribute($class) return ''.$name.''; } + break; default: @@ -174,7 +176,7 @@ public function getStatusButtonAttribute($class) */ public function getConfirmedButtonAttribute($class) { - if (!$this->isConfirmed() && access()->allow('edit-user')) { + if (! $this->isConfirmed() && access()->allow('edit-user')) { return ' '; } @@ -226,7 +228,7 @@ public function getLoginAsButtonAttribute($class) /* * If the admin is currently NOT spoofing a user */ - if (access()->allow('login-as-user') && (!session()->has('admin_user_id') || !session()->has('temp_user_id'))) { + if (access()->allow('login-as-user') && (! session()->has('admin_user_id') || ! session()->has('temp_user_id'))) { //Won't break, but don't let them "Login As" themselves if ($this->id != access()->id()) { return ' [ - 'driver' => 'database', - 'table' => 'cache', + 'driver' => 'database', + 'table' => 'cache', 'connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], 'options' => [ - // Memcached::OPT_CONNECT_TIMEOUT => 2000, + // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', + 'driver' => 'redis', + 'connection' => 'cache', + ], + + 'dynamodb' => [ + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'endpoint' => env('DYNAMODB_ENDPOINT'), ], ], @@ -86,6 +98,6 @@ | */ - 'prefix' => 'laravel', + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), ]; diff --git a/config/filesystems.php b/config/filesystems.php index f99803df..ec6a7cec 100755 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -13,7 +13,7 @@ | */ - 'default' => 'local', + 'default' => env('FILESYSTEM_DRIVER', 'local'), /* |-------------------------------------------------------------------------- @@ -26,7 +26,7 @@ | */ - 'cloud' => 's3', + 'cloud' => env('FILESYSTEM_CLOUD', 's3'), /* |-------------------------------------------------------------------------- @@ -37,7 +37,7 @@ | may even configure multiple disks of the same driver. Defaults have | been setup for each driver as an example of the required options. | - | Supported Drivers: "local", "ftp", "s3", "rackspace" + | Supported Drivers: "local", "ftp", "sftp", "s3" | */ @@ -45,22 +45,23 @@ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), + 'root' => storage_path('app'), ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL').'/storage', 'visibility' => 'public', ], 's3' => [ 'driver' => 's3', - 'key' => env('AWS_KEY'), - 'secret' => env('AWS_SECRET'), - 'region' => env('AWS_REGION'), + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), ], ], diff --git a/config/logging.php b/config/logging.php index e0a412a7..0df82129 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,5 +1,9 @@ [ 'stack' => [ - 'driver' => 'stack', - 'channels' => ['single'], + 'driver' => 'stack', + 'channels' => ['daily'], + 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', ], 'daily' => [ 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', - 'days' => 7, + 'path' => storage_path('logs/laravel.log'), + 'level' => 'debug', + 'days' => 14, ], 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => 'critical', + 'emoji' => ':boom:', + 'level' => 'critical', + ], + + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => 'debug', + 'handler' => SyslogUdpHandler::class, + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + ], + ], + + 'stderr' => [ + 'driver' => 'monolog', + 'handler' => StreamHandler::class, + 'formatter' => env('LOG_STDERR_FORMATTER'), + 'with' => [ + 'stream' => 'php://stderr', + ], ], 'syslog' => [ 'driver' => 'syslog', - 'level' => 'debug', + 'level' => 'debug', ], 'errorlog' => [ 'driver' => 'errorlog', - 'level' => 'debug', + 'level' => 'debug', + ], + + 'null' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, ], ], diff --git a/config/queue.php b/config/queue.php index 3a5de83f..3a30d6c6 100755 --- a/config/queue.php +++ b/config/queue.php @@ -4,18 +4,16 @@ /* |-------------------------------------------------------------------------- - | Default Queue Driver + | Default Queue Connection Name |-------------------------------------------------------------------------- | | Laravel's queue API supports an assortment of back-ends via a single | API, giving you convenient access to each back-end using the same - | syntax for each one. Here you may set the default queue driver. - | - | Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | syntax for every one. Here you may define a default connection. | */ - 'default' => env('QUEUE_DRIVER', 'sync'), + 'default' => env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- @@ -26,6 +24,8 @@ | is used by your application. A default configuration has been added | for each back-end shipped with Laravel. You are free to add more. | + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | */ 'connections' => [ @@ -35,33 +35,35 @@ ], 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', 'retry_after' => 90, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', 'retry_after' => 90, + 'block_for' => 0, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', - 'secret' => 'your-secret-key', - 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', - 'queue' => 'your-queue-name', - 'region' => 'us-east-1', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'your-queue-name'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => 'default', + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, + 'block_for' => null, ], ], @@ -78,8 +80,9 @@ */ 'failed' => [ + 'driver' => env('QUEUE_FAILED_DRIVER', 'database'), 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; From 50e49ccc9845f5b05b91faab3f7c9b5fc4e7cd52 Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Mon, 30 Sep 2019 13:49:51 +0000 Subject: [PATCH 04/15] Default config files In an effort to make upgrading the constantly changing config files easier, Shift defaulted them so you can review the commit diff for changes. Moving forward, you should use ENV variables or create a separate config file to allow the core config files to remain automatically upgradeable. --- config/database.php | 106 +++++++++++++++++++++++++++++--------------- config/mail.php | 23 +++++++--- config/services.php | 95 +++++---------------------------------- 3 files changed, 98 insertions(+), 126 deletions(-) diff --git a/config/database.php b/config/database.php index 7e50442e..199382d0 100755 --- a/config/database.php +++ b/config/database.php @@ -1,6 +1,9 @@ [ + 'sqlite' => [ - 'driver' => 'sqlite', - 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'foreign_key_constraints' => true, - 'prefix' => '', + 'driver' => 'sqlite', + 'url' => env('DATABASE_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ - 'driver' => 'mysql', - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', - 'strict' => false, //If you set strict to true, then make sure to enable which modes you want to enable by looking at 'modes' key in this config - 'engine' => null, - 'modes' => [ - // "ONLY_FULL_GROUP_BY", - // "STRICT_TRANS_TABLES", - // "NO_ZERO_IN_DATE", - // "NO_ZERO_DATE", - // "ERROR_FOR_DIVISION_BY_ZERO", - // "NO_AUTO_CREATE_USER", - // "NO_ENGINE_SUBSTITUTION", - ], + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], ], 'pgsql' => [ - 'driver' => 'pgsql', - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), + 'driver' => 'pgsql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, + 'schema' => 'public', + 'sslmode' => 'prefer', + ], + + 'sqlsrv' => [ + 'driver' => 'sqlsrv', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), 'database' => env('DB_DATABASE', 'forge'), 'username' => env('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'schema' => 'public', - 'sslmode' => 'prefer', + 'charset' => 'utf8', + 'prefix' => '', + 'prefix_indexes' => true, ], + ], /* @@ -95,19 +112,36 @@ |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems + | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ - 'client' => 'predis', + + 'client' => env('REDIS_CLIENT', 'phpredis'), + + 'options' => [ + 'cluster' => env('REDIS_CLUSTER', 'redis'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + ], 'default' => [ - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', 6379), - 'database' => 0, + 'port' => env('REDIS_PORT', 6379), + 'database' => env('REDIS_DB', 0), ], + + 'cache' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', 6379), + 'database' => env('REDIS_CACHE_DB', 1), + ], + ], + ]; diff --git a/config/mail.php b/config/mail.php index e2a0a4b4..3c65eb3f 100755 --- a/config/mail.php +++ b/config/mail.php @@ -11,8 +11,8 @@ | sending of e-mail. You may specify which one you're using throughout | your application here. By default, Laravel is setup for SMTP mail. | - | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses", - | "sparkpost", "log", "array" + | Supported: "smtp", "sendmail", "mailgun", "ses", + | "postmark", "log", "array" | */ @@ -29,7 +29,7 @@ | */ - 'host' => env('MAIL_HOST', 'smtp.gmail.com'), + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), /* |-------------------------------------------------------------------------- @@ -56,8 +56,8 @@ */ 'from' => [ - 'address' => env('MAIL_FROM', 'viral.solani@gmail.com'), - 'name' => env('MAIL_FROM_NAME', 'Admin'), + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* @@ -120,4 +120,17 @@ ], ], + /* + |-------------------------------------------------------------------------- + | Log Channel + |-------------------------------------------------------------------------- + | + | If you are using the "log" driver, you may specify the logging channel + | if you prefer to keep mail messages separate from other log entries + | for simpler reading. Otherwise, the default channel will be used. + | + */ + + 'log_channel' => env('MAIL_LOG_CHANNEL'), + ]; diff --git a/config/services.php b/config/services.php index b0060db3..2a1d616c 100755 --- a/config/services.php +++ b/config/services.php @@ -1,7 +1,5 @@ [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), ], - 'ses' => [ - 'key' => env('SES_KEY'), - 'secret' => env('SES_SECRET'), - 'region' => 'us-east-1', - ], - - 'sparkpost' => [ - 'secret' => env('SPARKPOST_SECRET'), - ], - - 'stripe' => [ - 'model' => User::class, - 'key' => env('STRIPE_KEY'), - 'secret' => env('STRIPE_SECRET'), + 'postmark' => [ + 'token' => env('POSTMARK_TOKEN'), ], - /* - * Socialite Credentials - * Redirect URL's need to be the same as specified on each network you set up this application on - * as well as conform to the route: - * http://localhost/public/login/SERVICE - * Where service can github, facebook, twitter, google, linkedin, or bitbucket - * Docs: https://github.com/laravel/socialite - * Make sure 'scopes' and 'with' are arrays, if their are none, use empty arrays [] - */ - 'bitbucket' => [ - 'client_id' => env('BITBUCKET_CLIENT_ID'), - 'client_secret' => env('BITBUCKET_CLIENT_SECRET'), - 'redirect' => env('BITBUCKET_REDIRECT'), - 'scopes' => [], - 'with' => [], - ], - - 'facebook' => [ - 'client_id' => env('FACEBOOK_CLIENT_ID'), - 'client_secret' => env('FACEBOOK_CLIENT_SECRET'), - 'redirect' => env('FACEBOOK_REDIRECT'), - 'scopes' => [], - 'with' => [], - 'fields' => [], - ], - - 'github' => [ - 'client_id' => env('GITHUB_CLIENT_ID'), - 'client_secret' => env('GITHUB_CLIENT_SECRET'), - 'redirect' => env('GITHUB_REDIRECT'), - 'scopes' => [], - 'with' => [], - ], - - 'google' => [ - 'client_id' => env('GOOGLE_CLIENT_ID'), - 'client_secret' => env('GOOGLE_CLIENT_SECRET'), - 'redirect' => env('GOOGLE_REDIRECT'), - - /* - * Only allows google to grab email address - * Default scopes array also has: 'https://www.googleapis.com/auth/plus.login' - * https://medium.com/@njovin/fixing-laravel-socialite-s-google-permissions-2b0ef8c18205 - */ - 'scopes' => [ - 'https://www.googleapis.com/auth/plus.me', - 'https://www.googleapis.com/auth/plus.profile.emails.read', - ], - - 'with' => [], - ], - - 'linkedin' => [ - 'client_id' => env('LINKEDIN_CLIENT_ID'), - 'client_secret' => env('LINKEDIN_CLIENT_SECRET'), - 'redirect' => env('LINKEDIN_REDIRECT'), - 'scopes' => [], - 'with' => [], - 'fields' => [], + 'ses' => [ + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], - 'twitter' => [ - 'client_id' => env('TWITTER_CLIENT_ID'), - 'client_secret' => env('TWITTER_CLIENT_SECRET'), - 'redirect' => env('TWITTER_REDIRECT'), - 'scopes' => [], - 'with' => [], - ], ]; From 4907509a21f0173b563e1dda2591fc85e9c2d310 Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Mon, 30 Sep 2019 13:49:51 +0000 Subject: [PATCH 05/15] Shift Laravel dependencies --- composer.json | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index d7724c19..2f78b9eb 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,8 @@ "license": "MIT", "type": "project", "require": { - "php": ">=7.1.3", - "arcanedev/log-viewer": "^4.5", + "php": "^7.2", + "arcanedev/log-viewer": "^5.0", "arcanedev/no-captcha": "^9.0", "beyondcode/laravel-self-diagnosis": "^1.2", "creativeorange/gravatar": "~1.0", @@ -20,24 +20,25 @@ "doctrine/dbal": "^2.9", "fideloper/proxy": "^4.0", "hieu-le/active": "^3.5", - "laravel/framework": "5.8.*", - "laravel/passport": "^7.2", - "laravel/socialite": "^4.1", + "laravel/framework": "^6.0", + "laravel/passport": "^7.3.3", + "laravel/socialite": "^4.2", "laravel/tinker": "~1.0", - "laravelcollective/html": "^5.4.0", - "spatie/laravel-cors": "^1.2", + "laravelcollective/html": "6.0.*", + "spatie/laravel-cors": "^1.6", "unisharp/laravel-filemanager": "~1.8", "yajra/laravel-datatables-oracle": "~9.0" }, "require-dev": { "bvipul/generator": "^5.8.2", - "codedungeon/phpunit-result-printer": "^0.26.1", - "filp/whoops": "^2.0", + "codedungeon/phpunit-result-printer": "^0.26", "friendsofphp/php-cs-fixer": "^2.14", "fzaninotto/faker": "^1.4", - "laravel/telescope": "^2.0", + "laravel/telescope": "^2.1", "mockery/mockery": "^1.0", - "phpunit/phpunit": "^8.0" + "phpunit/phpunit": "^8.0", + "facade/ignition": "^1.4", + "nunomaduro/collision": "^3.0" }, "config": { "optimize-autoloader": true, @@ -116,4 +117,4 @@ "npm audit" ] } -} +} \ No newline at end of file From c5ed06bace42f469e9bbfcda8385866af013b5c6 Mon Sep 17 00:00:00 2001 From: Laravel Shift Date: Mon, 30 Sep 2019 13:49:58 +0000 Subject: [PATCH 06/15] Shift cleanup --- app/Console/Commands/InstallAppCommand.php | 2 +- app/Repositories/Backend/Blogs/BlogsRepository.php | 2 +- app/Repositories/Backend/Pages/PagesRepository.php | 2 +- database/factories/PageFactory.php | 2 +- database/factories/UserFactory.php | 2 +- routes/Backend/Helpers.php | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/InstallAppCommand.php b/app/Console/Commands/InstallAppCommand.php index b4c5ef7c..cadebf3d 100644 --- a/app/Console/Commands/InstallAppCommand.php +++ b/app/Console/Commands/InstallAppCommand.php @@ -2,13 +2,13 @@ namespace App\Console\Commands; -use Illuminate\Support\Str; use Exception; use Illuminate\Console\Command; use Illuminate\Filesystem\Filesystem; use Illuminate\Support\Facades\Artisan; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\File; +use Illuminate\Support\Str; use PDOException; use Symfony\Component\Console\Helper\SymfonyQuestionHelper; use Symfony\Component\Console\Question\Question; diff --git a/app/Repositories/Backend/Blogs/BlogsRepository.php b/app/Repositories/Backend/Blogs/BlogsRepository.php index 658795fb..6ea21471 100755 --- a/app/Repositories/Backend/Blogs/BlogsRepository.php +++ b/app/Repositories/Backend/Blogs/BlogsRepository.php @@ -2,7 +2,6 @@ namespace App\Repositories\Backend\Blogs; -use Illuminate\Support\Str; use App\Events\Backend\Blogs\BlogCreated; use App\Events\Backend\Blogs\BlogDeleted; use App\Events\Backend\Blogs\BlogUpdated; @@ -16,6 +15,7 @@ use Carbon\Carbon; use DB; use Illuminate\Support\Facades\Storage; +use Illuminate\Support\Str; /** * Class BlogsRepository. diff --git a/app/Repositories/Backend/Pages/PagesRepository.php b/app/Repositories/Backend/Pages/PagesRepository.php index 0c864292..deb89bd2 100644 --- a/app/Repositories/Backend/Pages/PagesRepository.php +++ b/app/Repositories/Backend/Pages/PagesRepository.php @@ -2,13 +2,13 @@ namespace App\Repositories\Backend\Pages; -use Illuminate\Support\Str; use App\Events\Backend\Pages\PageCreated; use App\Events\Backend\Pages\PageDeleted; use App\Events\Backend\Pages\PageUpdated; use App\Exceptions\GeneralException; use App\Models\Page\Page; use App\Repositories\BaseRepository; +use Illuminate\Support\Str; /** * Class PagesRepository. diff --git a/database/factories/PageFactory.php b/database/factories/PageFactory.php index c0fbb374..922c0e8b 100644 --- a/database/factories/PageFactory.php +++ b/database/factories/PageFactory.php @@ -1,9 +1,9 @@ define(Page::class, function (Faker $faker) { $title = $faker->sentence; diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 04c72190..2ae833f6 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -1,8 +1,8 @@ define(User::class, function (Generator $faker) { static $password; diff --git a/routes/Backend/Helpers.php b/routes/Backend/Helpers.php index 4ef18707..cf688c00 100644 --- a/routes/Backend/Helpers.php +++ b/routes/Backend/Helpers.php @@ -1,4 +1,5 @@ Date: Mon, 30 Sep 2019 13:49:59 +0000 Subject: [PATCH 07/15] Shift return type of base TestCase methods From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type: - `setUpBeforeClass()` - `setUp()` - `assertPreConditions()` - `assertPostConditions()` - `tearDown()` - `tearDownAfterClass()` - `onNotSuccessfulTest()` [1]: https://phpunit.de/announcements/phpunit-8.html --- tests/BrowserKitTestCase.php | 4 ++-- tests/TestCase.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/BrowserKitTestCase.php b/tests/BrowserKitTestCase.php index 37c3af38..b35d8be5 100644 --- a/tests/BrowserKitTestCase.php +++ b/tests/BrowserKitTestCase.php @@ -50,7 +50,7 @@ abstract class BrowserKitTestCase extends BaseTestCase */ protected $userRole; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -76,7 +76,7 @@ public function setUp(): void $this->userRole = Role::find(3); } - public function tearDown(): void + protected function tearDown(): void { $this->beforeApplicationDestroyed(function () { DB::disconnect(); diff --git a/tests/TestCase.php b/tests/TestCase.php index fd7bade6..543c24a0 100755 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -54,7 +54,7 @@ public function signIn($user = null) /** * Set up tests. */ - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -80,7 +80,7 @@ public function setUp(): void $this->userRole = Role::find(3); } - public function tearDown(): void + protected function tearDown(): void { $this->beforeApplicationDestroyed(function () { DB::disconnect(); From 9312bbdf9aa30d6b2cc899a4be81cfb6395c8327 Mon Sep 17 00:00:00 2001 From: Viral Solani Date: Mon, 30 Sep 2019 13:50:36 +0000 Subject: [PATCH 08/15] Apply fixes from StyleCI --- app/Console/Commands/InstallAppCommand.php | 12 +-- app/Exceptions/Handler.php | 2 +- app/Helpers/helpers.php | 42 ++++----- .../Controllers/Api/V1/AuthController.php | 2 +- .../Api/V1/ForgotPasswordController.php | 2 +- .../Controllers/Api/V1/RegisterController.php | 2 +- .../Controllers/Api/V1/UsersController.php | 2 +- .../Backend/Search/SearchController.php | 2 +- .../Frontend/Auth/LoginController.php | 6 +- .../Frontend/Auth/ResetPasswordController.php | 2 +- .../Frontend/Auth/SocialLoginController.php | 8 +- app/Http/Middleware/RouteNeedsPermission.php | 2 +- app/Http/Middleware/RouteNeedsRole.php | 2 +- app/Http/Middleware/SessionTimeout.php | 4 +- app/Http/Responses/ViewResponse.php | 2 +- app/Http/Utilities/FileUploads.php | 4 +- app/Http/Utilities/Notification.php | 2 +- app/Http/Utilities/NotificationIos.php | 6 +- app/Http/Utilities/PushNotification.php | 6 +- app/Models/Access/Role/Traits/RoleAccess.php | 2 +- .../User/Traits/Attribute/UserAttribute.php | 8 +- app/Models/Access/User/Traits/UserAccess.php | 4 +- .../Backend/Access/Role/RoleRepository.php | 10 +-- .../Backend/Access/User/UserRepository.php | 6 +- .../Backend/Blogs/BlogsRepository.php | 2 +- .../History/EloquentHistoryRepository.php | 6 +- .../Backend/Settings/SettingsRepository.php | 4 +- .../Frontend/Access/User/UserRepository.php | 6 +- .../Frontend/Pages/PagesRepository.php | 2 +- config/broadcasting.php | 12 +-- config/cache.php | 26 +++--- config/database.php | 90 +++++++++---------- config/filesystems.php | 12 +-- config/logging.php | 40 ++++----- config/mail.php | 2 +- config/queue.php | 30 +++---- config/services.php | 6 +- .../seeds/Access/PermissionUserSeeder.php | 4 +- 38 files changed, 191 insertions(+), 191 deletions(-) diff --git a/app/Console/Commands/InstallAppCommand.php b/app/Console/Commands/InstallAppCommand.php index cadebf3d..db0f0f26 100644 --- a/app/Console/Commands/InstallAppCommand.php +++ b/app/Console/Commands/InstallAppCommand.php @@ -95,7 +95,7 @@ public function handle() $this->error('Missing '.ucfirst($missing_extension).' extension'); } - if (! file_exists('.env')) { + if (!file_exists('.env')) { File::copy('.env.example', '.env'); } @@ -150,7 +150,7 @@ protected function setDatabaseInfo() $this->username = env('DB_USERNAME'); $this->password = env('DB_PASSWORD'); - while (! checkDatabaseConnection()) { + while (!checkDatabaseConnection()) { // Ask for database details $this->host = $this->ask('Enter a host name?', config('config-variables.default_db_host')); $this->port = $this->ask('Enter a database port?', config('config-variables.default_db_port')); @@ -174,7 +174,7 @@ protected function setDatabaseInfo() $contents = preg_replace('/('.preg_quote('DB_USERNAME=').')(.*)/', 'DB_USERNAME='.$this->username, $contents); $contents = preg_replace('/('.preg_quote('DB_PASSWORD=').')(.*)/', 'DB_PASSWORD='.$this->password, $contents); - if (! $contents) { + if (!$contents) { throw new Exception('Error while writing credentials to .env file.'); } @@ -188,7 +188,7 @@ protected function setDatabaseInfo() // Clear DB name in config unset($this->laravel['config']['database.connections.mysql.database']); - if (! checkDatabaseConnection()) { + if (!checkDatabaseConnection()) { $this->error('Can not connect to database!'); } else { $this->info('Connected successfully!'); @@ -243,7 +243,7 @@ protected function getKeyFile() */ protected function createDatabase($database) { - if (! $database) { + if (!$database) { $this->info('Skipping creation of database as env(DB_DATABASE) is empty'); return; @@ -272,7 +272,7 @@ protected function createDatabase($database) */ protected function dumpDB($database) { - if (! empty($database)) { + if (!empty($database)) { // Force the new login to be used DB::purge(); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 15e6bbe9..e1cb0956 100755 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -54,7 +54,7 @@ public function report(Exception $exception) public function render($request, Exception $exception) { if (strpos($request->url(), '/api/') !== false) { - \Log::debug('API Request Exception - '.$request->url().' - '.$exception->getMessage().(! empty($request->all()) ? ' - '.json_encode($request->except(['password'])) : '')); + \Log::debug('API Request Exception - '.$request->url().' - '.$exception->getMessage().(!empty($request->all()) ? ' - '.json_encode($request->except(['password'])) : '')); if ($exception instanceof AuthorizationException) { return $this->setStatusCode(403)->respondWithError($exception->getMessage()); diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php index fb77b7b9..801cfe23 100644 --- a/app/Helpers/helpers.php +++ b/app/Helpers/helpers.php @@ -15,7 +15,7 @@ function generateUuid() return uuid::uuid4(); } -if (! function_exists('homeRoute')) { +if (!function_exists('homeRoute')) { /** * Return the route to the "home" page depending on authentication/authorization status. @@ -37,7 +37,7 @@ function homeRoute() /* * Global helpers file with misc functions. */ -if (! function_exists('app_name')) { +if (!function_exists('app_name')) { /** * Helper to grab the application name. * @@ -49,7 +49,7 @@ function app_name() } } -if (! function_exists('access')) { +if (!function_exists('access')) { /** * Access (lol) the Access:: facade as a simple function. */ @@ -59,7 +59,7 @@ function access() } } -if (! function_exists('history')) { +if (!function_exists('history')) { /** * Access the history facade anywhere. */ @@ -69,7 +69,7 @@ function history() } } -if (! function_exists('gravatar')) { +if (!function_exists('gravatar')) { /** * Access the gravatar helper. */ @@ -79,7 +79,7 @@ function gravatar() } } -if (! function_exists('includeRouteFiles')) { +if (!function_exists('includeRouteFiles')) { /** * Loops through a folder and requires all PHP files @@ -107,7 +107,7 @@ function includeRouteFiles($folder) } } -if (! function_exists('getRtlCss')) { +if (!function_exists('getRtlCss')) { /** * The path being passed is generated by Laravel Mix manifest file @@ -129,7 +129,7 @@ function getRtlCss($path) } } -if (! function_exists('settings')) { +if (!function_exists('settings')) { /** * Access the settings helper. */ @@ -137,13 +137,13 @@ function settings() { // Settings Details $settings = Setting::latest()->first(); - if (! empty($settings)) { + if (!empty($settings)) { return $settings; } } } -if (! function_exists('createNotification')) { +if (!function_exists('createNotification')) { /** * create new notification. * @@ -165,7 +165,7 @@ function createNotification($message, $userId) } } -if (! function_exists('escapeSlashes')) { +if (!function_exists('escapeSlashes')) { /** * Access the escapeSlashes helper. */ @@ -179,7 +179,7 @@ function escapeSlashes($path) } } -if (! function_exists('getMenuItems')) { +if (!function_exists('getMenuItems')) { /** * Converts items (json string) to array and return array. */ @@ -187,11 +187,11 @@ function getMenuItems($type = 'backend', $id = null) { $menu = new \App\Models\Menu\Menu(); $menu = $menu->where('type', $type); - if (! empty($id)) { + if (!empty($id)) { $menu = $menu->where('id', $id); } $menu = $menu->first(); - if (! empty($menu) && ! empty($menu->items)) { + if (!empty($menu) && !empty($menu->items)) { return json_decode($menu->items); } @@ -199,14 +199,14 @@ function getMenuItems($type = 'backend', $id = null) } } -if (! function_exists('getRouteUrl')) { +if (!function_exists('getRouteUrl')) { /** * Converts querystring params to array and use it as route params and returns URL. */ function getRouteUrl($url, $url_type = 'route', $separator = '?') { $routeUrl = ''; - if (! empty($url)) { + if (!empty($url)) { if ($url_type == 'route') { if (strpos($url, $separator) !== false) { $urlArray = explode($separator, $url); @@ -225,7 +225,7 @@ function getRouteUrl($url, $url_type = 'route', $separator = '?') } } -if (! function_exists('renderMenuItems')) { +if (!function_exists('renderMenuItems')) { /** * render sidebar menu items after permission check. */ @@ -235,7 +235,7 @@ function renderMenuItems($items, $viewName = 'backend.includes.partials.sidebar- // if(!empty($item->url) && !Route::has($item->url)) { // return; // } - if (! empty($item->view_permission_id)) { + if (!empty($item->view_permission_id)) { if (access()->allow($item->view_permission_id)) { echo view($viewName, compact('item')); } @@ -246,7 +246,7 @@ function renderMenuItems($items, $viewName = 'backend.includes.partials.sidebar- } } -if (! function_exists('isActiveMenuItem')) { +if (!function_exists('isActiveMenuItem')) { /** * checks if current URL is of current menu/sub-menu. */ @@ -259,7 +259,7 @@ function isActiveMenuItem($item, $separator = '?') if (Active::checkRoutePattern($item->clean_url)) { return true; } - if (! empty($item->children)) { + if (!empty($item->children)) { foreach ($item->children as $child) { $child->clean_url = $child->url; if (strpos($child->url, $separator) !== false) { @@ -275,7 +275,7 @@ function isActiveMenuItem($item, $separator = '?') } } -if (! function_exists('checkDatabaseConnection')) { +if (!function_exists('checkDatabaseConnection')) { /** * @return bool diff --git a/app/Http/Controllers/Api/V1/AuthController.php b/app/Http/Controllers/Api/V1/AuthController.php index dd953a98..ad431484 100644 --- a/app/Http/Controllers/Api/V1/AuthController.php +++ b/app/Http/Controllers/Api/V1/AuthController.php @@ -29,7 +29,7 @@ public function login(Request $request) $credentials = $request->only(['email', 'password']); try { - if (! Auth::attempt($credentials)) { + if (!Auth::attempt($credentials)) { return $this->throwValidation(trans('api.messages.login.failed')); } diff --git a/app/Http/Controllers/Api/V1/ForgotPasswordController.php b/app/Http/Controllers/Api/V1/ForgotPasswordController.php index 8bd3a3b1..ddaefd73 100644 --- a/app/Http/Controllers/Api/V1/ForgotPasswordController.php +++ b/app/Http/Controllers/Api/V1/ForgotPasswordController.php @@ -39,7 +39,7 @@ public function sendResetLinkEmail(Request $request) $user = $this->repository->findByEmail($request->get('email')); - if (! $user) { + if (!$user) { return $this->respondNotFound(trans('api.messages.forgot_password.validation.email_not_found')); } diff --git a/app/Http/Controllers/Api/V1/RegisterController.php b/app/Http/Controllers/Api/V1/RegisterController.php index cc804bd5..77e9dcb3 100644 --- a/app/Http/Controllers/Api/V1/RegisterController.php +++ b/app/Http/Controllers/Api/V1/RegisterController.php @@ -45,7 +45,7 @@ public function register(Request $request) $user = $this->repository->create($request->all()); - if (! Config::get('api.register.release_token')) { + if (!Config::get('api.register.release_token')) { return $this->respondCreated([ 'message' => trans('api.messages.registeration.success'), ]); diff --git a/app/Http/Controllers/Api/V1/UsersController.php b/app/Http/Controllers/Api/V1/UsersController.php index 718d9d0a..2b6c5374 100644 --- a/app/Http/Controllers/Api/V1/UsersController.php +++ b/app/Http/Controllers/Api/V1/UsersController.php @@ -124,7 +124,7 @@ public function deleteAll(Request $request) { $ids = $request->get('ids'); - if (isset($ids) && ! empty($ids)) { + if (isset($ids) && !empty($ids)) { $result = $this->repository->deleteAll($ids); } diff --git a/app/Http/Controllers/Backend/Search/SearchController.php b/app/Http/Controllers/Backend/Search/SearchController.php index 20b71387..358b66bd 100755 --- a/app/Http/Controllers/Backend/Search/SearchController.php +++ b/app/Http/Controllers/Backend/Search/SearchController.php @@ -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')); diff --git a/app/Http/Controllers/Frontend/Auth/LoginController.php b/app/Http/Controllers/Frontend/Auth/LoginController.php index 14f49791..e9138986 100755 --- a/app/Http/Controllers/Frontend/Auth/LoginController.php +++ b/app/Http/Controllers/Frontend/Auth/LoginController.php @@ -71,11 +71,11 @@ protected function authenticated(Request $request, $user) /* * 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]), true); - } elseif (! $user->isActive()) { + } elseif (!$user->isActive()) { access()->logout(); throw new GeneralException(trans('exceptions.frontend.auth.deactivated')); @@ -139,7 +139,7 @@ public function logout(Request $request) 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'); } diff --git a/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php b/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php index 0d354c9c..91eca980 100755 --- a/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Frontend/Auth/ResetPasswordController.php @@ -50,7 +50,7 @@ public function redirectPath() */ public function showResetForm($token = null) { - if (! $token) { + if (!$token) { return redirect()->route('frontend.auth.password.email'); } diff --git a/app/Http/Controllers/Frontend/Auth/SocialLoginController.php b/app/Http/Controllers/Frontend/Auth/SocialLoginController.php index 47182b8a..bee119a3 100755 --- a/app/Http/Controllers/Frontend/Auth/SocialLoginController.php +++ b/app/Http/Controllers/Frontend/Auth/SocialLoginController.php @@ -51,7 +51,7 @@ public function login(Request $request, $provider) $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 @@ public function login(Request $request, $provider) * 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 @@ public function login(Request $request, $provider) 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')); } diff --git a/app/Http/Middleware/RouteNeedsPermission.php b/app/Http/Middleware/RouteNeedsPermission.php index 648d9dd3..16f6a0db 100755 --- a/app/Http/Middleware/RouteNeedsPermission.php +++ b/app/Http/Middleware/RouteNeedsPermission.php @@ -32,7 +32,7 @@ public function handle($request, Closure $next, $permission, $needsAll = false) $access = access()->allow($permission); } - if (! $access) { + if (!$access) { return redirect() ->route('frontend.index') ->withFlashDanger(trans('auth.general_error')); diff --git a/app/Http/Middleware/RouteNeedsRole.php b/app/Http/Middleware/RouteNeedsRole.php index ec231b59..e7b83f16 100755 --- a/app/Http/Middleware/RouteNeedsRole.php +++ b/app/Http/Middleware/RouteNeedsRole.php @@ -32,7 +32,7 @@ public function handle($request, Closure $next, $role, $needsAll = false) $access = access()->hasRole($role); } - if (! $access) { + if (!$access) { return redirect() ->route('frontend.index') ->withFlashDanger(trans('auth.general_error')); diff --git a/app/Http/Middleware/SessionTimeout.php b/app/Http/Middleware/SessionTimeout.php index 9d92fc9d..8be173d2 100755 --- a/app/Http/Middleware/SessionTimeout.php +++ b/app/Http/Middleware/SessionTimeout.php @@ -43,10 +43,10 @@ public function handle($request, Closure $next) //Cookie Name for when 'remember me' is checked $remember_cookie = \Auth::guard()->getRecallerName(); - if (! Cookie::has($remember_cookie) && config('session.timeout_status')) { + if (!Cookie::has($remember_cookie) && 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'); diff --git a/app/Http/Responses/ViewResponse.php b/app/Http/Responses/ViewResponse.php index 53f52fb1..1e31d525 100644 --- a/app/Http/Responses/ViewResponse.php +++ b/app/Http/Responses/ViewResponse.php @@ -35,7 +35,7 @@ public function __construct($view, $with = []) */ public function toResponse($request) { - if (! empty($this->with)) { + if (!empty($this->with)) { return view($this->view)->with($this->with); } diff --git a/app/Http/Utilities/FileUploads.php b/app/Http/Utilities/FileUploads.php index 957eef16..8e422fa6 100755 --- a/app/Http/Utilities/FileUploads.php +++ b/app/Http/Utilities/FileUploads.php @@ -368,7 +368,7 @@ public function moveFile($source, $destination) $destination = $filePath.DIRECTORY_SEPARATOR.$destination; if (File::exists($source)) { $dir = dirname($destination); - if (! is_dir($dir)) { + if (!is_dir($dir)) { mkdir($dir, 0777, true); } @@ -393,7 +393,7 @@ public function copyFile($source, $destination) $destination = $filePath.DIRECTORY_SEPARATOR.$destination; if (File::exists($source)) { $dir = dirname($destination); - if (! is_dir($dir)) { + if (!is_dir($dir)) { mkdir($dir, 0777, true); } diff --git a/app/Http/Utilities/Notification.php b/app/Http/Utilities/Notification.php index 9e33f87c..78cd245e 100755 --- a/app/Http/Utilities/Notification.php +++ b/app/Http/Utilities/Notification.php @@ -130,7 +130,7 @@ public function setOptions(array $options) public function raiseerror($errorCode) { $codeValue = $this->getErrorMessages(); - if (! isset($codeValue[$errorCode])) { + if (!isset($codeValue[$errorCode])) { $errorException = 'Erro code '.$errorCode; } else { $errorException = $codeValue[$errorCode]; diff --git a/app/Http/Utilities/NotificationIos.php b/app/Http/Utilities/NotificationIos.php index 0e96dad2..edef630b 100755 --- a/app/Http/Utilities/NotificationIos.php +++ b/app/Http/Utilities/NotificationIos.php @@ -54,7 +54,7 @@ protected function _send($deviceId, $message, $sendOptions = []) 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; @@ -72,7 +72,7 @@ protected function _send($deviceId, $message, $sendOptions = []) $result = fwrite($fp, $msg, strlen($msg)); } //echo "
-------
"; - if (! $result) { + if (!$result) { return 'Message not delivered'.PHP_EOL; } else { return 'Message successfully delivered'.PHP_EOL; @@ -107,7 +107,7 @@ public function setPemFile($pemFile = 'apns_baseproject_dev.pem') // echo $_SERVER['DOCUMENT_ROOT'].'/app/Http/Controllers/Utilities/'.$pemFile;exit; //echo dirname(__FILE__); exit; // echo file_get_contents(dirname(__FILE__).'/'.$pemFile); exit; - if (! (file_exists($newPemFilePath)) && ! (is_readable($newPemFilePath))) { + if (!(file_exists($newPemFilePath)) && !(is_readable($newPemFilePath))) { $error = $this->raiseerror(self::ERROR_PEM_NOTACCESSIBLE); } $this->_pemFile = $newPemFilePath; diff --git a/app/Http/Utilities/PushNotification.php b/app/Http/Utilities/PushNotification.php index c10e4f45..b0bbbe4b 100755 --- a/app/Http/Utilities/PushNotification.php +++ b/app/Http/Utilities/PushNotification.php @@ -61,7 +61,7 @@ public function _pushNotification($msg, $type, $devicetoken) */ public function _pushToAndroid($registrationIds, $msg) { - if (! is_array($registrationIds)) { + if (!is_array($registrationIds)) { $registrationIds = [$registrationIds]; } $fields = [ @@ -108,7 +108,7 @@ public function _pushtoios($devicetoken, $message) //$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT, $ctx); - if (! $fp) { + if (!$fp) { exit("Failed to connect amarnew: $err $errstr".PHP_EOL); } @@ -122,7 +122,7 @@ public function _pushtoios($devicetoken, $message) $result = fwrite($fp, $msg, strlen($msg)); - if (! $result) { + if (!$result) { return false; } else { return true; diff --git a/app/Models/Access/Role/Traits/RoleAccess.php b/app/Models/Access/Role/Traits/RoleAccess.php index bae9cc53..cbac1bd5 100755 --- a/app/Models/Access/Role/Traits/RoleAccess.php +++ b/app/Models/Access/Role/Traits/RoleAccess.php @@ -16,7 +16,7 @@ trait RoleAccess */ public function savePermissions($inputPermissions) { - if (! empty($inputPermissions)) { + if (!empty($inputPermissions)) { $this->permissions()->sync($inputPermissions); } else { $this->permissions()->detach(); diff --git a/app/Models/Access/User/Traits/Attribute/UserAttribute.php b/app/Models/Access/User/Traits/Attribute/UserAttribute.php index f511e16a..22a49b15 100755 --- a/app/Models/Access/User/Traits/Attribute/UserAttribute.php +++ b/app/Models/Access/User/Traits/Attribute/UserAttribute.php @@ -20,7 +20,7 @@ public function canChangeEmail() */ public function canChangePassword() { - return ! app('session')->has(config('access.socialite_session_name')); + return !app('session')->has(config('access.socialite_session_name')); } /** @@ -62,7 +62,7 @@ public function getPictureAttribute() */ public function getPicture($size = false) { - if (! $size) { + if (!$size) { $size = config('gravatar.default.size'); } @@ -176,7 +176,7 @@ public function getStatusButtonAttribute($class) */ public function getConfirmedButtonAttribute($class) { - if (! $this->isConfirmed() && access()->allow('edit-user')) { + if (!$this->isConfirmed() && access()->allow('edit-user')) { return '
'; } @@ -228,7 +228,7 @@ public function getLoginAsButtonAttribute($class) /* * If the admin is currently NOT spoofing a user */ - if (access()->allow('login-as-user') && (! session()->has('admin_user_id') || ! session()->has('temp_user_id'))) { + if (access()->allow('login-as-user') && (!session()->has('admin_user_id') || !session()->has('temp_user_id'))) { //Won't break, but don't let them "Login As" themselves if ($this->id != access()->id()) { return 'getClassIf($condition, $activeClass, $inactiveClass); + } +} + +if (!function_exists('if_uri')) { + /** + * Check if the URI of the current request matches one of the specific URIs + * + * @param array|string $uris + * + * @return bool + */ + function if_uri($uris) + { + return app('active')->checkUri($uris); + } +} + +if (!function_exists('if_uri_pattern')) { + /** + * Check if the current URI matches one of specific patterns (using `Str::is`) + * + * @param array|string $patterns + * + * @return bool + */ + function if_uri_pattern($patterns) + { + return app('active')->checkUriPattern($patterns); + } +} + +if (!function_exists('if_query')) { + /** + * Check if one of the following condition is true: + * + the value of $value is `false` and the current querystring contain the key $key + * + the value of $value is not `false` and the current value of the $key key in the querystring equals to $value + * + the value of $value is not `false` and the current value of the $key key in the querystring is an array that + * contains the $value + * + * @param string $key + * @param mixed $value + * + * @return bool + */ + function if_query($key, $value) + { + return app('active')->checkQuery($key, $value); + } +} + +if (!function_exists('if_route')) { + /** + * Check if the name of the current route matches one of specific values + * + * @param array|string $routeNames + * + * @return bool + */ + function if_route($routeNames) + { + return app('active')->checkRoute($routeNames); + } +} + +if (!function_exists('if_route_pattern')) { + /** + * Check the current route name with one or some patterns + * + * @param array|string $patterns + * + * @return bool + */ + function if_route_pattern($patterns) + { + return app('active')->checkRoutePattern($patterns); + } +} + +if (!function_exists('if_route_param')) { + /** + * Check if the parameter of the current route has the correct value + * + * @param $param + * @param $value + * + * @return bool + */ + function if_route_param($param, $value) + { + return app('active')->checkRouteParam($param, $value); + } +} + +if (!function_exists('if_action')) { + /** + * Return 'active' class if current route action match one of provided action names + * + * @param array|string $actions + * + * @return bool + */ + function if_action($actions) + { + return app('active')->checkAction($actions); + } +} + +if (!function_exists('if_controller')) { + /** + * Check if the current controller class matches one of specific values + * + * @param array|string $controllers + * + * @return bool + */ + function if_controller($controllers) + { + return app('active')->checkController($controllers); + } +} + +if (!function_exists('current_controller')) { + /** + * Get the current controller class + * + * @return string + */ + function current_controller() + { + return app('active')->getController(); + } +} + +if (!function_exists('current_method')) { + /** + * Get the current controller method + * + * @return string + */ + function current_method() + { + return app('active')->getMethod(); + } +} + +if (!function_exists('current_action')) { + /** + * Get the current action string + * + * @return string + */ + function current_action() + { + return app('active')->getAction(); + } +} diff --git a/app/Providers/ActiveServiceProvider.php b/app/Providers/ActiveServiceProvider.php new file mode 100644 index 00000000..ecc646ab --- /dev/null +++ b/app/Providers/ActiveServiceProvider.php @@ -0,0 +1,88 @@ +=')) { + app('router')->matched( + function (RouteMatched $event) use ($instance) { + $instance->updateInstances($event->route, $event->request); + } + ); + } else { + app('router')->matched( + function ($route, $request) use ($instance) { + $instance->updateInstances($route, $request); + } + ); + } + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + $this->registerActive(); + $this->registerFacade(); + + + // $this->app->singleton( + // 'active', + // function ($app) { + + // $instance = new Active($app['router']->getCurrentRequest()); + + // return $instance; + // } + // ); + } + + /** + * Register the application bindings. + * + * @return void + */ + private function registerActive() + { + $this->app->bind('active', function ($app) { + return new Active($app['router']->getCurrentRequest()); + }); + } + + /** + * Register the vault facade without the user having to add it to the app.php file. + * + * @return void + */ + public function registerFacade() + { + $this->app->booting(function () { + $loader = \Illuminate\Foundation\AliasLoader::getInstance(); + $loader->alias('Active', \App\Services\Access\Facades\Active::class); + }); + } + +} diff --git a/app/Services/Active/Active.php b/app/Services/Active/Active.php new file mode 100644 index 00000000..02ea4609 --- /dev/null +++ b/app/Services/Active/Active.php @@ -0,0 +1,339 @@ + + *
  • current route URI
  • + *
  • current route name
  • + *
  • current action
  • + *
  • current controller
  • + * + * + * @package HieuLe\Active + * @author Hieu Le + * @version 3.2.0 + * + */ +class Active +{ + + /** + * Current request + * + * @var Request + */ + protected $request; + + /** + * Current matched route + * + * @var Route + */ + protected $route; + + /** + * Current action string + * + * @var string + */ + protected $action; + + /** + * Current controller class + * + * @var string + */ + protected $controller; + + /** + * Current controller method + * + * @var string + */ + protected $method; + + /** + * Current URI + * + * @var string + */ + protected $uri; + + /** + * Active constructor. + * + * @param Request $request current request instance + */ + public function __construct($request) + { + $this->updateInstances(null, $request); + } + + /** + * Update the route and request instances + * + * @param Route $route + * @param Request $request + */ + public function updateInstances($route, $request) + { + $this->request = $request; + if ($request) { + $this->uri = urldecode($request->path()); + } + + $this->route = $route; + if ($route) { + $this->action = $route->getActionName(); + + $actionSegments = Str::parseCallback($this->action, null); + $this->controller = head($actionSegments); + $this->method = last($actionSegments); + } + } + + /** + * Get the active class if the condition is not falsy + * + * @param $condition + * @param string $activeClass + * @param string $inactiveClass + * + * @return string + */ + public function getClassIf($condition, $activeClass = 'active', $inactiveClass = '') + { + return $condition ? $activeClass : $inactiveClass; + } + + /** + * Check if the URI of the current request matches one of the specific URIs + * + * @param array|string $uris + * + * @return bool + */ + public function checkUri($uris) + { + if (!$this->request) { + return false; + } + + foreach ((array)$uris as $uri) { + if ($this->uri == $uri) { + return true; + } + } + + return false; + } + + /** + * Check if the current URI matches one of specific patterns (using `Str::is`) + * + * @param array|string $patterns + * + * @return bool + */ + public function checkUriPattern($patterns) + { + if (!$this->request) { + return false; + } + + foreach ((array)$patterns as $p) { + if (Str::is($p, $this->uri)) { + return true; + } + } + + return false; + } + + /** + * Check if one of the following condition is true: + * + the value of $value is `false` and the current querystring contain the key $key + * + the value of $value is not `false` and the current value of the $key key in the querystring equals to $value + * + the value of $value is not `false` and the current value of the $key key in the querystring is an array that + * contains the $value + * + * @param string $key + * @param mixed $value + * + * @return bool + */ + public function checkQuery($key, $value) + { + if (!$this->request) { + return false; + } + + $queryValue = $this->request->query($key); + + // if the `key` exists in the query string with the correct value + // OR it exists with any value + // OR its value is an array that contains the specific value + if (($queryValue == $value) || ($queryValue !== null && $value === false) || (is_array($queryValue) && in_array($value, + $queryValue)) + ) { + return true; + } + + return false; + } + + /** + * Check if the name of the current route matches one of specific values + * + * @param array|string $routeNames + * + * @return bool + */ + public function checkRoute($routeNames) + { + if (!$this->route) { + return false; + } + + $routeName = $this->route->getName(); + + if (in_array($routeName, (array)$routeNames)) { + return true; + } + + return false; + } + + /** + * Check the current route name with one or some patterns + * + * @param array|string $patterns + * + * @return bool + */ + public function checkRoutePattern($patterns) + { + if (!$this->route) { + return false; + } + + $routeName = $this->route->getName(); + + if ($routeName == null) { + return in_array(null, $patterns); + } + + foreach ((array)$patterns as $p) { + if (Str::is($p, $routeName)) { + return true; + } + } + + return false; + } + + /** + * Check if the parameter of the current route has the correct value + * + * @param $param + * @param $value + * + * @return bool + */ + public function checkRouteParam($param, $value) + { + if (!$this->route) { + return false; + } + + $paramValue = $this->route->parameter($param); + + // If the parameter value is an instance of Model class, we compare $value with the value of + // its primary key. + if (is_a($paramValue, Model::class)) { + return $paramValue->{$paramValue->getKeyName()} == $value; + } + + return $paramValue == $value; + } + + /** + * Return 'active' class if current route action match one of provided action names + * + * @param array|string $actions + * + * @return bool + */ + public function checkAction($actions) + { + if (!$this->action) { + return false; + } + + if (in_array($this->action, (array)$actions)) { + return true; + } + + return false; + } + + /** + * Check if the current controller class matches one of specific values + * + * @param array|string $controllers + * + * @return bool + */ + public function checkController($controllers) + { + if (!$this->controller) { + return false; + } + + if (in_array($this->controller, (array)$controllers)) { + return true; + } + + return false; + } + + /** + * Get the current controller method + * + * @return string + */ + public function getMethod() + { + return $this->method ?: ""; + } + + /** + * Get the current action string + * + * @return string + */ + public function getAction() + { + return $this->action ?: ""; + } + + /** + * Get the current controller class + * + * @return string + */ + public function getController() + { + return $this->controller ?: ""; + } + +} diff --git a/app/Services/Active/Facades/Active.php b/app/Services/Active/Facades/Active.php new file mode 100644 index 00000000..e477eb1a --- /dev/null +++ b/app/Services/Active/Facades/Active.php @@ -0,0 +1,20 @@ +=7.1.3", + "php": ">=7.2.0", "psr/log": "~1.0" }, "require-dev": { "mockery/mockery": "~1.0", - "orchestra/testbench": "~3.8.0", - "phpunit/phpcov": "~5.0|~6.0", - "phpunit/phpunit": "~7.0|~8.0" + "orchestra/testbench": "~4.0.0", + "phpunit/phpcov": "~6.0", + "phpunit/phpunit": "~8.0" }, "type": "library", "extra": { @@ -72,35 +72,35 @@ "log-viewer", "logviewer" ], - "time": "2019-09-12T19:13:38+00:00" + "time": "2019-09-25T11:07:09+00:00" }, { "name": "arcanedev/no-captcha", - "version": "9.0.1", + "version": "10.0.0", "source": { "type": "git", "url": "https://github.com/ARCANEDEV/noCAPTCHA.git", - "reference": "ec3702eb76cb611340348625e115fc94dad42204" + "reference": "2c67130b04af01e6cbc122fc1d0c5804b262a289" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ARCANEDEV/noCAPTCHA/zipball/ec3702eb76cb611340348625e115fc94dad42204", - "reference": "ec3702eb76cb611340348625e115fc94dad42204", + "url": "https://api.github.com/repos/ARCANEDEV/noCAPTCHA/zipball/2c67130b04af01e6cbc122fc1d0c5804b262a289", + "reference": "2c67130b04af01e6cbc122fc1d0c5804b262a289", "shasum": "" }, "require": { - "arcanedev/php-html": "~2.0.0", - "arcanedev/support": "~4.5.0", + "arcanedev/php-html": "~3.0.0", + "arcanedev/support": "~5.0.0", "ext-curl": "*", "ext-json": "*", - "php": ">=7.1.3", + "php": ">=7.2.0", "psr/http-message": "~1.0" }, "require-dev": { - "arcanedev/laravel-html": "~5.8.0", - "orchestra/testbench": "~3.8.0", - "phpunit/phpcov": "~5.0|~6.0", - "phpunit/phpunit": "~7.0|~8.0" + "arcanedev/laravel-html": "~6.0.0", + "orchestra/testbench": "~4.0.0", + "phpunit/phpcov": "~6.0", + "phpunit/phpunit": "~8.0" }, "type": "library", "extra": { @@ -140,30 +140,30 @@ "no-captcha", "recaptcha" ], - "time": "2019-02-27T22:06:02+00:00" + "time": "2019-09-04T14:03:15+00:00" }, { "name": "arcanedev/php-html", - "version": "2.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/ARCANEDEV/php-html.git", - "reference": "9132616bbc817b7aaa7bec6bce26abe05c3aa5bd" + "reference": "eacca0e9ce4946df4ef92009ca25172ef62b4765" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ARCANEDEV/php-html/zipball/9132616bbc817b7aaa7bec6bce26abe05c3aa5bd", - "reference": "9132616bbc817b7aaa7bec6bce26abe05c3aa5bd", + "url": "https://api.github.com/repos/ARCANEDEV/php-html/zipball/eacca0e9ce4946df4ef92009ca25172ef62b4765", + "reference": "eacca0e9ce4946df4ef92009ca25172ef62b4765", "shasum": "" }, "require": { - "illuminate/support": "~5.8", - "php": ">=7.1.3" + "illuminate/support": "~6.0", + "php": ">=7.2.0" }, "require-dev": { "ext-dom": "*", - "phpunit/phpcov": "~5.0|~6.0", - "phpunit/phpunit": "~7.0|~8.0" + "phpunit/phpcov": "~6.0", + "phpunit/phpunit": "~8.0" }, "type": "library", "autoload": { @@ -191,31 +191,31 @@ "html", "tags" ], - "time": "2019-07-24T08:40:16+00:00" + "time": "2019-09-04T13:13:12+00:00" }, { "name": "arcanedev/support", - "version": "4.5.0", + "version": "5.0.0", "source": { "type": "git", "url": "https://github.com/ARCANEDEV/Support.git", - "reference": "2bb6e901404a12caa440520676b6507569d20715" + "reference": "cb32ca20be93a24bd2f86bb82263796023c5f761" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ARCANEDEV/Support/zipball/2bb6e901404a12caa440520676b6507569d20715", - "reference": "2bb6e901404a12caa440520676b6507569d20715", + "url": "https://api.github.com/repos/ARCANEDEV/Support/zipball/cb32ca20be93a24bd2f86bb82263796023c5f761", + "reference": "cb32ca20be93a24bd2f86bb82263796023c5f761", "shasum": "" }, "require": { - "illuminate/filesystem": "~5.8.0", - "illuminate/support": "~5.8.0", - "php": ">=7.1.3" + "illuminate/filesystem": "~6.0.0", + "illuminate/support": "~6.0.0", + "php": ">=7.2.0" }, "require-dev": { - "orchestra/testbench": "~3.8.0", - "phpunit/phpcov": "~5.0|~6.0", - "phpunit/phpunit": "~7.0|~8.0" + "orchestra/testbench": "~4.0.0", + "phpunit/phpcov": "~6.0", + "phpunit/phpunit": "~8.0" }, "type": "library", "autoload": { @@ -246,7 +246,7 @@ "laravel", "support" ], - "time": "2019-02-27T18:33:30+00:00" + "time": "2019-09-04T08:48:36+00:00" }, { "name": "beyondcode/laravel-self-diagnosis", @@ -1463,69 +1463,6 @@ ], "time": "2019-07-01T23:21:34+00:00" }, - { - "name": "hieu-le/active", - "version": "3.5.1", - "source": { - "type": "git", - "url": "https://github.com/letrunghieu/active.git", - "reference": "42d0f50be74b89d730bb4c0ee8c32447630506c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/letrunghieu/active/zipball/42d0f50be74b89d730bb4c0ee8c32447630506c6", - "reference": "42d0f50be74b89d730bb4c0ee8c32447630506c6", - "shasum": "" - }, - "require": { - "laravel/framework": "^5.5", - "php": ">=7.0" - }, - "require-dev": { - "codeclimate/php-test-reporter": "dev-master", - "orchestra/testbench": "^3.1", - "phpunit/phpunit": "~6.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "HieuLe\\Active\\ActiveServiceProvider" - ], - "aliases": { - "Active": "HieuLe\\Active\\Facades\\Active" - } - } - }, - "autoload": { - "psr-4": { - "HieuLe\\Active\\": "src/", - "HieuLe\\ActiveTest\\": "tests/" - }, - "files": [ - "src/helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Hieu Le", - "email": "letrunghieu.cse09@gmail.com", - "homepage": "https://www.hieule.info" - } - ], - "description": "The helper class for Laravel (4/5) applications to get active class base on current route", - "homepage": "https://www.hieule.info/tag/laravel-active/", - "keywords": [ - "active", - "laravel", - "routing" - ], - "time": "2017-09-07T02:36:51+00:00" - }, { "name": "intervention/image", "version": "2.5.0", @@ -1686,43 +1623,43 @@ }, { "name": "laravel/framework", - "version": "v5.8.35", + "version": "v6.0.4", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "5a9e4d241a8b815e16c9d2151e908992c38db197" + "reference": "372e0add8a58e0e3deb78f87cbb2dc40d3e0ff08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/5a9e4d241a8b815e16c9d2151e908992c38db197", - "reference": "5a9e4d241a8b815e16c9d2151e908992c38db197", + "url": "https://api.github.com/repos/laravel/framework/zipball/372e0add8a58e0e3deb78f87cbb2dc40d3e0ff08", + "reference": "372e0add8a58e0e3deb78f87cbb2dc40d3e0ff08", "shasum": "" }, "require": { "doctrine/inflector": "^1.1", "dragonmantank/cron-expression": "^2.0", - "egulias/email-validator": "^2.0", + "egulias/email-validator": "^2.1.10", "erusev/parsedown": "^1.7", "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", "league/flysystem": "^1.0.8", - "monolog/monolog": "^1.12", - "nesbot/carbon": "^1.26.3 || ^2.0", + "monolog/monolog": "^1.12|^2.0", + "nesbot/carbon": "^2.0", "opis/closure": "^3.1", - "php": "^7.1.3", + "php": "^7.2", "psr/container": "^1.0", "psr/simple-cache": "^1.0", "ramsey/uuid": "^3.7", "swiftmailer/swiftmailer": "^6.0", - "symfony/console": "^4.2", - "symfony/debug": "^4.2", - "symfony/finder": "^4.2", - "symfony/http-foundation": "^4.2", - "symfony/http-kernel": "^4.2", - "symfony/process": "^4.2", - "symfony/routing": "^4.2", - "symfony/var-dumper": "^4.2", + "symfony/console": "^4.3.4", + "symfony/debug": "^4.3.4", + "symfony/finder": "^4.3.4", + "symfony/http-foundation": "^4.3.4", + "symfony/http-kernel": "^4.3.4", + "symfony/process": "^4.3.4", + "symfony/routing": "^4.3.4", + "symfony/var-dumper": "^4.3.4", "tijsverkoyen/css-to-inline-styles": "^2.2.1", "vlucas/phpdotenv": "^3.3" }, @@ -1762,47 +1699,44 @@ "require-dev": { "aws/aws-sdk-php": "^3.0", "doctrine/dbal": "^2.6", - "filp/whoops": "^2.1.4", + "filp/whoops": "^2.4", "guzzlehttp/guzzle": "^6.3", "league/flysystem-cached-adapter": "^1.0", - "mockery/mockery": "^1.0", + "mockery/mockery": "^1.2.3", "moontoast/math": "^1.1", - "orchestra/testbench-core": "3.8.*", + "orchestra/testbench-core": "^4.0", "pda/pheanstalk": "^4.0", - "phpunit/phpunit": "^7.5|^8.0", + "phpunit/phpunit": "^8.3", "predis/predis": "^1.1.1", - "symfony/css-selector": "^4.2", - "symfony/dom-crawler": "^4.2", + "symfony/cache": "^4.3", "true/punycode": "^2.1" }, "suggest": { - "aws/aws-sdk-php": "Required to use the SQS queue driver and SES mail driver (^3.0).", + "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage and SES mail driver (^3.0).", "doctrine/dbal": "Required to rename columns and drop SQLite columns (^2.6).", "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", + "ext-memcached": "Required to use the memcache cache driver.", "ext-pcntl": "Required to use all features of the queue worker.", "ext-posix": "Required to use all features of the queue worker.", - "filp/whoops": "Required for friendly error pages in development (^2.1.4).", + "ext-redis": "Required to use the Redis cache and queue drivers.", + "filp/whoops": "Required for friendly error pages in development (^2.4).", "fzaninotto/faker": "Required to use the eloquent factory builder (^1.4).", - "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (^6.0).", + "guzzlehttp/guzzle": "Required to use the Mailgun mail driver and the ping methods on schedules (^6.0).", "laravel/tinker": "Required to use the tinker console command (^1.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^1.0).", "league/flysystem-cached-adapter": "Required to use the Flysystem cache (^1.0).", - "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (^1.0).", "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", "moontoast/math": "Required to use ordered UUIDs (^1.1).", - "nexmo/client": "Required to use the Nexmo transport (^1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", - "predis/predis": "Required to use the redis cache and queue drivers (^1.0).", "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^3.0).", - "symfony/css-selector": "Required to use some of the crawler integration testing tools (^4.2).", - "symfony/dom-crawler": "Required to use most of the crawler integration testing tools (^4.2).", - "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.1).", + "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2).", "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.8-dev" + "dev-master": "6.x-dev" } }, "autoload": { @@ -1830,7 +1764,7 @@ "framework", "laravel" ], - "time": "2019-09-03T16:44:30+00:00" + "time": "2019-09-24T13:40:36+00:00" }, { "name": "laravel/passport", @@ -2032,35 +1966,35 @@ }, { "name": "laravelcollective/html", - "version": "v5.8.1", + "version": "v6.0.2", "source": { "type": "git", "url": "https://github.com/LaravelCollective/html.git", - "reference": "3a1c9974ea629eed96e101a24e3852ced382eb29" + "reference": "2f181aba73390eec13d398bf57877b1cc3bc2588" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/LaravelCollective/html/zipball/3a1c9974ea629eed96e101a24e3852ced382eb29", - "reference": "3a1c9974ea629eed96e101a24e3852ced382eb29", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/2f181aba73390eec13d398bf57877b1cc3bc2588", + "reference": "2f181aba73390eec13d398bf57877b1cc3bc2588", "shasum": "" }, "require": { - "illuminate/http": "5.8.*", - "illuminate/routing": "5.8.*", - "illuminate/session": "5.8.*", - "illuminate/support": "5.8.*", - "illuminate/view": "5.8.*", - "php": ">=7.1.3" + "illuminate/http": "6.0.*", + "illuminate/routing": "6.0.*", + "illuminate/session": "6.0.*", + "illuminate/support": "6.0.*", + "illuminate/view": "6.0.*", + "php": ">=7.2" }, "require-dev": { - "illuminate/database": "5.8.*", + "illuminate/database": "6.0.*", "mockery/mockery": "~1.0", "phpunit/phpunit": "~7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.8-dev" + "dev-master": "6.0-dev" }, "laravel": { "providers": [ @@ -2096,7 +2030,7 @@ ], "description": "HTML and Form Builders for the Laravel Framework", "homepage": "https://laravelcollective.com", - "time": "2019-09-05T12:32:25+00:00" + "time": "2019-09-23T06:16:50+00:00" }, { "name": "lcobucci/jwt", @@ -2429,21 +2363,21 @@ }, { "name": "monolog/monolog", - "version": "1.25.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "70e65a5470a42cfec1a7da00d30edb6e617e8dcf" + "reference": "68545165e19249013afd1d6f7485aecff07a2d22" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/70e65a5470a42cfec1a7da00d30edb6e617e8dcf", - "reference": "70e65a5470a42cfec1a7da00d30edb6e617e8dcf", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/68545165e19249013afd1d6f7485aecff07a2d22", + "reference": "68545165e19249013afd1d6f7485aecff07a2d22", "shasum": "" }, "require": { - "php": ">=5.3.0", - "psr/log": "~1.0" + "php": "^7.2", + "psr/log": "^1.0.1" }, "provide": { "psr/log-implementation": "1.0.0" @@ -2451,33 +2385,36 @@ "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", - "graylog2/gelf-php": "~1.0", - "jakub-onderka/php-parallel-lint": "0.9", + "elasticsearch/elasticsearch": "^6.0", + "graylog2/gelf-php": "^1.4.2", + "jakub-onderka/php-parallel-lint": "^0.9", "php-amqplib/php-amqplib": "~2.4", "php-console/php-console": "^3.1.3", - "phpunit/phpunit": "~4.5", - "phpunit/phpunit-mock-objects": "2.3.0", + "phpspec/prophecy": "^1.6.1", + "phpunit/phpunit": "^8.3", + "predis/predis": "^1.1", + "rollbar/rollbar": "^1.3", "ruflin/elastica": ">=0.90 <3.0", - "sentry/sentry": "^0.13", "swiftmailer/swiftmailer": "^5.3|^6.0" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", - "ext-mongo": "Allow sending log messages to a MongoDB server", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", - "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", "php-console/php-console": "Allow sending log messages to Google Chrome", "rollbar/rollbar": "Allow sending log messages to Rollbar", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server", - "sentry/sentry": "Allow sending log messages to a Sentry server" + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -2503,7 +2440,7 @@ "logging", "psr-3" ], - "time": "2019-09-06T13:49:17+00:00" + "time": "2019-08-30T09:56:44+00:00" }, { "name": "nesbot/carbon", @@ -4932,16 +4869,16 @@ }, { "name": "vlucas/phpdotenv", - "version": "v3.5.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222" + "reference": "1bdf24f065975594f6a117f0f1f6cabf1333b156" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222", - "reference": "95cb0fa6c025f7f0db7fc60f81e9fb231eb2d222", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/1bdf24f065975594f6a117f0f1f6cabf1333b156", + "reference": "1bdf24f065975594f6a117f0f1f6cabf1333b156", "shasum": "" }, "require": { @@ -4950,12 +4887,12 @@ "symfony/polyfill-ctype": "^1.9" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0" + "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.5-dev" + "dev-master": "3.6-dev" } }, "autoload": { @@ -4985,7 +4922,7 @@ "env", "environment" ], - "time": "2019-08-27T17:00:38+00:00" + "time": "2019-09-10T21:37:39+00:00" }, { "name": "yajra/laravel-datatables-oracle", @@ -5469,6 +5406,131 @@ ], "time": "2019-03-17T17:37:11+00:00" }, + { + "name": "facade/flare-client-php", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/facade/flare-client-php.git", + "reference": "4de2e8062e66edadbff261ebb5baae6eccfb799c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/flare-client-php/zipball/4de2e8062e66edadbff261ebb5baae6eccfb799c", + "reference": "4de2e8062e66edadbff261ebb5baae6eccfb799c", + "shasum": "" + }, + "require": { + "facade/ignition-contracts": "~1.0", + "illuminate/pipeline": "~5.5|~5.6|~5.7|~5.8|^6.0", + "php": "^7.1", + "symfony/http-foundation": "~3.3|~4.1", + "symfony/var-dumper": "^3.4|^4.0" + }, + "require-dev": { + "larapack/dd": "^1.1", + "phpunit/phpunit": "^7.5.16", + "spatie/phpunit-snapshot-assertions": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Facade\\FlareClient\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Send PHP errors to Flare", + "homepage": "https://github.com/facade/flare-client-php", + "keywords": [ + "exception", + "facade", + "flare", + "reporting" + ], + "time": "2019-09-27T14:54:17+00:00" + }, + { + "name": "facade/ignition", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/facade/ignition.git", + "reference": "40461a1f680171876c186dfff419b2a4c892995c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facade/ignition/zipball/40461a1f680171876c186dfff419b2a4c892995c", + "reference": "40461a1f680171876c186dfff419b2a4c892995c", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "facade/flare-client-php": "^1.1", + "facade/ignition-contracts": "^1.0", + "filp/whoops": "^2.4", + "illuminate/support": "~5.5.0 || ~5.6.0 || ~5.7.0 || ~5.8.0 || ^6.0", + "monolog/monolog": "^1.12 || ^2.0", + "php": "^7.1", + "scrivo/highlight.php": "^9.15", + "symfony/console": "^3.4 || ^4.0", + "symfony/var-dumper": "^3.4 || ^4.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.14", + "mockery/mockery": "^1.2", + "orchestra/testbench": "^3.5 || ^3.6 || ^3.7 || ^3.8 || ^4.0" + }, + "suggest": { + "laravel/telescope": "^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + }, + "laravel": { + "providers": [ + "Facade\\Ignition\\IgnitionServiceProvider" + ], + "aliases": { + "Flare": "Facade\\Ignition\\Facades\\Flare" + } + } + }, + "autoload": { + "psr-4": { + "Facade\\Ignition\\": "src" + }, + "files": [ + "src/helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A beautiful error page for Laravel applications.", + "homepage": "https://github.com/facade/ignition", + "keywords": [ + "error", + "flare", + "laravel", + "page" + ], + "time": "2019-09-27T16:49:08+00:00" + }, { "name": "filp/whoops", "version": "2.5.0", @@ -5998,6 +6060,70 @@ ], "time": "2019-08-09T12:45:53+00:00" }, + { + "name": "nunomaduro/collision", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/collision.git", + "reference": "af42d339fe2742295a54f6fdd42aaa6f8c4aca68" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/af42d339fe2742295a54f6fdd42aaa6f8c4aca68", + "reference": "af42d339fe2742295a54f6fdd42aaa6f8c4aca68", + "shasum": "" + }, + "require": { + "filp/whoops": "^2.1.4", + "jakub-onderka/php-console-highlighter": "0.3.*|0.4.*", + "php": "^7.1", + "symfony/console": "~2.8|~3.3|~4.0" + }, + "require-dev": { + "laravel/framework": "5.8.*", + "nunomaduro/larastan": "^0.3.0", + "phpstan/phpstan": "^0.11", + "phpunit/phpunit": "~8.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "NunoMaduro\\Collision\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Cli error handling for console/command-line PHP applications.", + "keywords": [ + "artisan", + "cli", + "command-line", + "console", + "error", + "handling", + "laravel", + "laravel-zero", + "php", + "symfony" + ], + "time": "2019-03-07T21:35:13+00:00" + }, { "name": "phar-io/manifest", "version": "1.0.3", @@ -6366,16 +6492,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "7.0.7", + "version": "7.0.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "7743bbcfff2a907e9ee4a25be13d0f8ec5e73800" + "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7743bbcfff2a907e9ee4a25be13d0f8ec5e73800", - "reference": "7743bbcfff2a907e9ee4a25be13d0f8ec5e73800", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/aa0d179a13284c7420fc281fc32750e6cc7c9e2f", + "reference": "aa0d179a13284c7420fc281fc32750e6cc7c9e2f", "shasum": "" }, "require": { @@ -6384,7 +6510,7 @@ "php": "^7.2", "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.1.0", + "phpunit/php-token-stream": "^3.1.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", @@ -6425,7 +6551,7 @@ "testing", "xunit" ], - "time": "2019-07-25T05:31:54+00:00" + "time": "2019-09-17T06:24:36+00:00" }, { "name": "phpunit/php-file-iterator", @@ -6569,16 +6695,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "e899757bb3df5ff6e95089132f32cd59aac2220a" + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e899757bb3df5ff6e95089132f32cd59aac2220a", - "reference": "e899757bb3df5ff6e95089132f32cd59aac2220a", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", "shasum": "" }, "require": { @@ -6614,7 +6740,7 @@ "keywords": [ "tokenizer" ], - "time": "2019-07-25T05:29:42+00:00" + "time": "2019-09-17T06:23:10+00:00" }, { "name": "phpunit/phpunit", @@ -6699,6 +6825,73 @@ ], "time": "2019-09-14T09:12:03+00:00" }, + { + "name": "scrivo/highlight.php", + "version": "v9.15.10.0", + "source": { + "type": "git", + "url": "https://github.com/scrivo/highlight.php.git", + "reference": "9ad3adb4456dc91196327498dbbce6aa1ba1239e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/scrivo/highlight.php/zipball/9ad3adb4456dc91196327498dbbce6aa1ba1239e", + "reference": "9ad3adb4456dc91196327498dbbce6aa1ba1239e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "php": ">=5.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.7", + "symfony/finder": "^2.8" + }, + "suggest": { + "ext-dom": "Needed to make use of the features in the utilities namespace" + }, + "type": "library", + "autoload": { + "psr-0": { + "Highlight\\": "", + "HighlightUtilities\\": "" + }, + "files": [ + "HighlightUtilities/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Geert Bergman", + "homepage": "http://www.scrivo.org/", + "role": "Project Author" + }, + { + "name": "Vladimir Jimenez", + "homepage": "https://allejo.io", + "role": "Contributor" + }, + { + "name": "Martin Folkers", + "homepage": "https://twobrain.io", + "role": "Contributor" + } + ], + "description": "Server side syntax highlighter that supports 185 languages. It's a PHP port of highlight.js", + "keywords": [ + "code", + "highlight", + "highlight.js", + "highlight.php", + "syntax" + ], + "time": "2019-08-27T04:27:48+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", @@ -7683,7 +7876,7 @@ "prefer-stable": true, "prefer-lowest": false, "platform": { - "php": ">=7.1.3" + "php": "^7.2" }, "platform-dev": [] } diff --git a/config/app.php b/config/app.php index b8e06eeb..3a0e4a25 100755 --- a/config/app.php +++ b/config/app.php @@ -180,7 +180,7 @@ Collective\Html\HtmlServiceProvider::class, Creativeorange\Gravatar\GravatarServiceProvider::class, //DaveJamesMiller\Breadcrumbs\ServiceProvider::class, - HieuLe\Active\ActiveServiceProvider::class, + //HieuLe\Active\ActiveServiceProvider::class, Laravel\Socialite\SocialiteServiceProvider::class, Laravel\Tinker\TinkerServiceProvider::class, Yajra\DataTables\DataTablesServiceProvider::class, @@ -189,6 +189,7 @@ * Application Service Providers... */ App\Providers\AccessServiceProvider::class, + App\Providers\ActiveServiceProvider::class, App\Providers\AppServiceProvider::class, App\Providers\AuthServiceProvider::class, App\Providers\BladeServiceProvider::class, @@ -251,7 +252,6 @@ /* * Third Party Aliases */ - 'Active' => HieuLe\Active\Facades\Active::class, 'Breadcrumbs' => DaveJamesMiller\Breadcrumbs\Facade::class, 'Captcha' => Arcanedev\NoCaptcha\Facades\NoCaptcha::class, 'Form' => Collective\Html\FormFacade::class, diff --git a/docker-compose.yml b/docker-compose.yml index 2ddc97f4..a5461388 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,4 @@ -version: "3" +version: "2" services: app: @@ -9,7 +9,7 @@ services: dockerfile: Dockerfile restart: always ports: - - 80:80 + - 8080:80 volumes: - .:/var/www/html/ mysql: From 407f5fa688f79dc905de6eac599c29c121f3b16a Mon Sep 17 00:00:00 2001 From: Viral Solani Date: Tue, 1 Oct 2019 13:24:25 +0000 Subject: [PATCH 10/15] Apply fixes from StyleCI --- app/Helpers/activeHelpers.php | 24 ++++----- app/Providers/ActiveServiceProvider.php | 5 +- app/Services/Active/Active.php | 67 ++++++++++++------------- app/Services/Active/Facades/Active.php | 4 +- 4 files changed, 46 insertions(+), 54 deletions(-) diff --git a/app/Helpers/activeHelpers.php b/app/Helpers/activeHelpers.php index afc6c015..a55e48a1 100644 --- a/app/Helpers/activeHelpers.php +++ b/app/Helpers/activeHelpers.php @@ -2,7 +2,7 @@ if (!function_exists('active_class')) { /** - * Get the active class if the condition is not falsy + * Get the active class if the condition is not falsy. * * @param $condition * @param string $activeClass @@ -18,7 +18,7 @@ function active_class($condition, $activeClass = 'active', $inactiveClass = '') if (!function_exists('if_uri')) { /** - * Check if the URI of the current request matches one of the specific URIs + * Check if the URI of the current request matches one of the specific URIs. * * @param array|string $uris * @@ -32,7 +32,7 @@ function if_uri($uris) if (!function_exists('if_uri_pattern')) { /** - * Check if the current URI matches one of specific patterns (using `Str::is`) + * Check if the current URI matches one of specific patterns (using `Str::is`). * * @param array|string $patterns * @@ -50,7 +50,7 @@ function if_uri_pattern($patterns) * + the value of $value is `false` and the current querystring contain the key $key * + the value of $value is not `false` and the current value of the $key key in the querystring equals to $value * + the value of $value is not `false` and the current value of the $key key in the querystring is an array that - * contains the $value + * contains the $value. * * @param string $key * @param mixed $value @@ -65,7 +65,7 @@ function if_query($key, $value) if (!function_exists('if_route')) { /** - * Check if the name of the current route matches one of specific values + * Check if the name of the current route matches one of specific values. * * @param array|string $routeNames * @@ -79,7 +79,7 @@ function if_route($routeNames) if (!function_exists('if_route_pattern')) { /** - * Check the current route name with one or some patterns + * Check the current route name with one or some patterns. * * @param array|string $patterns * @@ -93,7 +93,7 @@ function if_route_pattern($patterns) if (!function_exists('if_route_param')) { /** - * Check if the parameter of the current route has the correct value + * Check if the parameter of the current route has the correct value. * * @param $param * @param $value @@ -108,7 +108,7 @@ function if_route_param($param, $value) if (!function_exists('if_action')) { /** - * Return 'active' class if current route action match one of provided action names + * Return 'active' class if current route action match one of provided action names. * * @param array|string $actions * @@ -122,7 +122,7 @@ function if_action($actions) if (!function_exists('if_controller')) { /** - * Check if the current controller class matches one of specific values + * Check if the current controller class matches one of specific values. * * @param array|string $controllers * @@ -136,7 +136,7 @@ function if_controller($controllers) if (!function_exists('current_controller')) { /** - * Get the current controller class + * Get the current controller class. * * @return string */ @@ -148,7 +148,7 @@ function current_controller() if (!function_exists('current_method')) { /** - * Get the current controller method + * Get the current controller method. * * @return string */ @@ -160,7 +160,7 @@ function current_method() if (!function_exists('current_action')) { /** - * Get the current action string + * Get the current action string. * * @return string */ diff --git a/app/Providers/ActiveServiceProvider.php b/app/Providers/ActiveServiceProvider.php index ecc646ab..952d0713 100644 --- a/app/Providers/ActiveServiceProvider.php +++ b/app/Providers/ActiveServiceProvider.php @@ -5,12 +5,11 @@ use App\Services\Active\Active; use Illuminate\Foundation\Application; use Illuminate\Routing\Events\RouteMatched; -use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Route; +use Illuminate\Support\ServiceProvider; class ActiveServiceProvider extends ServiceProvider { - /** * Indicates if loading of the provider is deferred. * @@ -48,7 +47,6 @@ public function register() $this->registerActive(); $this->registerFacade(); - // $this->app->singleton( // 'active', // function ($app) { @@ -84,5 +82,4 @@ public function registerFacade() $loader->alias('Active', \App\Services\Access\Facades\Active::class); }); } - } diff --git a/app/Services/Active/Active.php b/app/Services/Active/Active.php index 02ea4609..3ae3c224 100644 --- a/app/Services/Active/Active.php +++ b/app/Services/Active/Active.php @@ -8,7 +8,7 @@ use Illuminate\Support\Str; /** - * Return "active" class for the current route if needed + * Return "active" class for the current route if needed. * * Check the current route to decide whether return an "active" class base on: *
      @@ -18,51 +18,49 @@ *
    • current controller
    • *
    * - * @package HieuLe\Active * @author Hieu Le - * @version 3.2.0 * + * @version 3.2.0 */ class Active { - /** - * Current request + * Current request. * * @var Request */ protected $request; /** - * Current matched route + * Current matched route. * * @var Route */ protected $route; /** - * Current action string + * Current action string. * * @var string */ protected $action; /** - * Current controller class + * Current controller class. * * @var string */ protected $controller; /** - * Current controller method + * Current controller method. * * @var string */ protected $method; /** - * Current URI + * Current URI. * * @var string */ @@ -79,7 +77,7 @@ public function __construct($request) } /** - * Update the route and request instances + * Update the route and request instances. * * @param Route $route * @param Request $request @@ -95,14 +93,14 @@ public function updateInstances($route, $request) if ($route) { $this->action = $route->getActionName(); - $actionSegments = Str::parseCallback($this->action, null); + $actionSegments = Str::parseCallback($this->action, null); $this->controller = head($actionSegments); - $this->method = last($actionSegments); + $this->method = last($actionSegments); } } /** - * Get the active class if the condition is not falsy + * Get the active class if the condition is not falsy. * * @param $condition * @param string $activeClass @@ -116,7 +114,7 @@ public function getClassIf($condition, $activeClass = 'active', $inactiveClass = } /** - * Check if the URI of the current request matches one of the specific URIs + * Check if the URI of the current request matches one of the specific URIs. * * @param array|string $uris * @@ -128,7 +126,7 @@ public function checkUri($uris) return false; } - foreach ((array)$uris as $uri) { + foreach ((array) $uris as $uri) { if ($this->uri == $uri) { return true; } @@ -138,7 +136,7 @@ public function checkUri($uris) } /** - * Check if the current URI matches one of specific patterns (using `Str::is`) + * Check if the current URI matches one of specific patterns (using `Str::is`). * * @param array|string $patterns * @@ -150,7 +148,7 @@ public function checkUriPattern($patterns) return false; } - foreach ((array)$patterns as $p) { + foreach ((array) $patterns as $p) { if (Str::is($p, $this->uri)) { return true; } @@ -164,7 +162,7 @@ public function checkUriPattern($patterns) * + the value of $value is `false` and the current querystring contain the key $key * + the value of $value is not `false` and the current value of the $key key in the querystring equals to $value * + the value of $value is not `false` and the current value of the $key key in the querystring is an array that - * contains the $value + * contains the $value. * * @param string $key * @param mixed $value @@ -192,7 +190,7 @@ public function checkQuery($key, $value) } /** - * Check if the name of the current route matches one of specific values + * Check if the name of the current route matches one of specific values. * * @param array|string $routeNames * @@ -206,7 +204,7 @@ public function checkRoute($routeNames) $routeName = $this->route->getName(); - if (in_array($routeName, (array)$routeNames)) { + if (in_array($routeName, (array) $routeNames)) { return true; } @@ -214,7 +212,7 @@ public function checkRoute($routeNames) } /** - * Check the current route name with one or some patterns + * Check the current route name with one or some patterns. * * @param array|string $patterns * @@ -232,7 +230,7 @@ public function checkRoutePattern($patterns) return in_array(null, $patterns); } - foreach ((array)$patterns as $p) { + foreach ((array) $patterns as $p) { if (Str::is($p, $routeName)) { return true; } @@ -242,7 +240,7 @@ public function checkRoutePattern($patterns) } /** - * Check if the parameter of the current route has the correct value + * Check if the parameter of the current route has the correct value. * * @param $param * @param $value @@ -267,7 +265,7 @@ public function checkRouteParam($param, $value) } /** - * Return 'active' class if current route action match one of provided action names + * Return 'active' class if current route action match one of provided action names. * * @param array|string $actions * @@ -279,7 +277,7 @@ public function checkAction($actions) return false; } - if (in_array($this->action, (array)$actions)) { + if (in_array($this->action, (array) $actions)) { return true; } @@ -287,7 +285,7 @@ public function checkAction($actions) } /** - * Check if the current controller class matches one of specific values + * Check if the current controller class matches one of specific values. * * @param array|string $controllers * @@ -299,7 +297,7 @@ public function checkController($controllers) return false; } - if (in_array($this->controller, (array)$controllers)) { + if (in_array($this->controller, (array) $controllers)) { return true; } @@ -307,33 +305,32 @@ public function checkController($controllers) } /** - * Get the current controller method + * Get the current controller method. * * @return string */ public function getMethod() { - return $this->method ?: ""; + return $this->method ?: ''; } /** - * Get the current action string + * Get the current action string. * * @return string */ public function getAction() { - return $this->action ?: ""; + return $this->action ?: ''; } /** - * Get the current controller class + * Get the current controller class. * * @return string */ public function getController() { - return $this->controller ?: ""; + return $this->controller ?: ''; } - } diff --git a/app/Services/Active/Facades/Active.php b/app/Services/Active/Facades/Active.php index e477eb1a..25ee2bb1 100644 --- a/app/Services/Active/Facades/Active.php +++ b/app/Services/Active/Facades/Active.php @@ -5,16 +5,14 @@ use Illuminate\Support\Facades\Facade; /** - * Active facade class + * Active facade class. * * @author Hieu Le */ class Active extends Facade { - protected static function getFacadeAccessor() { return 'active'; } - } From 7475205f4f76a32d0d811f77e3fb64f087d0a102 Mon Sep 17 00:00:00 2001 From: Kamlesh Gupta Date: Fri, 4 Oct 2019 12:15:50 +0530 Subject: [PATCH 11/15] Fix the issue of log-viewer in laravel 5.6 --- composer.json | 3 +- composer.lock | 288 +++++++++++++++---------------------------------- config/app.php | 2 - 3 files changed, 86 insertions(+), 207 deletions(-) diff --git a/composer.json b/composer.json index f7176c03..fbfc280d 100644 --- a/composer.json +++ b/composer.json @@ -16,8 +16,7 @@ "creativeorange/gravatar": "~1.0", "davejamesmiller/laravel-breadcrumbs": "^5.0", "doctrine/dbal": "^2.9", - "arcanedev/no-captcha": "10.0.0", - "arcanedev/log-viewer": "^5.0", + "arcanedev/log-viewer": "^5.1", "fideloper/proxy": "^4.0", "laravel/framework": "^6.0", "laravel/passport": "^7.3.3", diff --git a/composer.lock b/composer.lock index aba5edab..7ca712e6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,39 +4,40 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a52788c03bc5107176b1d53f0c6860f5", + "content-hash": "13dcf4a023a54a3a3a798e8b73053c78", "packages": [ { "name": "arcanedev/log-viewer", - "version": "5.0.3", + "version": "5.1.4", "source": { "type": "git", "url": "https://github.com/ARCANEDEV/LogViewer.git", - "reference": "fc65898036e606d241236817484e16b8db1ba8fe" + "reference": "560d395293b1d5797443b836b9fa18da872204cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ARCANEDEV/LogViewer/zipball/fc65898036e606d241236817484e16b8db1ba8fe", - "reference": "fc65898036e606d241236817484e16b8db1ba8fe", + "url": "https://api.github.com/repos/ARCANEDEV/LogViewer/zipball/560d395293b1d5797443b836b9fa18da872204cc", + "reference": "560d395293b1d5797443b836b9fa18da872204cc", "shasum": "" }, "require": { - "arcanedev/support": "~5.0.0", + "arcanedev/support": "^5.0", "ext-json": "*", "php": ">=7.2.0", - "psr/log": "~1.0" + "psr/log": "^1.0" }, "require-dev": { - "mockery/mockery": "~1.0", - "orchestra/testbench": "~4.0.0", - "phpunit/phpcov": "~6.0", - "phpunit/phpunit": "~8.0" + "mockery/mockery": "^1.0", + "orchestra/testbench": "^4.0", + "phpunit/phpcov": "^6.0", + "phpunit/phpunit": "^8.0" }, "type": "library", "extra": { "laravel": { "providers": [ - "Arcanedev\\LogViewer\\LogViewerServiceProvider" + "Arcanedev\\LogViewer\\LogViewerServiceProvider", + "Arcanedev\\LogViewer\\Providers\\DeferredServicesProvider" ] } }, @@ -72,150 +73,31 @@ "log-viewer", "logviewer" ], - "time": "2019-09-25T11:07:09+00:00" - }, - { - "name": "arcanedev/no-captcha", - "version": "10.0.0", - "source": { - "type": "git", - "url": "https://github.com/ARCANEDEV/noCAPTCHA.git", - "reference": "2c67130b04af01e6cbc122fc1d0c5804b262a289" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ARCANEDEV/noCAPTCHA/zipball/2c67130b04af01e6cbc122fc1d0c5804b262a289", - "reference": "2c67130b04af01e6cbc122fc1d0c5804b262a289", - "shasum": "" - }, - "require": { - "arcanedev/php-html": "~3.0.0", - "arcanedev/support": "~5.0.0", - "ext-curl": "*", - "ext-json": "*", - "php": ">=7.2.0", - "psr/http-message": "~1.0" - }, - "require-dev": { - "arcanedev/laravel-html": "~6.0.0", - "orchestra/testbench": "~4.0.0", - "phpunit/phpcov": "~6.0", - "phpunit/phpunit": "~8.0" - }, - "type": "library", - "extra": { - "laravel": { - "providers": [ - "Arcanedev\\NoCaptcha\\NoCaptchaServiceProvider" - ] - } - }, - "autoload": { - "psr-4": { - "Arcanedev\\NoCaptcha\\": "src/" - }, - "files": [ - "helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "ARCANEDEV", - "email": "arcanedev.maroc@gmail.com", - "homepage": "https://github.com/arcanedev-maroc", - "role": "Developer" - } - ], - "description": "No CAPTCHA (new Google reCAPTCHA) with Laravel support", - "homepage": "https://github.com/ARCANEDEV/noCAPTCHA", - "keywords": [ - "arcanedev", - "captcha", - "google", - "laravel", - "no-captcha", - "recaptcha" - ], - "time": "2019-09-04T14:03:15+00:00" - }, - { - "name": "arcanedev/php-html", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/ARCANEDEV/php-html.git", - "reference": "eacca0e9ce4946df4ef92009ca25172ef62b4765" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ARCANEDEV/php-html/zipball/eacca0e9ce4946df4ef92009ca25172ef62b4765", - "reference": "eacca0e9ce4946df4ef92009ca25172ef62b4765", - "shasum": "" - }, - "require": { - "illuminate/support": "~6.0", - "php": ">=7.2.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpcov": "~6.0", - "phpunit/phpunit": "~8.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Arcanedev\\Html\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "ARCANEDEV", - "email": "arcanedev.maroc@gmail.com", - "homepage": "https://github.com/arcanedev-maroc", - "role": "Developer" - } - ], - "description": "A simple way to create html tags with php.", - "homepage": "https://github.com/ARCANEDEV/php-html", - "keywords": [ - "arcanedev", - "form", - "html", - "tags" - ], - "time": "2019-09-04T13:13:12+00:00" + "time": "2019-10-03T13:08:24+00:00" }, { "name": "arcanedev/support", - "version": "5.0.0", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/ARCANEDEV/Support.git", - "reference": "cb32ca20be93a24bd2f86bb82263796023c5f761" + "reference": "cf731be18e7d0138223bd8e134f623a9d8c674d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ARCANEDEV/Support/zipball/cb32ca20be93a24bd2f86bb82263796023c5f761", - "reference": "cb32ca20be93a24bd2f86bb82263796023c5f761", + "url": "https://api.github.com/repos/ARCANEDEV/Support/zipball/cf731be18e7d0138223bd8e134f623a9d8c674d7", + "reference": "cf731be18e7d0138223bd8e134f623a9d8c674d7", "shasum": "" }, "require": { - "illuminate/filesystem": "~6.0.0", - "illuminate/support": "~6.0.0", + "illuminate/filesystem": "^6.0", + "illuminate/support": "^6.0", "php": ">=7.2.0" }, "require-dev": { - "orchestra/testbench": "~4.0.0", - "phpunit/phpcov": "~6.0", - "phpunit/phpunit": "~8.0" + "orchestra/testbench": "^4.0", + "phpunit/phpcov": "^6.0", + "phpunit/phpunit": "^8.0" }, "type": "library", "autoload": { @@ -246,7 +128,7 @@ "laravel", "support" ], - "time": "2019-09-04T08:48:36+00:00" + "time": "2019-10-02T18:20:38+00:00" }, { "name": "beyondcode/laravel-self-diagnosis", @@ -1623,16 +1505,16 @@ }, { "name": "laravel/framework", - "version": "v6.0.4", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "372e0add8a58e0e3deb78f87cbb2dc40d3e0ff08" + "reference": "a365bea7ff0dea9a50f5904be9e41656def9af4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/372e0add8a58e0e3deb78f87cbb2dc40d3e0ff08", - "reference": "372e0add8a58e0e3deb78f87cbb2dc40d3e0ff08", + "url": "https://api.github.com/repos/laravel/framework/zipball/a365bea7ff0dea9a50f5904be9e41656def9af4b", + "reference": "a365bea7ff0dea9a50f5904be9e41656def9af4b", "shasum": "" }, "require": { @@ -1728,7 +1610,7 @@ "league/flysystem-sftp": "Required to use the Flysystem SFTP driver (^1.0).", "moontoast/math": "Required to use ordered UUIDs (^1.1).", "pda/pheanstalk": "Required to use the beanstalk queue driver (^4.0).", - "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^3.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^4.0).", "symfony/cache": "Required to PSR-6 cache bridge (^4.3.4).", "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^1.2).", "wildbit/swiftmailer-postmark": "Required to use Postmark mail driver (^3.0)." @@ -1764,7 +1646,7 @@ "framework", "laravel" ], - "time": "2019-09-24T13:40:36+00:00" + "time": "2019-10-01T13:55:56+00:00" }, { "name": "laravel/passport", @@ -1966,28 +1848,28 @@ }, { "name": "laravelcollective/html", - "version": "v6.0.2", + "version": "v6.0.3", "source": { "type": "git", "url": "https://github.com/LaravelCollective/html.git", - "reference": "2f181aba73390eec13d398bf57877b1cc3bc2588" + "reference": "bcc317d21a7e04eebcc81c4109fa84feaab63590" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/LaravelCollective/html/zipball/2f181aba73390eec13d398bf57877b1cc3bc2588", - "reference": "2f181aba73390eec13d398bf57877b1cc3bc2588", + "url": "https://api.github.com/repos/LaravelCollective/html/zipball/bcc317d21a7e04eebcc81c4109fa84feaab63590", + "reference": "bcc317d21a7e04eebcc81c4109fa84feaab63590", "shasum": "" }, "require": { - "illuminate/http": "6.0.*", - "illuminate/routing": "6.0.*", - "illuminate/session": "6.0.*", - "illuminate/support": "6.0.*", - "illuminate/view": "6.0.*", + "illuminate/http": "^6.0", + "illuminate/routing": "^6.0", + "illuminate/session": "^6.0", + "illuminate/support": "^6.0", + "illuminate/view": "^6.0", "php": ">=7.2" }, "require-dev": { - "illuminate/database": "6.0.*", + "illuminate/database": "^6.0", "mockery/mockery": "~1.0", "phpunit/phpunit": "~7.1" }, @@ -2030,7 +1912,7 @@ ], "description": "HTML and Form Builders for the Laravel Framework", "homepage": "https://laravelcollective.com", - "time": "2019-09-23T06:16:50+00:00" + "time": "2019-10-02T00:37:39+00:00" }, { "name": "lcobucci/jwt", @@ -2262,9 +2144,9 @@ "authors": [ { "name": "Ben Corlett", - "role": "Developer", "email": "bencorlett@me.com", - "homepage": "http://www.webcomm.com.au" + "homepage": "http://www.webcomm.com.au", + "role": "Developer" } ], "description": "OAuth 1.0 Client Library", @@ -2444,16 +2326,16 @@ }, { "name": "nesbot/carbon", - "version": "2.24.0", + "version": "2.25.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "934459c5ac0658bc765ad1e53512c7c77adcac29" + "reference": "b70da677101cca7b584c7489770d2677c2733593" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/934459c5ac0658bc765ad1e53512c7c77adcac29", - "reference": "934459c5ac0658bc765ad1e53512c7c77adcac29", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/b70da677101cca7b584c7489770d2677c2733593", + "reference": "b70da677101cca7b584c7489770d2677c2733593", "shasum": "" }, "require": { @@ -2500,14 +2382,14 @@ "homepage": "http://github.com/kylekatarnls" } ], - "description": "A API extension for DateTime that supports 281 different languages.", + "description": "An API extension for DateTime that supports 281 different languages.", "homepage": "http://carbon.nesbot.com", "keywords": [ "date", "datetime", "time" ], - "time": "2019-08-31T16:37:55+00:00" + "time": "2019-09-30T16:22:22+00:00" }, { "name": "nikic/php-parser", @@ -4926,16 +4808,16 @@ }, { "name": "yajra/laravel-datatables-oracle", - "version": "v9.6.1", + "version": "v9.7.0", "source": { "type": "git", "url": "https://github.com/yajra/laravel-datatables.git", - "reference": "42cba7ffae2e7b41981dacf7257c681f00aee1a5" + "reference": "bb6ff7b76bd6253396cb7a5a7b6c51c5ab14b1a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/42cba7ffae2e7b41981dacf7257c681f00aee1a5", - "reference": "42cba7ffae2e7b41981dacf7257c681f00aee1a5", + "url": "https://api.github.com/repos/yajra/laravel-datatables/zipball/bb6ff7b76bd6253396cb7a5a7b6c51c5ab14b1a8", + "reference": "bb6ff7b76bd6253396cb7a5a7b6c51c5ab14b1a8", "shasum": "" }, "require": { @@ -4993,7 +4875,7 @@ "jquery", "laravel" ], - "time": "2019-09-26T08:35:02+00:00" + "time": "2019-10-02T05:58:48+00:00" }, { "name": "zendframework/zend-diactoros", @@ -5284,16 +5166,16 @@ }, { "name": "doctrine/annotations", - "version": "v1.7.0", + "version": "v1.8.0", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "fa4c4e861e809d6a1103bd620cce63ed91aedfeb" + "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/fa4c4e861e809d6a1103bd620cce63ed91aedfeb", - "reference": "fa4c4e861e809d6a1103bd620cce63ed91aedfeb", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/904dca4eb10715b92569fbcd79e201d5c349b6bc", + "reference": "904dca4eb10715b92569fbcd79e201d5c349b6bc", "shasum": "" }, "require": { @@ -5302,7 +5184,7 @@ }, "require-dev": { "doctrine/cache": "1.*", - "phpunit/phpunit": "^7.5@dev" + "phpunit/phpunit": "^7.5" }, "type": "library", "extra": { @@ -5348,7 +5230,7 @@ "docblock", "parser" ], - "time": "2019-08-08T18:11:40+00:00" + "time": "2019-10-01T18:55:10+00:00" }, { "name": "doctrine/instantiator", @@ -5462,16 +5344,16 @@ }, { "name": "facade/ignition", - "version": "1.9.0", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/facade/ignition.git", - "reference": "40461a1f680171876c186dfff419b2a4c892995c" + "reference": "ca7ab4f49230cb57c62fedddc5245f5496b82065" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/facade/ignition/zipball/40461a1f680171876c186dfff419b2a4c892995c", - "reference": "40461a1f680171876c186dfff419b2a4c892995c", + "url": "https://api.github.com/repos/facade/ignition/zipball/ca7ab4f49230cb57c62fedddc5245f5496b82065", + "reference": "ca7ab4f49230cb57c62fedddc5245f5496b82065", "shasum": "" }, "require": { @@ -5529,7 +5411,7 @@ "laravel", "page" ], - "time": "2019-09-27T16:49:08+00:00" + "time": "2019-10-01T17:44:44+00:00" }, { "name": "filp/whoops", @@ -5900,16 +5782,16 @@ }, { "name": "mockery/mockery", - "version": "1.2.3", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "4eff936d83eb809bde2c57a3cea0ee9643769031" + "reference": "b3453f75fd23d9fd41685f2148f4abeacabc6405" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/4eff936d83eb809bde2c57a3cea0ee9643769031", - "reference": "4eff936d83eb809bde2c57a3cea0ee9643769031", + "url": "https://api.github.com/repos/mockery/mockery/zipball/b3453f75fd23d9fd41685f2148f4abeacabc6405", + "reference": "b3453f75fd23d9fd41685f2148f4abeacabc6405", "shasum": "" }, "require": { @@ -5923,7 +5805,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -5961,7 +5843,7 @@ "test double", "testing" ], - "time": "2019-08-07T15:01:07+00:00" + "time": "2019-09-30T08:30:27+00:00" }, { "name": "moontoast/math", @@ -6429,22 +6311,22 @@ }, { "name": "phpspec/prophecy", - "version": "1.8.1", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76" + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/1927e75f4ed19131ec9bcc3b002e07fb1173ee76", - "reference": "1927e75f4ed19131ec9bcc3b002e07fb1173ee76", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", + "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", "sebastian/comparator": "^1.1|^2.0|^3.0", "sebastian/recursion-context": "^1.0|^2.0|^3.0" }, @@ -6488,7 +6370,7 @@ "spy", "stub" ], - "time": "2019-06-13T12:50:23+00:00" + "time": "2019-10-03T11:07:50+00:00" }, { "name": "phpunit/php-code-coverage", @@ -6744,16 +6626,16 @@ }, { "name": "phpunit/phpunit", - "version": "8.3.5", + "version": "8.4.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "302faed7059fde575cf3403a78c730c5e3a62750" + "reference": "57e5e77b62086033528ee1f4063ae03035f57894" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/302faed7059fde575cf3403a78c730c5e3a62750", - "reference": "302faed7059fde575cf3403a78c730c5e3a62750", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/57e5e77b62086033528ee1f4063ae03035f57894", + "reference": "57e5e77b62086033528ee1f4063ae03035f57894", "shasum": "" }, "require": { @@ -6797,7 +6679,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "8.3-dev" + "dev-master": "8.4-dev" } }, "autoload": { @@ -6823,7 +6705,7 @@ "testing", "xunit" ], - "time": "2019-09-14T09:12:03+00:00" + "time": "2019-10-04T03:12:25+00:00" }, { "name": "scrivo/highlight.php", @@ -7812,8 +7694,8 @@ "authors": [ { "name": "Arne Blankerts", - "role": "Developer", - "email": "arne@blankerts.de" + "email": "arne@blankerts.de", + "role": "Developer" } ], "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", diff --git a/config/app.php b/config/app.php index 3a0e4a25..6b47e0ea 100755 --- a/config/app.php +++ b/config/app.php @@ -175,8 +175,6 @@ /* * Package Service Providers... */ - Arcanedev\LogViewer\LogViewerServiceProvider::class, - Arcanedev\NoCaptcha\NoCaptchaServiceProvider::class, Collective\Html\HtmlServiceProvider::class, Creativeorange\Gravatar\GravatarServiceProvider::class, //DaveJamesMiller\Breadcrumbs\ServiceProvider::class, From 6063fe41e76f309a9e68636230c2e88c8bcb46f9 Mon Sep 17 00:00:00 2001 From: Kamlesh Gupta Date: Fri, 4 Oct 2019 15:54:12 +0530 Subject: [PATCH 12/15] Fix the issue of Active feature in laravel 6.0 --- app/Helpers/activeHelpers.php | 38 +++----- app/Providers/ActiveServiceProvider.php | 46 ++-------- app/Services/Active/Active.php | 110 ++++++++---------------- app/Services/Active/Facades/Active.php | 2 +- config/app.php | 3 +- 5 files changed, 59 insertions(+), 140 deletions(-) diff --git a/app/Helpers/activeHelpers.php b/app/Helpers/activeHelpers.php index a55e48a1..0e806b49 100644 --- a/app/Helpers/activeHelpers.php +++ b/app/Helpers/activeHelpers.php @@ -1,8 +1,7 @@ getClassIf($condition, $activeClass, $inactiveClass); } } - if (!function_exists('if_uri')) { /** - * Check if the URI of the current request matches one of the specific URIs. + * Check if the URI of the current request matches one of the specific URIs * * @param array|string $uris * @@ -29,10 +27,9 @@ function if_uri($uris) return app('active')->checkUri($uris); } } - if (!function_exists('if_uri_pattern')) { /** - * Check if the current URI matches one of specific patterns (using `Str::is`). + * Check if the current URI matches one of specific patterns (using `str_is`) * * @param array|string $patterns * @@ -43,14 +40,13 @@ function if_uri_pattern($patterns) return app('active')->checkUriPattern($patterns); } } - if (!function_exists('if_query')) { /** * Check if one of the following condition is true: * + the value of $value is `false` and the current querystring contain the key $key * + the value of $value is not `false` and the current value of the $key key in the querystring equals to $value * + the value of $value is not `false` and the current value of the $key key in the querystring is an array that - * contains the $value. + * contains the $value * * @param string $key * @param mixed $value @@ -62,10 +58,9 @@ function if_query($key, $value) return app('active')->checkQuery($key, $value); } } - if (!function_exists('if_route')) { /** - * Check if the name of the current route matches one of specific values. + * Check if the name of the current route matches one of specific values * * @param array|string $routeNames * @@ -76,10 +71,9 @@ function if_route($routeNames) return app('active')->checkRoute($routeNames); } } - if (!function_exists('if_route_pattern')) { /** - * Check the current route name with one or some patterns. + * Check the current route name with one or some patterns * * @param array|string $patterns * @@ -90,10 +84,9 @@ function if_route_pattern($patterns) return app('active')->checkRoutePattern($patterns); } } - if (!function_exists('if_route_param')) { /** - * Check if the parameter of the current route has the correct value. + * Check if the parameter of the current route has the correct value * * @param $param * @param $value @@ -105,10 +98,9 @@ function if_route_param($param, $value) return app('active')->checkRouteParam($param, $value); } } - if (!function_exists('if_action')) { /** - * Return 'active' class if current route action match one of provided action names. + * Return 'active' class if current route action match one of provided action names * * @param array|string $actions * @@ -119,10 +111,9 @@ function if_action($actions) return app('active')->checkAction($actions); } } - if (!function_exists('if_controller')) { /** - * Check if the current controller class matches one of specific values. + * Check if the current controller class matches one of specific values * * @param array|string $controllers * @@ -133,10 +124,9 @@ function if_controller($controllers) return app('active')->checkController($controllers); } } - if (!function_exists('current_controller')) { /** - * Get the current controller class. + * Get the current controller class * * @return string */ @@ -145,10 +135,9 @@ function current_controller() return app('active')->getController(); } } - if (!function_exists('current_method')) { /** - * Get the current controller method. + * Get the current controller method * * @return string */ @@ -157,10 +146,9 @@ function current_method() return app('active')->getMethod(); } } - if (!function_exists('current_action')) { /** - * Get the current action string. + * Get the current action string * * @return string */ @@ -168,4 +156,4 @@ function current_action() { return app('active')->getAction(); } -} +} \ No newline at end of file diff --git a/app/Providers/ActiveServiceProvider.php b/app/Providers/ActiveServiceProvider.php index 952d0713..3169b57d 100644 --- a/app/Providers/ActiveServiceProvider.php +++ b/app/Providers/ActiveServiceProvider.php @@ -20,7 +20,7 @@ class ActiveServiceProvider extends ServiceProvider public function boot() { // Update the instances each time a request is resolved and a route is matched - $instance = new Active(request()); + $instance = app('active'); if (version_compare(Application::VERSION, '5.2.0', '>=')) { app('router')->matched( @@ -44,42 +44,12 @@ function ($route, $request) use ($instance) { */ public function register() { - $this->registerActive(); - $this->registerFacade(); - - // $this->app->singleton( - // 'active', - // function ($app) { - - // $instance = new Active($app['router']->getCurrentRequest()); - - // return $instance; - // } - // ); - } - - /** - * Register the application bindings. - * - * @return void - */ - private function registerActive() - { - $this->app->bind('active', function ($app) { - return new Active($app['router']->getCurrentRequest()); - }); - } - - /** - * Register the vault facade without the user having to add it to the app.php file. - * - * @return void - */ - public function registerFacade() - { - $this->app->booting(function () { - $loader = \Illuminate\Foundation\AliasLoader::getInstance(); - $loader->alias('Active', \App\Services\Access\Facades\Active::class); - }); + $this->app->singleton( + 'active', + function ($app) { + $instance = new Active($app['router']->getCurrentRequest()); + return $instance; + } + ); } } diff --git a/app/Services/Active/Active.php b/app/Services/Active/Active.php index 3ae3c224..1c3cb2a2 100644 --- a/app/Services/Active/Active.php +++ b/app/Services/Active/Active.php @@ -2,13 +2,12 @@ namespace App\Services\Active; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Routing\Route; -use Illuminate\Support\Str; - +use Illuminate\Database\Eloquent\Model; /** - * Return "active" class for the current route if needed. + * Return "active" class for the current route if needed * * Check the current route to decide whether return an "active" class base on: *
      @@ -18,54 +17,49 @@ *
    • current controller
    • *
    * + * @package HieuLe\Active * @author Hieu Le - * * @version 3.2.0 + * */ class Active { /** - * Current request. + * Current request * * @var Request */ protected $request; - /** - * Current matched route. + * Current matched route * * @var Route */ protected $route; - /** - * Current action string. + * Current action string * * @var string */ protected $action; - /** - * Current controller class. + * Current controller class * * @var string */ protected $controller; - /** - * Current controller method. + * Current controller method * * @var string */ protected $method; - /** - * Current URI. + * Current URI * * @var string */ protected $uri; - /** * Active constructor. * @@ -75,9 +69,8 @@ public function __construct($request) { $this->updateInstances(null, $request); } - /** - * Update the route and request instances. + * Update the route and request instances * * @param Route $route * @param Request $request @@ -88,19 +81,16 @@ public function updateInstances($route, $request) if ($request) { $this->uri = urldecode($request->path()); } - $this->route = $route; if ($route) { $this->action = $route->getActionName(); - $actionSegments = Str::parseCallback($this->action, null); $this->controller = head($actionSegments); $this->method = last($actionSegments); } } - /** - * Get the active class if the condition is not falsy. + * Get the active class if the condition is not falsy * * @param $condition * @param string $activeClass @@ -112,9 +102,8 @@ public function getClassIf($condition, $activeClass = 'active', $inactiveClass = { return $condition ? $activeClass : $inactiveClass; } - /** - * Check if the URI of the current request matches one of the specific URIs. + * Check if the URI of the current request matches one of the specific URIs * * @param array|string $uris * @@ -125,18 +114,15 @@ public function checkUri($uris) if (!$this->request) { return false; } - - foreach ((array) $uris as $uri) { + foreach ((array)$uris as $uri) { if ($this->uri == $uri) { return true; } } - return false; } - /** - * Check if the current URI matches one of specific patterns (using `Str::is`). + * Check if the current URI matches one of specific patterns (using `Str::is`) * * @param array|string $patterns * @@ -147,22 +133,19 @@ public function checkUriPattern($patterns) if (!$this->request) { return false; } - - foreach ((array) $patterns as $p) { + foreach ((array)$patterns as $p) { if (Str::is($p, $this->uri)) { return true; } } - return false; } - /** * Check if one of the following condition is true: * + the value of $value is `false` and the current querystring contain the key $key * + the value of $value is not `false` and the current value of the $key key in the querystring equals to $value * + the value of $value is not `false` and the current value of the $key key in the querystring is an array that - * contains the $value. + * contains the $value * * @param string $key * @param mixed $value @@ -174,23 +157,21 @@ public function checkQuery($key, $value) if (!$this->request) { return false; } - $queryValue = $this->request->query($key); - // if the `key` exists in the query string with the correct value // OR it exists with any value // OR its value is an array that contains the specific value - if (($queryValue == $value) || ($queryValue !== null && $value === false) || (is_array($queryValue) && in_array($value, - $queryValue)) + if (($queryValue == $value) || ($queryValue !== null && $value === false) || (is_array($queryValue) && in_array( + $value, + $queryValue + )) ) { return true; } - return false; } - /** - * Check if the name of the current route matches one of specific values. + * Check if the name of the current route matches one of specific values * * @param array|string $routeNames * @@ -201,18 +182,14 @@ public function checkRoute($routeNames) if (!$this->route) { return false; } - $routeName = $this->route->getName(); - - if (in_array($routeName, (array) $routeNames)) { + if (in_array($routeName, (array)$routeNames)) { return true; } - return false; } - /** - * Check the current route name with one or some patterns. + * Check the current route name with one or some patterns * * @param array|string $patterns * @@ -223,24 +200,19 @@ public function checkRoutePattern($patterns) if (!$this->route) { return false; } - $routeName = $this->route->getName(); - if ($routeName == null) { return in_array(null, $patterns); } - - foreach ((array) $patterns as $p) { + foreach ((array)$patterns as $p) { if (Str::is($p, $routeName)) { return true; } } - return false; } - /** - * Check if the parameter of the current route has the correct value. + * Check if the parameter of the current route has the correct value * * @param $param * @param $value @@ -252,20 +224,16 @@ public function checkRouteParam($param, $value) if (!$this->route) { return false; } - $paramValue = $this->route->parameter($param); - // If the parameter value is an instance of Model class, we compare $value with the value of // its primary key. if (is_a($paramValue, Model::class)) { return $paramValue->{$paramValue->getKeyName()} == $value; } - return $paramValue == $value; } - /** - * Return 'active' class if current route action match one of provided action names. + * Return 'active' class if current route action match one of provided action names * * @param array|string $actions * @@ -276,16 +244,13 @@ public function checkAction($actions) if (!$this->action) { return false; } - - if (in_array($this->action, (array) $actions)) { + if (in_array($this->action, (array)$actions)) { return true; } - return false; } - /** - * Check if the current controller class matches one of specific values. + * Check if the current controller class matches one of specific values * * @param array|string $controllers * @@ -296,16 +261,13 @@ public function checkController($controllers) if (!$this->controller) { return false; } - - if (in_array($this->controller, (array) $controllers)) { + if (in_array($this->controller, (array)$controllers)) { return true; } - return false; } - /** - * Get the current controller method. + * Get the current controller method * * @return string */ @@ -313,9 +275,8 @@ public function getMethod() { return $this->method ?: ''; } - /** - * Get the current action string. + * Get the current action string * * @return string */ @@ -323,9 +284,8 @@ public function getAction() { return $this->action ?: ''; } - /** - * Get the current controller class. + * Get the current controller class * * @return string */ @@ -333,4 +293,4 @@ public function getController() { return $this->controller ?: ''; } -} +} \ No newline at end of file diff --git a/app/Services/Active/Facades/Active.php b/app/Services/Active/Facades/Active.php index 25ee2bb1..27370f6c 100644 --- a/app/Services/Active/Facades/Active.php +++ b/app/Services/Active/Facades/Active.php @@ -1,6 +1,6 @@ App\Services\Active\Facades\Active::class, 'Breadcrumbs' => DaveJamesMiller\Breadcrumbs\Facade::class, 'Captcha' => Arcanedev\NoCaptcha\Facades\NoCaptcha::class, 'Form' => Collective\Html\FormFacade::class, 'Gravatar' => Creativeorange\Gravatar\Facades\Gravatar::class, 'Html' => Collective\Html\HtmlFacade::class, 'Socialite' => Laravel\Socialite\Facades\Socialite::class, - //'Datatables' => Yajra\DataTables\Facades\DataTables::class + //'Datatables' => Yajra\DataTables\Facades\DataTables::class, ], ]; From 19e620ca957657d8df3cd18877586d0c325c6ac0 Mon Sep 17 00:00:00 2001 From: Kamlesh Gupta Date: Fri, 4 Oct 2019 16:09:19 +0530 Subject: [PATCH 13/15] Fix the issue style CI --- app/Helpers/activeHelpers.php | 18 ++++---- app/Providers/ActiveServiceProvider.php | 1 + app/Services/Active/Active.php | 55 +++++++++++++------------ 3 files changed, 39 insertions(+), 35 deletions(-) diff --git a/app/Helpers/activeHelpers.php b/app/Helpers/activeHelpers.php index 0e806b49..1da8e615 100644 --- a/app/Helpers/activeHelpers.php +++ b/app/Helpers/activeHelpers.php @@ -1,7 +1,7 @@ getCurrentRequest()); + return $instance; } ); diff --git a/app/Services/Active/Active.php b/app/Services/Active/Active.php index 1c3cb2a2..6f0ed08b 100644 --- a/app/Services/Active/Active.php +++ b/app/Services/Active/Active.php @@ -2,12 +2,13 @@ namespace App\Services\Active; -use Illuminate\Support\Str; +use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; use Illuminate\Routing\Route; -use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Str; + /** - * Return "active" class for the current route if needed + * Return "active" class for the current route if needed. * * Check the current route to decide whether return an "active" class base on: *
      @@ -17,45 +18,45 @@ *
    • current controller
    • *
    * - * @package HieuLe\Active * @author Hieu Le + * * @version 3.2.0 * */ class Active { /** - * Current request + * Current request. * * @var Request */ protected $request; /** - * Current matched route + * Current matched route. * * @var Route */ protected $route; /** - * Current action string + * Current action string. * * @var string */ protected $action; /** - * Current controller class + * Current controller class. * * @var string */ protected $controller; /** - * Current controller method + * Current controller method. * * @var string */ protected $method; /** - * Current URI + * Current URI. * * @var string */ @@ -70,7 +71,7 @@ public function __construct($request) $this->updateInstances(null, $request); } /** - * Update the route and request instances + * Update the route and request instances. * * @param Route $route * @param Request $request @@ -90,7 +91,7 @@ public function updateInstances($route, $request) } } /** - * Get the active class if the condition is not falsy + * Get the active class if the condition is not falsy. * * @param $condition * @param string $activeClass @@ -103,7 +104,7 @@ public function getClassIf($condition, $activeClass = 'active', $inactiveClass = return $condition ? $activeClass : $inactiveClass; } /** - * Check if the URI of the current request matches one of the specific URIs + * Check if the URI of the current request matches one of the specific URIs. * * @param array|string $uris * @@ -122,7 +123,7 @@ public function checkUri($uris) return false; } /** - * Check if the current URI matches one of specific patterns (using `Str::is`) + * Check if the current URI matches one of specific patterns (using `Str::is`). * * @param array|string $patterns * @@ -133,19 +134,21 @@ public function checkUriPattern($patterns) if (!$this->request) { return false; } - foreach ((array)$patterns as $p) { + foreach ((array) $patterns as $p) { if (Str::is($p, $this->uri)) { return true; } } + return false; } + /** * Check if one of the following condition is true: * + the value of $value is `false` and the current querystring contain the key $key * + the value of $value is not `false` and the current value of the $key key in the querystring equals to $value * + the value of $value is not `false` and the current value of the $key key in the querystring is an array that - * contains the $value + * contains the $value. * * @param string $key * @param mixed $value @@ -171,7 +174,7 @@ public function checkQuery($key, $value) return false; } /** - * Check if the name of the current route matches one of specific values + * Check if the name of the current route matches one of specific values. * * @param array|string $routeNames * @@ -183,13 +186,13 @@ public function checkRoute($routeNames) return false; } $routeName = $this->route->getName(); - if (in_array($routeName, (array)$routeNames)) { + if (in_array($routeName, (array) $routeNames)) { return true; } return false; } /** - * Check the current route name with one or some patterns + * Check the current route name with one or some patterns. * * @param array|string $patterns * @@ -204,7 +207,7 @@ public function checkRoutePattern($patterns) if ($routeName == null) { return in_array(null, $patterns); } - foreach ((array)$patterns as $p) { + foreach ((array) $patterns as $p) { if (Str::is($p, $routeName)) { return true; } @@ -212,7 +215,7 @@ public function checkRoutePattern($patterns) return false; } /** - * Check if the parameter of the current route has the correct value + * Check if the parameter of the current route has the correct value. * * @param $param * @param $value @@ -233,7 +236,7 @@ public function checkRouteParam($param, $value) return $paramValue == $value; } /** - * Return 'active' class if current route action match one of provided action names + * Return 'active' class if current route action match one of provided action names. * * @param array|string $actions * @@ -250,7 +253,7 @@ public function checkAction($actions) return false; } /** - * Check if the current controller class matches one of specific values + * Check if the current controller class matches one of specific values. * * @param array|string $controllers * @@ -267,7 +270,7 @@ public function checkController($controllers) return false; } /** - * Get the current controller method + * Get the current controller method. * * @return string */ @@ -276,7 +279,7 @@ public function getMethod() return $this->method ?: ''; } /** - * Get the current action string + * Get the current action string. * * @return string */ @@ -285,7 +288,7 @@ public function getAction() return $this->action ?: ''; } /** - * Get the current controller class + * Get the current controller class. * * @return string */ From 27159dd468072c46e8c772f5030d84ff3e401c8d Mon Sep 17 00:00:00 2001 From: Viral Solani Date: Fri, 4 Oct 2019 11:39:23 +0000 Subject: [PATCH 14/15] Apply fixes from StyleCI --- app/Helpers/activeHelpers.php | 9 +++++---- app/Services/Active/Active.php | 29 ++++++++++++++++++++++++----- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/app/Helpers/activeHelpers.php b/app/Helpers/activeHelpers.php index 1da8e615..b6df362e 100644 --- a/app/Helpers/activeHelpers.php +++ b/app/Helpers/activeHelpers.php @@ -1,4 +1,5 @@ getAction(); } -} \ No newline at end of file +} diff --git a/app/Services/Active/Active.php b/app/Services/Active/Active.php index 6f0ed08b..fbf580a1 100644 --- a/app/Services/Active/Active.php +++ b/app/Services/Active/Active.php @@ -21,7 +21,6 @@ * @author Hieu Le * * @version 3.2.0 - * */ class Active { @@ -61,6 +60,7 @@ class Active * @var string */ protected $uri; + /** * Active constructor. * @@ -70,6 +70,7 @@ public function __construct($request) { $this->updateInstances(null, $request); } + /** * Update the route and request instances. * @@ -90,6 +91,7 @@ public function updateInstances($route, $request) $this->method = last($actionSegments); } } + /** * Get the active class if the condition is not falsy. * @@ -103,6 +105,7 @@ public function getClassIf($condition, $activeClass = 'active', $inactiveClass = { return $condition ? $activeClass : $inactiveClass; } + /** * Check if the URI of the current request matches one of the specific URIs. * @@ -115,13 +118,15 @@ public function checkUri($uris) if (!$this->request) { return false; } - foreach ((array)$uris as $uri) { + foreach ((array) $uris as $uri) { if ($this->uri == $uri) { return true; } } + return false; } + /** * Check if the current URI matches one of specific patterns (using `Str::is`). * @@ -171,8 +176,10 @@ public function checkQuery($key, $value) ) { return true; } + return false; } + /** * Check if the name of the current route matches one of specific values. * @@ -189,8 +196,10 @@ public function checkRoute($routeNames) if (in_array($routeName, (array) $routeNames)) { return true; } + return false; } + /** * Check the current route name with one or some patterns. * @@ -212,8 +221,10 @@ public function checkRoutePattern($patterns) return true; } } + return false; } + /** * Check if the parameter of the current route has the correct value. * @@ -233,8 +244,10 @@ public function checkRouteParam($param, $value) if (is_a($paramValue, Model::class)) { return $paramValue->{$paramValue->getKeyName()} == $value; } + return $paramValue == $value; } + /** * Return 'active' class if current route action match one of provided action names. * @@ -247,11 +260,13 @@ public function checkAction($actions) if (!$this->action) { return false; } - if (in_array($this->action, (array)$actions)) { + if (in_array($this->action, (array) $actions)) { return true; } + return false; } + /** * Check if the current controller class matches one of specific values. * @@ -264,11 +279,13 @@ public function checkController($controllers) if (!$this->controller) { return false; } - if (in_array($this->controller, (array)$controllers)) { + if (in_array($this->controller, (array) $controllers)) { return true; } + return false; } + /** * Get the current controller method. * @@ -278,6 +295,7 @@ public function getMethod() { return $this->method ?: ''; } + /** * Get the current action string. * @@ -287,6 +305,7 @@ public function getAction() { return $this->action ?: ''; } + /** * Get the current controller class. * @@ -296,4 +315,4 @@ public function getController() { return $this->controller ?: ''; } -} \ No newline at end of file +} From 85b924c19357549553a4f288c37eaa44126a3b54 Mon Sep 17 00:00:00 2001 From: Kamlesh Gupta Date: Wed, 9 Oct 2019 15:25:36 +0530 Subject: [PATCH 15/15] Added the notification request file for notification controller --- .../Notification/MarkNotificationRequest.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/Http/Requests/Backend/Notification/MarkNotificationRequest.php diff --git a/app/Http/Requests/Backend/Notification/MarkNotificationRequest.php b/app/Http/Requests/Backend/Notification/MarkNotificationRequest.php new file mode 100644 index 00000000..1c59fcea --- /dev/null +++ b/app/Http/Requests/Backend/Notification/MarkNotificationRequest.php @@ -0,0 +1,32 @@ +