/** * Execute the console command. * * @return mixed */ public function handle() { $staff = Staff::all(); $staff->each(function ($staffer) { $has_image = asset_exists($staffer->image_path) ? 1 : 0; if ($staffer->has_image != $has_image) { $staffer->has_image = $has_image; $staffer->save(); } }); }
private function getEightBit() { $cache_key = 'staff_8bit_3'; $staff_8bit = Cache::remember($cache_key, 0, function () { $staff = Staff::select('slug')->get(); $result = $staff->filter(function ($item) { return asset_exists($item->{"EightBitPath"}); }); return $result; }); return $staff_8bit; }
function cdn_image($display_width, $image_width, $image_path, $format = null) { // Not a local image. Return if ('images/' !== substr($image_path, 0, 7)) { return $image_path; } $image_path_parts = parse_url($image_path); $image_path = $image_path_parts['path']; $url_params = empty($image_path_parts['query']) ? [] : explode('&', $image_path_parts['query']); if ($format !== null) { $format_suffix = '-' . $format . '.${3}'; $image_path = preg_replace('/(-(square|tall|wide))?\\.(jpg|png)$/', $format_suffix, $image_path_parts['path']); } $v = asset_exists($image_path) ? filemtime(asset_path($image_path)) : 'not-found'; array_unshift($url_params, 'v=' . $v); $img_url = config('site.cdn_url') . '/' . $display_width . '/' . $image_width . '/' . $image_path . (count($url_params) ? '?' . implode('&', $url_params) : ''); return $img_url; }
public function getImageAttribute() { $img = 'images/missions/local/' . $this->slug . '-tall.png'; $img = empty($this->getOriginal('image')) ? $img : $this->getOriginal('image'); return asset_exists($img) ? $img : null; }
public function getImageAttribute() { $img = 'images/missions/missionaries/' . $this->slug . '-square.jpg'; return asset_exists($img) ? $img : 'https://randomuser.me/api/portraits/lego/' . rand(0, 9) . '.jpg'; }
| ------------------------------------------------------------------- | Set Page Title | ------------------------------------------------------------------- */ echo '<title>' . $title . '</title>'; /* | ------------------------------------------------------------------- | Embed Meta Tags | ------------------------------------------------------------------- */ echo meta(array_merge(array(array('name' => 'Content-type', 'content' => 'text/html; charset=utf-8', 'type' => 'equiv'), array('name' => 'X-UA-Compatible', 'content' => 'IE=edge,chrome=1', 'type' => 'equiv'), array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1')), $meta)); /* | ------------------------------------------------------------------- | Fav Icon | ------------------------------------------------------------------- */ if (asset_exists('img/application/favicon.png')) { echo link_tag(asset('img/application/favicon.png'), 'shortcut icon', 'image/png'); } /* | ------------------------------------------------------------------- | Load Stylesheets | ------------------------------------------------------------------- */ echo css($css); /* | ------------------------------------------------------------------- | Load Javascript | ------------------------------------------------------------------- */ echo js($js);