2021-10-15 10:37:47 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
|
2021-10-20 10:24:11 +09:00
|
|
|
use App\Http\Controllers\Controller, Session;
|
2021-10-21 19:47:39 +09:00
|
|
|
use App\Http\Controllers\Api\CommonController as Common;
|
2021-10-15 10:37:47 +09:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
2021-10-21 19:47:39 +09:00
|
|
|
class AdminController extends Common {
|
|
|
|
private $common;
|
2021-10-15 10:37:47 +09:00
|
|
|
|
2021-10-21 19:47:39 +09:00
|
|
|
public function __construct () {
|
|
|
|
$this->common = new Common('admin');
|
|
|
|
}
|
2021-10-20 12:54:57 +09:00
|
|
|
|
2021-10-15 10:37:47 +09:00
|
|
|
public function login (Request $r) {
|
2021-10-21 19:47:39 +09:00
|
|
|
return $this->common->login($r);
|
2021-10-16 13:24:01 +09:00
|
|
|
}
|
|
|
|
|
2021-10-20 16:54:26 +09:00
|
|
|
public function checkLogin () {
|
|
|
|
// セッションがあれば、管理者のトップページに移転する。なければ、ログイン画面となる。
|
|
|
|
if (Session::has('admin_email')) {
|
|
|
|
return redirect('/admin/meeting');
|
|
|
|
}
|
|
|
|
|
|
|
|
return view('admin.login');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function logout () {
|
|
|
|
// セッションを破壊すると、ログイン画面に移転する。
|
|
|
|
if (Session::has('admin_email')) {
|
|
|
|
Session::forget('admin_email');
|
|
|
|
}
|
|
|
|
|
|
|
|
return redirect('/admin/login');
|
2021-10-15 10:37:47 +09:00
|
|
|
}
|
|
|
|
}
|