Merge branch 'adminkanryo' of https://github.com/nakazawakan/kikikanri into frontend
このコミットが含まれているのは:
コミット
c1516e9801
|
@ -501,6 +501,16 @@ class MeetingsController extends Controller {
|
|||
'memo' => 'nullable|max:2000',
|
||||
]);
|
||||
|
||||
// ミームタイプ
|
||||
Validator::extend('pdf_meme', function ($attribute, $value, $params, $validator) {
|
||||
try {
|
||||
return mime_content_type($value) == 'application/pdf';
|
||||
} catch (\Throwable $e) {
|
||||
Log::critical($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
if ($validate->fails()) {
|
||||
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
||||
}
|
||||
|
@ -517,6 +527,13 @@ class MeetingsController extends Controller {
|
|||
$filename = uniqid() . '.pdf';
|
||||
$pdf = base64_decode(substr($r->pdf, strpos($r->pdf, ',') + 1));
|
||||
$update['pdf'] = '/storage/'.$filename;
|
||||
|
||||
if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) {
|
||||
if (Storage::disk('public')->has($chk->pdf)) {
|
||||
Storage::disk('public')->delete($chk->pdf);
|
||||
}
|
||||
}
|
||||
|
||||
Storage::disk('public')->put($filename, $pdf);
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ return [
|
|||
'required_with_all' => 'The :attribute field is required when :values are present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||
'pdf_meme' => 'ファイル形式はpdfのみです。',
|
||||
'prohibited' => 'The :attribute field is prohibited.',
|
||||
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
|
||||
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
|
||||
|
|
新しいイシューから参照