Skip to content

Commit

Permalink
Merge pull request #35 from pratiksh404/analysis-KZnyZQ
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
pratiksh404 authored Apr 3, 2022
2 parents 1384153 + de04399 commit 0791555
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 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,121 +29,121 @@ 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 ?? Auth::user()->profile()->create();

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('title')) {
if (! function_exists('title')) {
function title()
{
return setting('title', config('adminetic.name', 'Adminetic'));
}
}

if (!function_exists('loader_enabled')) {
if (! function_exists('loader_enabled')) {
function loader_enabled()
{
return setting('loader_enabled', config('adminetic.loader_enabled', true));
}
}

if (!function_exists('favicon')) {
if (! function_exists('favicon')) {
function favicon()
{
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('logo')) {
if (! function_exists('logo')) {
function logo()
{
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('dark_logo')) {
if (! function_exists('dark_logo')) {
function dark_logo()
{
return setting('dark_logo') ? (asset('storage/' . setting('dark_logo'))) : asset('adminetic/static/logo_dark.png');
return setting('dark_logo') ? (asset('storage/'.setting('dark_logo'))) : asset('adminetic/static/logo_dark.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 @@ -153,7 +153,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 @@ -167,25 +167,25 @@ 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('darkMode')) {
if (! function_exists('darkMode')) {
function darkMode()
{
return setting('dark_mode', config('adminetic.dark_mode', false));
}
}

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

Expand Down

0 comments on commit 0791555

Please sign in to comment.