Skip to content

Commit

Permalink
Merge pull request #24 from pratiksh404/analysis-bQnGPw
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
pratiksh404 authored Nov 21, 2021
2 parents 49a1277 + 207630e commit 2ea2f83
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
54 changes: 27 additions & 27 deletions src/Helpers/AdminHelper.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

if (!function_exists('getClassesList')) {
if (! function_exists('getClassesList')) {
function getClassesList($dir)
{
$classes = \File::allFiles($dir);
Expand All @@ -15,7 +15,7 @@ function getClassesList($dir)
return $classes;
}
}
if (!function_exists('getAllModelNames')) {
if (! function_exists('getAllModelNames')) {
function getAllModelNames($dir)
{
$modelNames = [];
Expand All @@ -29,99 +29,99 @@ function getAllModelNames($dir)
}
}

if (!function_exists('validImageFolder')) {
if (! function_exists('validImageFolder')) {
function validImageFolder($name, $default = 'default')
{
return strtolower(str_replace([' ', '-', '$', '<', '>', '&', '{', '}', '*', '\\', '/', ':', '.', ';', ',', "'", '"'], '_', $name ?? trim($default)));
}
}

if (!function_exists('getImagePlaceholder')) {
if (! function_exists('getImagePlaceholder')) {
function getImagePlaceholder()
{
return asset('adminetic/static/placeholder.png');
}
}

if (!function_exists('getVerticalImagePlaceholder')) {
if (! function_exists('getVerticalImagePlaceholder')) {
function getVerticalImagePlaceholder()
{
return asset('adminetic/static/vertical_placeholder.jpg');
}
}

if (!function_exists('getSliderPlaceholder')) {
if (! function_exists('getSliderPlaceholder')) {
function getSliderPlaceholder()
{
return asset('adminetic/static/slider.jpg');
}
}

if (!function_exists('getFoodImagePlaceholder')) {
if (! function_exists('getFoodImagePlaceholder')) {
function getFoodImagePlaceholder()
{
return asset('adminetic/static/food_placeholder.jpg');
}
}

if (!function_exists('getProfilePlaceholder')) {
if (! function_exists('getProfilePlaceholder')) {
function getProfilePlaceholder($p = null)
{
$profile = $p ?? Auth::user()->profile;

return isset($profile->profile_pic) ? (Illuminate\Support\Str::contains($profile->profile_pic, ['https://', 'http://']) ? $profile->profile_pic : asset('storage/' . $profile->profile_pic)) : asset('adminetic/static/profile.jpg');
return isset($profile->profile_pic) ? (Illuminate\Support\Str::contains($profile->profile_pic, ['https://', 'http://']) ? $profile->profile_pic : asset('storage/'.$profile->profile_pic)) : asset('adminetic/static/profile.jpg');
}
}

if (!function_exists('getFavicon')) {
if (! function_exists('getFavicon')) {
function getFavicon()
{
return setting('favicon') ? (asset('storage/' . setting('favicon'))) : asset('adminetic/static/favicon.png');
return setting('favicon') ? (asset('storage/'.setting('favicon'))) : asset('adminetic/static/favicon.png');
}
}
if (!function_exists('getLogo')) {
if (! function_exists('getLogo')) {
function getLogo()
{
return setting('logo') ? (asset('storage/' . setting('logo'))) : asset('adminetic/static/logo.png');
return setting('logo') ? (asset('storage/'.setting('logo'))) : asset('adminetic/static/logo.png');
}
}

if (!function_exists('getLogoBanner')) {
if (! function_exists('getLogoBanner')) {
function getLogoBanner()
{
return setting('logo_banner') ? (asset('storage/' . setting('logo_banner'))) : asset('adminetic/static/logo_banner.jpg');
return setting('logo_banner') ? (asset('storage/'.setting('logo_banner'))) : asset('adminetic/static/logo_banner.jpg');
}
}

if (!function_exists('login_register_bg_image')) {
if (! function_exists('login_register_bg_image')) {
function login_register_bg_image()
{
return setting('login_register_bg_image') ? (asset('storage/' . setting('login_register_bg_image'))) : asset('adminetic/static/login_register_bg_img.jpg');
return setting('login_register_bg_image') ? (asset('storage/'.setting('login_register_bg_image'))) : asset('adminetic/static/login_register_bg_img.jpg');
}
}

if (!function_exists('getLazyLoadImg')) {
if (! function_exists('getLazyLoadImg')) {
function getLazyLoadImg()
{
return asset('adminetic/static/loader.svg');
}
}

if (!function_exists('random_color_part')) {
if (! function_exists('random_color_part')) {
function random_color_part()
{
return str_pad(dechex(mt_rand(0, 255)), 2, '0', STR_PAD_LEFT);
}
}

if (!function_exists('random_color')) {
if (! function_exists('random_color')) {
function random_color()
{
return random_color_part() . random_color_part() . random_color_part();
return random_color_part().random_color_part().random_color_part();
}
}

if (!function_exists('setting')) {
if (! function_exists('setting')) {
function setting($setting_name, $default = null)
{
$valid_setting_name = strtolower(str_replace(' ', '_', $setting_name));
Expand All @@ -131,7 +131,7 @@ function setting($setting_name, $default = null)
}
}

if (!function_exists('preference')) {
if (! function_exists('preference')) {
function preference($preference_name, bool $default = null)
{
$valid_preference_name = strtolower(str_replace(' ', '_', $preference_name));
Expand All @@ -145,18 +145,18 @@ function preference($preference_name, bool $default = null)
}
}

if (!function_exists('deleteImage')) {
if (! function_exists('deleteImage')) {
function deleteImage($image)
{
$image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/' . $image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/' . $image)) : '') : '';
$image ? (\Illuminate\Support\Facades\File::exists(public_path('storage/'.$image)) ? \Illuminate\Support\Facades\File::delete(public_path('storage/'.$image)) : '') : '';
}
}

if (!function_exists('getCondition')) {
if (! function_exists('getCondition')) {
function getCondition($conditions)
{
$result = null;
if (!isset($conditions)) {
if (! isset($conditions)) {
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Services/Adminetic.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@ private function indexCreateChildren($route, $class)
$children = [
[
'type' => 'submenu',
'name' => 'All ' . $plural,
'is_active' => request()->routeIs($route . '.index') ? 'active' : '',
'name' => 'All '.$plural,
'is_active' => request()->routeIs($route.'.index') ? 'active' : '',
'link' => adminRedirectRoute($route),
'conditions' => [
[
Expand All @@ -516,8 +516,8 @@ private function indexCreateChildren($route, $class)
],
[
'type' => 'submenu',
'name' => 'Create ' . $route,
'is_active' => request()->routeIs($route . '.create') ? 'active' : '',
'name' => 'Create '.$route,
'is_active' => request()->routeIs($route.'.create') ? 'active' : '',
'link' => adminCreateRoute($route),
'conditions' => [
[
Expand Down

0 comments on commit 2ea2f83

Please sign in to comment.