Merge branch 'adminkanryo' of https://github.com/nakazawakan/kikikanri into frontend

このコミットが含まれているのは:
dragon1211 2021-10-30 23:37:43 +09:00
コミット b11bafe9f0
9個のファイルの変更44行の追加30行の削除

ファイルの表示

@ -14,7 +14,7 @@ class AdminController extends Controller {
/* Traitで使うメソッド */
protected function getGuard () {
return 'admin';
return 'admins';
}
protected function getModel () {
return new \App\Models\Admin();

ファイルの表示

@ -52,7 +52,7 @@ trait AuthenticationTrait {
// セッションを想像する
$guard = $this->getGuard();
if ($r->session()->has($guard)) {
if (!$r->session()->has($guard)) {
// 認証されたデータのpassword以外を把握する
$login_user_datum = $get->toArray();
unset($login_user_datum['password']);

ファイルの表示

@ -22,7 +22,7 @@ class ChildrenController extends Controller {
/* Traitで使うメソッド */
protected function getGuard () {
return 'child';
return 'children';
}
protected function getModel () {
return new \App\Models\Child();

ファイルの表示

@ -22,7 +22,7 @@ class FathersController extends Controller {
/* Traitで使うメソッド */
protected function getGuard () {
return 'father';
return 'fathers';
}
protected function getModel () {
return new \App\Models\Father();

ファイルの表示

@ -12,7 +12,7 @@ use App\Models\MeetingImage;
class MeetingImagesController extends Controller {
public function register (Request $r) {
if (!isset($r->meeting_id)) {
if (!isset($r->meeting_id) || !isset($r->image)) {
return ['status' => 400];
}
@ -30,10 +30,17 @@ class MeetingImagesController extends Controller {
return ['status_code' => 422, 'error_messages' => $validate->errors()];
}
$insert = ['meeting_id' => $meeting_id, 'image' => $image];
$insert = ['meeting_id' => $r->meeting_id];
foreach ($r->images as $image) {
try {
$insert['image'] = $image;
$ext = explode('/', mime_content_type($image))[1];
$filename = uniqid() . '.'.$ext;
$img = base64_decode(substr($image, strpos($image, ',') + 1));
Storage::disk('public')->put($filename, $img);
MeetingImage::create($insert);
} catch (\Throwable $e) {
// 失敗
@ -41,6 +48,7 @@ class MeetingImagesController extends Controller {
return ['status_code' => 400];
}
}
return ['status_code' => 200];
}

ファイルの表示

@ -466,7 +466,7 @@ class MeetingsController extends Controller {
$meeting_select = ['id', 'father_id', 'title', 'text', 'memo', 'pdf', 'updated_at', 'is_favorite'];
$meeting_images_select = ['image'];
$meeting_approvals_select = ['approval_at', 'child_id'];
$child_select = ['image'];
$child_select = ['image', 'last_name', 'first_name'];
// 取得に成功
if (null === ($list = Meeting::select($meeting_select)->where('id', $meeting_id)->where('father_id', $r->father_id)->get())) {
@ -501,7 +501,7 @@ class MeetingsController extends Controller {
'title' => 'required|max:100',
'text' => 'required|max:2000',
'memo' => 'nullable|max:2000',
'pdf' => 'nullable|mimes:pdf'
'pdf' => 'nullable|mimes:pdf',
]);
if ($validate->fails()) {

ファイルの表示

@ -20,6 +20,10 @@ class Authenticate extends Middleware
}
public function handle ($request, Closure $next, ...$guard) {
if (!$request->session()->has($guard)) {
return redirect(route($guard[0].'login'));
}
return $next($request);
}
}

ファイルの表示

@ -16,7 +16,7 @@ use Illuminate\Support\Facades\Route;
Route::group(['prefix' => 'admin'], function () {
// AdminController
Route::post('/login', '\App\Http\Controllers\Api\AdminController@login')->name('adminlogin');
Route::post('/login', '\App\Http\Controllers\Api\AdminController@login')->name('adminslogin');
Route::group(['middleware' => 'auth:admins'], function () {
// AdminController
@ -73,9 +73,9 @@ Route::post('/contacts/register', '\App\Http\Controllers\Api\ContactsController@
Route::group(['prefix' => 'fathers'], function () {
// FathersController
Route::post('/registerMain', '\App\Http\Controllers\Api\FathersController@registerMain')->name('fatherregistermain');
Route::post('/requestPassword', '\App\Http\Controllers\Api\FathersController@requestPassword')->name('fatherrequestpassword');
Route::post('/login', '\App\Http\Controllers\Api\FathersController@login')->name('fatherlogin');
Route::post('/registerMain', '\App\Http\Controllers\Api\FathersController@registerMain')->name('fathersregistermain');
Route::post('/requestPassword', '\App\Http\Controllers\Api\FathersController@requestPassword')->name('fathersrequestpassword');
Route::post('/login', '\App\Http\Controllers\Api\FathersController@login')->name('fatherslogin');
Route::group(['middleware' => 'auth:fathers'], function () {
Route::put('/updateImage/{father_id}', '\App\Http\Controllers\Api\FathersController@updateImage');

ファイルの表示

@ -59,7 +59,7 @@ Route::get('/unknown-error ', function () { return vie
// ---------------------------------------- Child Account ------------------------------------------- //
Route::group(['prefix' => 'c-account'], function () {
Route::get('/register-temporary', function () { return view('c_account.auth'); });
Route::get('/login', function () { return view('c_account.auth'); });
Route::get('/login', function () { return view('c_account.auth'); })->name('childrenlogin');
Route::group(['prefix' => 'register'], function () {
Route::get('/', function () { return view('c_account.auth'); });
Route::get('/complete', function () { return view('c_account.auth'); });
@ -71,29 +71,31 @@ Route::group(['prefix' => 'c-account'], function () {
Route::get('/complete', function () { return view('c_account.auth'); });
});
Route::group(['prefix' => 'meeting'], function () {
Route::get('/', function () { return view('c_account.index'); });
Route::get('/detail/{id}', function () { return view('c_account.index'); });
});
Route::get('/search', function () { return view('c_account.index'); });
Route::group(['prefix' => 'parent'], function () {
Route::get('/', function () { return view('c_account.index'); });
Route::get('/detail/{father_id}', function () { return view('c_account.index'); });
});
Route::group(['middleware' => 'auth:children'], function () {
Route::group(['prefix' => 'meeting'], function () {
Route::get('/', function () { return view('c_account.index'); });
Route::get('/detail/{id}', function () { return view('c_account.index'); });
});
Route::get('/search', function () { return view('c_account.index'); });
Route::group(['prefix' => 'parent'], function () {
Route::get('/', function () { return view('c_account.index'); });
Route::get('/detail/{father_id}', function () { return view('c_account.index'); });
});
Route::group(['prefix' => 'profile'], function () {
Route::get('/', function () { return view('c_account.index'); });
Route::get('/detail/{child_id}', function () { return view('c_account.index'); });
Route::get('/edit/{child_id}', function () { return view('c_account.index'); });
Route::get('/password-edit/{child_id}', function () { return view('c_account.index'); });
Route::get('/withdrawal', function () { return view('c_account.index'); });
Route::group(['prefix' => 'profile'], function () {
Route::get('/', function () { return view('c_account.index'); });
Route::get('/detail/{child_id}', function () { return view('c_account.index'); });
Route::get('/edit/{child_id}', function () { return view('c_account.index'); });
Route::get('/password-edit/{child_id}', function () { return view('c_account.index'); });
Route::get('/withdrawal', function () { return view('c_account.index'); });
});
Route::get('/withdrawal/complete', function () { return view('c_account.withdrawal.complete'); });
});
Route::get('/withdrawal/complete', function () { return view('c_account.withdrawal.complete'); });
});
// ---------------------------------------- Admin Account ------------------------------------------- //
Route::group(['prefix' => 'admin'], function () {
Route::get('/login', '\App\Http\Controllers\Api\AdminController@checkLogin')->name('adminlogin');
Route::get('/login', '\App\Http\Controllers\Api\AdminController@checkLogin')->name('adminslogin');
Route::get('/logout', '\App\Http\Controllers\Api\AdminController@logout');
Route::group(['middleware' => 'auth:admins'], function () {