子供の詳細の場合、md*→cd*。そうして、uniqid→uuidv4

このコミットが含まれているのは:
守矢諏訪子 2021-11-22 19:08:15 +09:00
コミット 77db918ded
6個のファイルの変更32行の追加12行の削除

ファイルの表示

@ -145,7 +145,7 @@ KIKI承知システムを使って「聞いてない」「言ってない
$password = Hash::make($r->password);
$ext = explode('/', mime_content_type($r->image))[1];
$filename = uniqid() . '.'.$ext;
$filename = $this->uuidv4() . '.'.$ext;
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
Storage::disk('public')->put($filename, $image);
@ -365,7 +365,7 @@ KIKI承知システムを使って「聞いてない」「言ってない
return ['status_code' => 400];
}
if (request()->route()->action['as'] == 'mdp') {
if (request()->route()->action['as'] == 'cdp') {
if (null === ($params->father_relations = FatherRelation::select($father_relations_select)->where('child_id', (int)$child_id)->where('father_id', (int)$r->father_id)->first())) {
$params->father_relations = new \stdClass();
}
@ -416,7 +416,7 @@ KIKI承知システムを使って「聞いてない」「言ってない
try {
$ext = explode('/', mime_content_type($r->image))[1];
$filename = uniqid() . '.'.$ext;
$filename = $this->uuidv4() . '.'.$ext;
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
Storage::disk('public')->put($filename, $image);

ファイルの表示

@ -179,7 +179,7 @@ class FathersController extends Controller {
$password = Hash::make($r->password);
$ext = explode('/', mime_content_type($r->image))[1];
$filename = uniqid() . '.'.$ext;
$filename = $this->uuidv4() . '.'.$ext;
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
Storage::disk('public')->put($filename, $image);
@ -340,7 +340,7 @@ class FathersController extends Controller {
}
$ext = explode('/', mime_content_type($r->image))[1];
$filename = uniqid() . '.'.$ext;
$filename = $this->uuidv4() . '.'.$ext;
$oldimg = null;
try {

ファイルの表示

@ -53,7 +53,7 @@ class MeetingImagesController extends Controller {
try {
$ext = explode('/', mime_content_type($r->image))[1];
$filename = uniqid() . '.'.$ext;
$filename = $this->uuidv4() . '.'.$ext;
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
Storage::disk('public')->put($filename, $image);

ファイルの表示

@ -111,7 +111,7 @@ class MeetingsController extends Controller {
try {
if (isset($r->pdf)) {
$filename = uniqid() . '.pdf';
$filename = $this->uuidv4() . '.pdf';
$insert['pdf'] = '/storage/'.$filename;
if (substr($r->pdf, -4) != '.pdf') {
@ -130,7 +130,7 @@ 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') {
$ext = explode('/', mime_content_type($img))[1];
$fname = uniqid() . '.'.$ext;
$fname = $this->uuidv4() . '.'.$ext;
$image = base64_decode(substr($img, strpos($img, ',') + 1));
Storage::disk('public')->put($fname, $image);
@ -743,7 +743,7 @@ class MeetingsController extends Controller {
try {
// リクエストでPDFがある場合
if (isset($r->pdf)) {
$filename = uniqid() . '.pdf';
$filename = $this->uuidv4() . '.pdf';
// DBにミーティングがある場合
if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) {

ファイルの表示

@ -10,4 +10,24 @@ use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
/**
* UUID 生成
* @return string
* @throws \Exception
*/
public function uuidv4 () : string
{
$chars = str_split('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx');
foreach ($chars as $i => $char) {
if ($char === 'x') {
$chars[$i] = dechex(random_int(0, 15));
} elseif ($char === 'y') {
$chars[$i] = dechex(random_int(8, 11));
}
}
return implode('', $chars);
}
}

ファイルの表示

@ -41,7 +41,7 @@ Route::group(['prefix' => 'admin'], function () {
Route::put('/updateProfile/{child_id}', '\App\Http\Controllers\Api\ChildrenController@updateProfile');
Route::put('/updateImage/{child_id}', '\App\Http\Controllers\Api\ChildrenController@updateImage');
Route::put('/updatePassword/{child_id}', '\App\Http\Controllers\Api\ChildrenController@updatePassword');
Route::get('/detail/{child_id}', '\App\Http\Controllers\Api\ChildrenController@detail')->name('mda');
Route::get('/detail/{child_id}', '\App\Http\Controllers\Api\ChildrenController@detail')->name('cda');
Route::delete('/delete/{child_id}', '\App\Http\Controllers\Api\ChildrenController@withdrawal');
});
@ -93,7 +93,7 @@ Route::group(['prefix' => 'fathers'], function () {
Route::get('/listOfMeeting', '\App\Http\Controllers\Api\ChildrenController@listOfMeeting');
Route::post('/listOfMeetingNotifyUnapprovel', '\App\Http\Controllers\Api\ChildrenController@listOfMeetingNotifyUnapprovel');
Route::post('/listOfMeetingNotifyApprovel', '\App\Http\Controllers\Api\ChildrenController@listOfMeetingNotifyApprovel');
Route::get('/detail/{child_id}', '\App\Http\Controllers\Api\ChildrenController@detail')->name('mdp');
Route::get('/detail/{child_id}', '\App\Http\Controllers\Api\ChildrenController@detail')->name('cdp');
});
// MeetingsController
@ -147,7 +147,7 @@ Route::group(['prefix' => 'children'], function () {
Route::put('/updatePassword/{child_id?}', '\App\Http\Controllers\Api\ChildrenController@updatePassword');
Route::group(['middleware' => ['auth:children', 'notice.nonapproval']], function () {
Route::get('/detail/{child_id}', '\App\Http\Controllers\Api\ChildrenController@detail')->name('mdc');
Route::get('/detail/{child_id}', '\App\Http\Controllers\Api\ChildrenController@detail')->name('cdc');
Route::put('/updateImage/{child_id}', '\App\Http\Controllers\Api\ChildrenController@updateImage');
Route::put('/updateProfile/{child_id}', '\App\Http\Controllers\Api\ChildrenController@updateProfile');
Route::delete('/withdrawal', '\App\Http\Controllers\Api\ChildrenController@withdrawal');