ごめん
このコミットが含まれているのは:
コミット
e1a6fcbd63
|
@ -43,71 +43,52 @@ class MeetingsController extends Controller {
|
|||
|
||||
// ミームタイプ
|
||||
//// 画像
|
||||
foreach ($r->image as $img) {
|
||||
if (substr($img, -5) == '.jpeg' || substr($img, -4) == '.jpg' || substr($img, -4) == '.png' || substr($img, -4) == '.gif') {
|
||||
Validator::extend('image_meme', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
$ok = true;
|
||||
foreach (json_decode($value) as $v) {
|
||||
if (
|
||||
substr($value, -5) == '.jpeg' && // jpeg
|
||||
substr($value, -4) == '.jpg' && // jpg
|
||||
substr($value, -4) == '.png' && // png
|
||||
substr($value, -4) == '.gif' // gif
|
||||
) {
|
||||
$ok = false;
|
||||
}
|
||||
Validator::extend('image_meme', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
$ok = true;
|
||||
foreach (json_decode($value) as $v) {
|
||||
if (substr($v, -5) == '.jpeg' || substr($v, -4) == '.jpg' || substr($v, -4) == '.png' || substr($v, -4) == '.gif') {
|
||||
if (
|
||||
substr($v, -5) == '.jpeg' && // jpeg
|
||||
substr($v, -4) == '.jpg' && // jpg
|
||||
substr($v, -4) == '.png' && // png
|
||||
substr($v, -4) == '.gif' // gif
|
||||
) {
|
||||
$ok = false;
|
||||
}
|
||||
return $ok;
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
Validator::extend('image_meme', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
$ok = true;
|
||||
foreach (json_decode($value) as $v) {
|
||||
if (
|
||||
mime_content_type($v) != 'image/jpeg' && // jpg
|
||||
mime_content_type($v) != 'image/png' && // png
|
||||
mime_content_type($v) != 'image/gif' // gif
|
||||
) {
|
||||
$ok = false;
|
||||
}
|
||||
else {
|
||||
if (
|
||||
mime_content_type($v) != 'image/jpeg' && // jpg
|
||||
mime_content_type($v) != 'image/png' && // png
|
||||
mime_content_type($v) != 'image/gif' // gif
|
||||
) {
|
||||
$ok = false;
|
||||
}
|
||||
return $ok;
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return $ok;
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//// PDF
|
||||
if (substr($r->pdf, -4) != '.pdf') {
|
||||
Validator::extend('pdf_meme', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
Validator::extend('pdf_meme', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
if (substr($value, -4) != '.pdf') {
|
||||
return mime_content_type($value) == 'application/pdf';
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
Validator::extend('pdf_meme', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
else {
|
||||
return substr($value, -4) == '.pdf';
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$validate = Validator::make($r->all(), [
|
||||
'title' => 'required|max:100',
|
||||
|
|
新しいイシューから参照