/** * Presenter helper method for Article main image URL * and will return a default image URL if main image unavailable. * @return string */ public function mainImageUrlOrDefault($type = 'maze') { return @$this->images()->where('main_image', true)->first()->image_url ?: imageUrl($type); }
function letterUrl($url = '') { return imageUrl() . 'letters/' . $url; }
/** * Get Admin Asset Path */ function adminAssetPath($file = null, $type = "path", $url = true) { // Get Assets Folder $assets_folder = app("laravel-admin")->getConfig("assets_folder"); if ($assets_folder) { $assets_folder .= "/"; } // Path $path = null; // Find Paths switch (strtolower($type)) { case 'css': $path = $url ? cssUrl($assets_folder . $file) : cssPath($assets_folder . $file); break; case 'js': $path = $url ? jsUrl($assets_folder . $file) : jsPath($assets_folder . $file); break; case 'image': $path = $url ? imageUrl($assets_folder . $file) : imagePath($assets_folder . $file); break; case 'path': $path = $url ? assetsPath($assets_folder) : assetsPath($assets_folder); break; } // Return return $path; }