本文整理匯總了PHP中Illuminate\Support\Facades\Storage::lastModified方法的典型用法代碼示例。如果您正苦於以下問題:PHP Storage::lastModified方法的具體用法?PHP Storage::lastModified怎麽用?PHP Storage::lastModified使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Support\Facades\Storage
的用法示例。
在下文中一共展示了Storage::lastModified方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: membersMapNorway
/**
* Norwegian map with municipalities where Alternativet is represented highlighted
*/
public function membersMapNorway()
{
$data = "";
if (!Storage::exists('members-norway-map.svg') || Storage::lastModified('members-norway-map.svg') <= time() - 60 * 60 * 24) {
$svg = simplexml_load_file(base_path() . '/resources/svg/Norway_municipalities_2012_blank.svg');
// Determine which municipalities there are members in
$result = DB::select(DB::raw("\n select postal_areas.municipality_code, count(*) as count\n from users\n left join postal_areas\n on (users.postal_code = postal_areas.postal_code)\n group by municipality_code"));
$municipalities = [];
foreach ($result as $row) {
if ($row->municipality_code) {
$municipalities[] = $row->municipality_code;
}
}
foreach ($svg->g as $county) {
foreach ($county->path as $path) {
if (in_array($path['id'], $municipalities)) {
// There are members in this municipality
$path['style'] = 'fill:#0f0;fill-opacity:1;stroke:none';
} else {
$path['style'] = 'fill:#777;fill-opacity:1;stroke:none';
}
}
}
$data = $svg->asXML();
Storage::put('members-norway-map.svg', $data);
}
if (empty($data)) {
$data = Storage::get('members-norway-map.svg');
}
return response($data)->header('Content-Type', 'image/svg+xml');
}