本文整理汇总了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');
}