Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions app/Console/Commands/InstallAppCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down Expand Up @@ -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'));
Expand All @@ -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.');
}

Expand All @@ -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!');
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
42 changes: 21 additions & 21 deletions app/Helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
*
Expand All @@ -49,7 +49,7 @@ function app_name()
}
}

if (! function_exists('access')) {
if (!function_exists('access')) {
/**
* Access (lol) the Access:: facade as a simple function.
*/
Expand All @@ -59,7 +59,7 @@ function access()
}
}

if (! function_exists('history')) {
if (!function_exists('history')) {
/**
* Access the history facade anywhere.
*/
Expand All @@ -69,7 +69,7 @@ function history()
}
}

if (! function_exists('gravatar')) {
if (!function_exists('gravatar')) {
/**
* Access the gravatar helper.
*/
Expand All @@ -79,7 +79,7 @@ function gravatar()
}
}

if (! function_exists('includeRouteFiles')) {
if (!function_exists('includeRouteFiles')) {

/**
* Loops through a folder and requires all PHP files
Expand Down Expand Up @@ -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
Expand All @@ -129,21 +129,21 @@ function getRtlCss($path)
}
}

if (! function_exists('settings')) {
if (!function_exists('settings')) {
/**
* Access the settings helper.
*/
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.
*
Expand All @@ -165,7 +165,7 @@ function createNotification($message, $userId)
}
}

if (! function_exists('escapeSlashes')) {
if (!function_exists('escapeSlashes')) {
/**
* Access the escapeSlashes helper.
*/
Expand All @@ -179,34 +179,34 @@ function escapeSlashes($path)
}
}

if (! function_exists('getMenuItems')) {
if (!function_exists('getMenuItems')) {
/**
* Converts items (json string) to array and return array.
*/
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);
}

return [];
}
}

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);
Expand All @@ -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.
*/
Expand All @@ -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'));
}
Expand All @@ -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.
*/
Expand All @@ -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) {
Expand All @@ -275,7 +275,7 @@ function isActiveMenuItem($item, $separator = '?')
}
}

if (! function_exists('checkDatabaseConnection')) {
if (!function_exists('checkDatabaseConnection')) {

/**
* @return bool
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/V1/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/V1/ForgotPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/V1/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
]);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Api/V1/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Backend/Search/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/Frontend/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function redirectPath()
*/
public function showResetForm($token = null)
{
if (! $token) {
if (!$token) {
return redirect()->route('frontend.auth.password.email');
}

Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Frontend/Auth/SocialLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}

Expand All @@ -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);
}

Expand All @@ -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'));
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/RouteNeedsPermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/RouteNeedsRole.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Middleware/SessionTimeout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Responses/ViewResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading