Silent 6 vuotta sitten
vanhempi
commit
dfcaf77065
35 muutettua tiedostoa jossa 2316 lisäystä ja 8 poistoa
  1. 7 5
      app/Http/Controllers/Admin/ContentController.php
  2. 81 0
      app/Http/Controllers/Admin/OrderController.php
  3. 53 0
      app/Http/Controllers/Admin/SettingController.php
  4. 97 0
      app/Http/Controllers/Teacher/Auth/LoginController.php
  5. 31 0
      app/Http/Controllers/Teacher/Base/IndexController.php
  6. 72 0
      app/Http/Controllers/Teacher/CheckCardController.php
  7. 204 0
      app/Http/Controllers/Teacher/Controller.php
  8. 50 0
      app/Http/Controllers/Teacher/LeaveController.php
  9. 115 0
      app/Http/Controllers/Teacher/StudentController.php
  10. 1 0
      app/Http/Controllers/TestController.php
  11. 1 0
      app/Http/Kernel.php
  12. 25 0
      app/Http/Middleware/AuthenticateTeacher.php
  13. 70 0
      app/Models/Order.php
  14. 12 0
      app/Models/Setting.php
  15. 2 2
      app/Models/Teacher.php
  16. 10 0
      app/Providers/RouteServiceProvider.php
  17. 9 0
      config/auth.php
  18. 39 0
      database/migrations/2018_07_03_080411_create_orders_table.php
  19. 34 0
      database/migrations/2018_07_03_213716_create_settings_table.php
  20. 32 0
      database/migrations/2018_07_03_220643_add_user_info_to_teacher.php
  21. 1 1
      resources/views/admin/base/menus/index.blade.php
  22. 135 0
      resources/views/admin/orders/index.blade.php
  23. 67 0
      resources/views/admin/settings/share.blade.php
  24. 51 0
      resources/views/teacher/auth/login.blade.php
  25. 153 0
      resources/views/teacher/base/index/index.blade.php
  26. 1 0
      resources/views/teacher/base/index/welcome.blade.php
  27. 106 0
      resources/views/teacher/check-cards/index.blade.php
  28. 102 0
      resources/views/teacher/leaves/index.blade.php
  29. 110 0
      resources/views/teacher/students/courses/create.blade.php
  30. 111 0
      resources/views/teacher/students/courses/edit.blade.php
  31. 112 0
      resources/views/teacher/students/courses/index.blade.php
  32. 135 0
      resources/views/teacher/students/create.blade.php
  33. 136 0
      resources/views/teacher/students/edit.blade.php
  34. 118 0
      resources/views/teacher/students/index.blade.php
  35. 33 0
      routes/teacher.php

+ 7 - 5
app/Http/Controllers/Admin/ContentController.php

xqd xqd xqd
@@ -90,6 +90,11 @@ class ContentController extends Controller
             return $this->showWarning('数据错误');
         }
 
+        $item = $this->model->where('id', $request->input('id'))->first();
+        if(empty($item)) {
+            return $this->showWarning('找不到数据');
+        }
+
         $data = $request->input('data');
         if($request->hasFile('video')) {
             $data['content'] = (new BaseAttachmentModel())->upload($request->file('video'), '视频');
@@ -99,8 +104,8 @@ class ContentController extends Controller
         if(!$res) {
             return $this->showWarning('数据库保存失败!');
         }
-        $item = $this->model->where('id', $request->input('id'))->first();
-        return $this->showMessage('操作成功', $this->redirect_index . '?type=' . $);
+
+        return $this->showMessage('操作成功', $this->redirect_index . '?type=' . $item->type);
     }
 
 
@@ -112,9 +117,6 @@ class ContentController extends Controller
         if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
             return $this->showWarning('访问错误');
         }
-
-        StudentCourse::where('student_id', $item->id)->delete();
-        StudentCourseTeacher::where('student_id', $item->id)->delete();
         $res = $item->delete();
         if(!$res) {
             return $this->showWarning('数据库删除失败');

+ 81 - 0
app/Http/Controllers/Admin/OrderController.php

xqd
@@ -0,0 +1,81 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Models\Order;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+
+class OrderController extends Controller
+{
+    protected $redirect_index = '/admin/Order/index';
+
+    protected $view_path = 'admin.orders.';
+
+    protected $pre_uri = '/admin/Order/';
+
+    protected $model_name = '订单';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new Order();
+    }
+
+    public function index(Request $request)
+    {
+        $list = $this->model->where('id', '>', 0);
+
+        if(!empty($request->input('pay_status')) && in_array($request->input('pay_status'), [1, 2, 3, 4, 5])) {
+            $list = $list->where('pay_status', $request->input('pay_status'));
+        }
+        if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
+            $keyword = '%' . trim($request->input('keyword')) . '%';
+            $list = $list->whereHas('student', function ($query) use($keyword) {
+                $query->where('name', 'like', $keyword);
+            });
+        }
+
+        if(!empty($request->input('start_time'))) {
+            $start_time = Carbon::createFromTimestamp(strtotime($request->input('start_time')))->toDateTimeString();
+        } else {
+            $start_time = Carbon::now()->subYears(10)->toDateTimeString();
+        }
+
+        if(!empty($request->input('end_time'))) {
+            $end_time = Carbon::createFromTimestamp(strtotime($request->input('end_time')))->addDay()->toDateTimeString();
+        } else {
+            $end_time = Carbon::now()->addYears(10)->toDateTimeString();
+        }
+
+        $list = $list->where([
+            ['created_at', '>=', $start_time],
+            ['created_at', '<', $end_time],
+        ]);
+
+        $list = $list->paginate()->withPath($this->getPaginateUrl());
+
+        list($pre_uri, $model, $model_name) = array($this->pre_uri, $this->model, $this->model_name);
+
+        $seven_days_ago = Carbon::now()->subDays(7)->toDateTimeString();
+        $one_month_ago = Carbon::now()->subMonth()->toDateTimeString();
+        return view($this->view_path . 'index', compact('list', 'pre_uri', 'model', 'model_name', 'seven_days_ago', 'one_month_ago'));
+    }
+
+    public function delete(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('访问错误');
+        }
+        $res = $item->delete();
+        if(!$res) {
+            return $this->showWarning('数据库删除失败');
+        }
+        return $this->showMessage('操作成功');
+    }
+}

+ 53 - 0
app/Http/Controllers/Admin/SettingController.php

xqd
@@ -0,0 +1,53 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Models\Setting;
+use Illuminate\Http\Request;
+
+class SettingController extends Controller
+{
+    protected $redirect_index = '/admin/Setting/index';
+
+    protected $view_path = 'admin.settings.';
+
+    protected $pre_uri = '/admin/Setting/';
+
+    protected $model_name = '系统配置';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new Setting();
+    }
+
+    public function share()
+    {
+        $share_image = $this->model->firstOrCreate(['key' => 'share_image'], ['key_show' => '图片']);
+        $share_text = $this->model->firstOrCreate(['key' => 'share_text'], ['key_show' => '文本标签']);
+        $share_text_pos = $this->model->firstOrCreate(['key' => 'share_text_pos'], ['key_show' => '文本位置']);
+
+        list($pre_uri, $model, $model_name) = array($this->pre_uri, $this->model, $this->model_name);
+
+        return view($this->view_path . 'share', compact('pre_uri', 'model', 'model_name', 'share_image', 'share_text', 'share_text_pos'));
+    }
+
+    public function updateShare(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+        if(!empty($request->input('share_image'))) {
+            $this->model->where('key', 'share_image')->update(['value' => $request->input('share_image')]);
+        }
+        if(!empty($request->input('share_text'))) {
+            $this->model->where('key', 'share_text')->update(['value' => $request->input('share_text')]);
+        }
+        if(!empty($request->input('share_text_pos'))) {
+            $this->model->where('key', 'share_text_pos')->update(['value' => $request->input('share_text_pos')]);
+        }
+        return $this->showMessage('操作成功');
+    }
+}

+ 97 - 0
app/Http/Controllers/Teacher/Auth/LoginController.php

xqd
@@ -0,0 +1,97 @@
+<?php
+
+namespace App\Http\Controllers\Teacher\Auth;
+
+use App\Models\Teacher;
+use App\Http\Controllers\Teacher\Controller;
+use Illuminate\Foundation\Auth\AuthenticatesUsers;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Validator;
+
+class LoginController extends Controller
+{
+    /*
+    |--------------------------------------------------------------------------
+    | Login Controller
+    |--------------------------------------------------------------------------
+    |
+    | This controller handles authenticating users for the application and
+    | redirecting them to your home screen. The controller uses a trait
+    | to conveniently provide its functionality to your applications.
+    |
+    */
+
+    use AuthenticatesUsers;
+
+    /**
+     * Where to redirect users after login.
+     *
+     * @var string
+     */
+    protected $redirectTo = '/teacher';
+
+    /**
+     * 重写登录视图页面
+     * @author 晚黎
+     * @date   2016-09-05T23:06:16+0800
+     * @return [type]                   [description]
+     */
+    public function showLoginForm()
+    {
+        return view('teacher.auth.login');
+    }
+    /**
+     * 自定义认证驱动
+     * @author 晚黎
+     * @date   2016-09-05T23:53:07+0800
+     * @return [type]                   [description]
+     */
+    protected function guard()
+    {
+        return auth()->guard('teacher');
+    }
+
+    public function username()
+    {
+        return 'phone';
+    }
+
+    public function login(Request $request)
+    {
+        $validator = Validator::make($request->all(), [
+            $this->username() => 'required|string',
+            'password' => 'required|string'
+        ]);
+        if($validator->fails()) {
+            return back()->withErrors($validator);
+        }
+
+        // If the class is using the ThrottlesLogins trait, we can automatically throttle
+        // the login attempts for this application. We'll key this by the username and
+        // the IP address of the client making these requests into this application.
+        if ($this->hasTooManyLoginAttempts($request)) {
+            $this->fireLockoutEvent($request);
+
+            return $this->sendLockoutResponse($request);
+        }
+
+        if ($this->attemptLogin($request)) {
+            return $this->sendLoginResponse($request);
+        }
+
+        // If the login attempt was unsuccessful we will increment the number of attempts
+        // to login and redirect the user back to the login form. Of course, when this
+        // user surpasses their maximum number of attempts they will get locked out.
+        $this->incrementLoginAttempts($request);
+
+        return $this->sendFailedLoginResponse($request);
+    }
+
+    public function logout()
+    {
+        Auth::guard('teacher')->logout();
+        return redirect('/teacher/login');
+
+    }
+}

+ 31 - 0
app/Http/Controllers/Teacher/Base/IndexController.php

xqd
@@ -0,0 +1,31 @@
+<?php
+/**
+ *  
+ *  @author  Mike <m@9026.com>
+ *  @version    1.0
+ *  @date 2015年10月12日
+ *
+ */
+namespace App\Http\Controllers\Teacher\Base;
+
+use App\Http\Controllers\Teacher\Controller;
+use App\Services\Base\Tree;
+use App\Services\Base\BaseArea;
+use App\Services\Admin\Menus;
+use App\Services\Admin\Acl;
+use Illuminate\Support\Facades\Auth;
+
+class IndexController extends Controller
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    function index() {
+        return view('teacher.base.index.index',compact('menus'));
+    }
+    function welcome() {
+        return view('teacher.base.index.welcome');
+    }
+}

+ 72 - 0
app/Http/Controllers/Teacher/CheckCardController.php

xqd
@@ -0,0 +1,72 @@
+<?php
+
+namespace App\Http\Controllers\Teacher;
+
+use App\Models\CheckCard;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+
+class CheckCardController extends Controller
+{
+    protected $redirect_index = '/teacher/CheckCard/index';
+
+    protected $view_path = 'teacher.check-cards.';
+
+    protected $pre_uri = '/teacher/CheckCard/';
+
+    protected $model_name = '打卡';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new CheckCard();
+    }
+
+    public function index(Request $request)
+    {
+        $list = $this->model->where('id', '>', 0)->orderBy('created_at', 'desc')->get();
+
+        if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
+            $keyword = trim($request->input('keyword'));
+
+            $list = $list->filter(function ($value) use($keyword) {
+                if(!empty($value->student) && !(strpos($value->student->name, $keyword) === false)) {
+                    return true;
+                }
+                if(!empty($value->course) && !(strpos($value->course->name, $keyword) === false)) {
+                    return true;
+                }
+                return false;
+            });
+        }
+
+        if(!empty($request->input('begin_date'))) {
+            $begin_date_time = Carbon::createFromTimestamp(strtotime($request->input('begin_date')))->toDateTimeString();
+        } else {
+            $begin_date_time = Carbon::now()->subYears(10)->toDateTimeString();
+        }
+
+        if(!empty($request->input('end_date'))) {
+            $end_date_time = Carbon::createFromTimestamp(strtotime($request->input('end_date')))->addDay()->toDateTimeString();
+        } else {
+            $end_date_time = Carbon::now()->addYears(10)->toDateTimeString();
+        }
+
+        if(!empty($begin_date_time) || !empty($end_date_time)) {
+            $list = $list->filter(function ($value) use($begin_date_time, $end_date_time) {
+                return $value->begin_date_time >= $begin_date_time && $value->end_date_time < $end_date_time;
+            });
+        }
+
+        $list = $this->paginate($list);
+
+        foreach($list as $item) {
+            $item->duration = $item->getDuration();
+        }
+
+        list($pre_uri, $model_name) = array($this->pre_uri, $this->model_name);
+        return view($this->view_path . 'index', compact('list', 'pre_uri', 'model_name'));
+    }
+}

+ 204 - 0
app/Http/Controllers/Teacher/Controller.php

xqd
@@ -0,0 +1,204 @@
+<?php
+
+namespace App\Http\Controllers\Teacher;
+
+use Illuminate\Routing\Controller as BaseController;
+use Illuminate\Support\Facades\Auth;
+use Request;
+use Illuminate\Pagination\LengthAwarePaginator;
+use Illuminate\Pagination\Paginator;
+use Illuminate\Support\Collection;
+
+/**
+ * 父控制类类
+ *
+ * @author wangzhoudong <m@9026.com>
+ */
+abstract class Controller extends BaseController
+{
+    protected $_user;
+    protected $_serviceAdminRole;
+
+    public function __construct() {
+        $this->middleware(function ($request, $next) {
+            $this->_user = Auth::guard('teacher')->user();
+            view()->share('_user',$this->_user);
+            return $next($request);
+        });
+    }
+
+    /**
+     * 检测表单篡改
+     *
+     * @return true|exception
+     */
+    protected function checkFormHash()
+    {
+        return (new Formhash())->checkFormHash();
+    }
+
+    /**
+     * 启用操作日志记录
+     */
+    protected function setActionLog($extDatas = [])
+    {
+        return app()->make(Mark::BIND_NAME)->setMarkYes()->setExtDatas($extDatas);
+    }
+
+    /**
+     * 显示提示消息
+     */
+    public function showMessage($msg, $links = NULL, $data = NULL, $redirect = true)
+    {
+        $this->_showMessage($msg, $links, $data, SUCESS_CODE, $redirect);
+    }
+
+    /**
+     * 显示错误消息
+     */
+    public function showWarning($msg, $links = NULL, $data = NULL, $redirect = true)
+    {
+        $this->_showMessage($msg, $links, $data, FAILURE_CODE, $redirect);
+    }
+
+    /**
+     *    显示消息
+     */
+    public function _showMessage($msgs, $links, $data, $code, $redirect)
+    {
+        header("Content-type:text/html;charset=utf-8");
+        if(!is_array($msgs)) {
+            $msgs = array($msgs);
+        }
+        $urls = $links;
+        if(!is_array($links)) {
+            $urls = array();
+            if($links) {
+                $urls[0]['url']    =  $links;
+            }elseif(isset($_SERVER['HTTP_REFERER'])) {
+                $urls[0]['url'] = $_SERVER['HTTP_REFERER'];
+            }else{
+                $urls[0]['url']    =  'javascript:history.back();';
+
+            }
+            $urls[0]['title']  = '点击立即跳转';
+        }
+
+        if($redirect) {
+            $redirect = $urls[0]['url'];
+            $redirect = (strstr($redirect, 'javascript:') !== false) ? $redirect : "location.href='{$redirect}'";
+        } else {
+            $redirect = '';
+        }
+
+        if(Request::ajax()){
+            $retval['msg'] = $msgs;
+            $retval['redirect'] = $redirect;
+            $retval['data'] = $data;
+            $retval['status'] = $code;
+            echo json_encode($retval);exit;
+            return ;
+        }
+        if($links=="refresh") {
+            echo "<script>alert('{$msgs[0]}');</script>";
+            echo "<script>window.close();</script>";
+            echo "<script>opener.location.reload();</script>";
+            exit;
+        }
+        if($code==SUCESS_CODE) {
+            $ico = '<i class="fa fa-check"></i>';
+            $titleHtml = '信息提示';
+        }else{
+            $ico = '<i class="fa fa-warning"></i>';
+            $titleHtml = '错误警告';
+        }
+        $msgHtml = '';
+        foreach ($msgs as $msg) {
+            $msgHtml .= "<li>$msg</li>";
+        }
+        $urlHtml = '';
+        foreach ($urls as $url) {
+            if($url['url'] == 'history_back'){
+                $u = "javascript:history.back();";
+            }else{
+                $u = $url['url'];
+            }
+            $urlHtml .= '&nbsp;<a  class="btn btn-primary"  href="' . $u . '" >' . $url['title'] . '</a>';
+        }
+
+        $html ='<!DOCTYPE html>
+                <html>
+                <head>
+                    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+                    <meta name="renderer" content="webkit">
+                    <title>' . $titleHtml .'</title>
+                    <link href="/base/css/bootstrap.min.css?v=3.4.0.css"  rel="stylesheet">
+                    <link href="/base/css/font-awesome.min.css?v=4.3.0.css"  rel="stylesheet">
+                    <link href="/base/css/style.min.css?v=3.0.0.css"  rel="stylesheet">
+                    <script type="text/javascript">
+                            setTimeout(function(){
+                                var url = "' . $urls[0]['url'] . '";
+                                if(url == "history_back"){
+                                    window.location.href = history.back();
+                                }else{
+	                               window.location.href = url;
+	                            }
+	                        }, 3000);
+                    </script>
+                </head>
+                
+                <body class="gray-bg">
+                    <div class="ibox-content middle-box" style="width:600px; margin-top: 150px;">
+                        <h2 class="text-center">' . $ico . ' ' . $titleHtml . '</h2>
+                        <ul class="todo-list m-t ui-sortable">
+                           ' . $msgHtml . '
+                        </ul>
+                        <div class="text-center">
+                                                                             该页面将在 3 秒钟后自动转向
+                        </div>
+                        <div class="text-center" style="margin-top: 10px;">
+                           ' . $urlHtml . '
+                          
+                            <a href="javascript:history.back();" class="btn  btn-success">
+                                                                                 返回
+                            </a>
+                        </div>
+                    </div>
+                </body>
+                </html>';
+        exit($html);
+    }
+
+    public function paginate($items, $perPage = 15, $page = null, $options = [])
+    {
+        $page = $page ?: (Paginator::resolveCurrentPage() ?: 1);
+        $items = $items instanceof Collection ? $items : Collection::make($items);
+        $options['path'] = $this->getPaginateUrl();
+        return new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options);
+    }
+
+    public function getPaginateUrl()
+    {
+        $url = url()->full();
+        $url_arr = explode('?', $url);
+        $url_end = '';
+
+        if(count($url_arr) > 1) {
+            $params = explode('&', $url_arr[1]);
+            $params_arr = [];
+            foreach($params as $key => $value) {
+                $param = explode('=', $value);
+                $params_arr[$param[0]] = count($param) > 1 ? $param[1] : '';
+            }
+            $id = 0;
+            foreach($params_arr as $key => $value) {
+                if($key != 'page') {
+                    $prefix = $id == 0 ? '?' : '&';
+                    $url_end .= $prefix . $key . '=' . $value;
+                    ++$id;
+                }
+            }
+        }
+        return $url_arr[0] . $url_end;
+    }
+}

+ 50 - 0
app/Http/Controllers/Teacher/LeaveController.php

xqd
@@ -0,0 +1,50 @@
+<?php
+
+namespace App\Http\Controllers\Teacher;
+
+use App\Models\Leave;
+use Carbon\Carbon;
+use Illuminate\Http\Request;
+
+class LeaveController extends Controller
+{
+    protected $redirect_index = '/teacher/Leave/index';
+
+    protected $view_path = 'teacher.leaves.';
+
+    protected $pre_uri = '/teacher/Leave/';
+
+    protected $model_name = '请假';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new Leave();
+    }
+
+    public function index(Request $request)
+    {
+        $list = $this->model->where('id', '>', 0)->orderBy('created_at', 'desc')->get();
+
+        if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
+            $keyword = trim($request->input('keyword'));
+
+            $list = $list->filter(function ($value) use($keyword) {
+                if(!empty($value->student) && !(strpos($value->student->name, $keyword) === false)) {
+                    return true;
+                }
+                if(!empty($value->course) && !(strpos($value->course->name, $keyword) === false)) {
+                    return true;
+                }
+                return false;
+            });
+        }
+
+        $list = $this->paginate($list)->withPath($this->getPaginateUrl());
+
+        list($pre_uri, $model_name) = array($this->pre_uri, $this->model_name);
+        return view($this->view_path . 'index', compact('list', 'pre_uri', 'model_name'));
+    }
+}

+ 115 - 0
app/Http/Controllers/Teacher/StudentController.php

xqd
@@ -0,0 +1,115 @@
+<?php
+
+namespace App\Http\Controllers\Teacher;
+
+use App\Models\Course;
+use App\Models\Student;
+use App\Models\StudentCourse;
+use App\Models\StudentCourseTeacher;
+use App\Models\Teacher;
+use App\Models\TeacherStudent;
+use Illuminate\Http\Request;
+
+class StudentController extends Controller
+{
+    protected $redirect_index = '/teacher/Student/index';
+
+    protected $view_path = 'teacher.students.';
+
+    protected $pre_uri = '/teacher/Student/';
+
+    protected $model_name = '学员';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new Student();
+    }
+
+    public function index(Request $request)
+    {
+        $list = $this->model->where('id', '>', 0)->orderBy('created_at', 'desc');
+
+        if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
+            $keyword = '%' . trim($request->input('keyword')) . '%';
+            $list = $list->where('name', 'like', $keyword);
+        }
+
+        $list = $list->paginate()->withPath($this->getPaginateUrl());
+
+        list($pre_uri, $model_name) = array($this->pre_uri, $this->model_name);
+        return view($this->view_path . 'index', compact('list', 'pre_uri', 'model_name'));
+    }
+
+    public function create(Request $request)
+    {
+        list($pre_uri, $model_name, $model) = array($this->pre_uri, $this->model_name, $this->model);
+        return view($this->view_path . 'create', compact('pre_uri', 'model_name', 'model', 'courses', 'teachers'));
+    }
+
+    public function store(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+
+        if(empty($request->input('data')) || !is_array($request->input('data'))) {
+            return $this->showWarning('数据错误');
+        }
+
+        $res = $this->model->create($request->input('data'));
+
+        if(!$res) {
+            return $this->showWarning('数据库保存失败!');
+        }
+        return $this->showMessage('操作成功', $this->redirect_index);
+    }
+
+    public function edit(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('数据错误!');
+        }
+        list($pre_uri, $model_name, $model) = array($this->pre_uri, $this->model_name, $this->model);
+
+        return view($this->view_path . 'edit', compact('item','pre_uri', 'model_name', 'model'));
+    }
+
+    public function update(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+
+        if(empty($request->input('id')) || empty($request->input('data')) || !is_array($request->input('data'))) {
+            return $this->showWarning('数据错误');
+        }
+
+        $res = $this->model->where('id', $request->input('id'))->update($request->input('data'));
+
+        if(!$res) {
+            return $this->showWarning('数据库保存失败!');
+        }
+        return $this->showMessage('操作成功', $this->redirect_index);
+    }
+
+    public function delete(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('访问错误');
+        }
+
+        StudentCourse::where('student_id', $item->id)->delete();
+        StudentCourseTeacher::where('student_id', $item->id)->delete();
+        $res = $item->delete();
+        if(!$res) {
+            return $this->showWarning('数据库删除失败');
+        }
+        return $this->showMessage('操作成功');
+    }
+}

+ 1 - 0
app/Http/Controllers/TestController.php

xqd
@@ -11,6 +11,7 @@ class TestController extends Controller
 {
     public function index(Request $request)
     {
+        dd(bcrypt(123456));
         $items = collect([
             collect(['key' => 1, 'value' => 1, 'show_value' => '公告']),
             collect(['key' => 2, 'value' => 2, 'show_value' => '活动']),

+ 1 - 0
app/Http/Kernel.php

xqd
@@ -61,5 +61,6 @@ class Kernel extends HttpKernel
 
         //后台
         'auth.admin' => \App\Http\Middleware\AuthenticateAdmin::class,
+        'auth.teacher' => Middleware\AuthenticateTeacher::class,
     ];
 }

+ 25 - 0
app/Http/Middleware/AuthenticateTeacher.php

xqd
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+use Illuminate\Support\Facades\Auth;
+
+class AuthenticateTeacher
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        if(Auth::guard('teacher')->guest()){
+            return redirect('/teacher/login');
+        }
+
+        return $next($request);
+    }
+}

+ 70 - 0
app/Models/Order.php

xqd
@@ -0,0 +1,70 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Order extends Model
+{
+    protected $table = 'orders';
+
+    protected $guarded = [];
+
+    public $pay_statuses;
+
+    public function __construct(array $attributes = [])
+    {
+        parent::__construct($attributes);
+
+        $this->pay_statuses = collect([
+            collect(['key' => 1, 'value' => '未付款']),
+            collect(['key' => 2, 'value' => '已付款']),
+            collect(['key' => 3, 'value' => '已退款']),
+            collect(['key' => 4, 'value' => '已取消']),
+            collect(['key' => 5, 'value' => '回收站']),
+        ]);
+    }
+
+    public function student()
+    {
+        return $this->belongsTo('App\Models\Student');
+    }
+
+    public function getPayStatuses()
+    {
+        return $this->pay_statuses;
+    }
+
+    public function getStudentName()
+    {
+        return empty($this['student']) ? '' : $this['student']['name'];
+    }
+
+    public function getPayPosition()
+    {
+        return '落地页' . $this['pay_position'] . '付款';
+    }
+
+    public function getPayStatusLabel()
+    {
+        switch($this['pay_status']) {
+            case 1:
+                return '<span class="label label-default">未付款</span>';
+            case 2:
+                return '<span class="label label-info">已付款</span>';
+            case 3:
+                return '<span class="label label-danger">已退款</span>';
+            case 4:
+                return '<span class="label label-warning">已取消</span>';
+            case 5:
+                return '<span class="label label-info">回收站</span>';
+            default:
+                return '<span class="label label-default">未付款</span>';
+        }
+    }
+
+    public function getPayMethodLabel()
+    {
+        return '<span class="label label-primary">微信支付</span>';
+    }
+}

+ 12 - 0
app/Models/Setting.php

xqd
@@ -0,0 +1,12 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Setting extends Model
+{
+    protected $table = 'settings';
+
+    protected $guarded = [];
+}

+ 2 - 2
app/Models/Teacher.php

xqd
@@ -2,9 +2,9 @@
 
 namespace App\Models;
 
-use Illuminate\Database\Eloquent\Model;
+use Illuminate\Foundation\Auth\User as Authenticatable;
 
-class Teacher extends Model
+class Teacher extends Authenticatable
 {
     protected $table = 'teachers';
 

+ 10 - 0
app/Providers/RouteServiceProvider.php

xqd xqd
@@ -41,6 +41,8 @@ class RouteServiceProvider extends ServiceProvider
 
         //后台路由
         $this->mapAdminRoutes();
+
+        $this->mapTeacherRoutes();
     }
 
     public function mapAdminRoutes()
@@ -51,6 +53,14 @@ class RouteServiceProvider extends ServiceProvider
             ->group(base_path('routes/admin.php'));
     }
 
+    public function mapTeacherRoutes()
+    {
+        Route::prefix('teacher')
+            ->middleware('web')
+            ->namespace($this->namespace. '\Teacher')
+            ->group(base_path('routes/teacher.php'));
+    }
+
     /**
      * Define the "web" routes for the application.
      *

+ 9 - 0
config/auth.php

xqd xqd
@@ -44,6 +44,10 @@ return [
             'driver' => 'session',
             'provider' => 'admin_users',
         ],
+        'teacher' => [
+            'driver' => 'session',
+            'provider' => 'teachers',
+        ],
         'api' => [
             'driver' => 'token',
             'provider' => 'users',
@@ -78,6 +82,11 @@ return [
             'model' => App\Models\AdminUserModel::class,
         ],
 
+        'teachers' => [
+            'driver' => 'eloquent',
+            'model' => App\Models\Teacher::class,
+        ],
+
         // 'users' => [
         //     'driver' => 'database',
         //     'table' => 'users',

+ 39 - 0
database/migrations/2018_07_03_080411_create_orders_table.php

xqd
@@ -0,0 +1,39 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateOrdersTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('orders', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('out_trade_no', 200)->nullable()->comment('订单号');
+            $table->unsignedInteger('student_id')->nullable()->comment('学员ID');
+            $table->string('phone', 200)->nullable()->comment('电话');
+            $table->tinyInteger('pay_position')->nullable()->comment('付款落地页:1落地页1;2落地页2');
+            $table->tinyInteger('pay_status')->nullable()->comment('付款状态:1未付款;2已付款;3已退款;4已取消;5回收站');
+            $table->tinyInteger('pay_method')->nullable()->comment('付款方式:1微信支付');
+            $table->string('money', 200)->nullable()->comment('订单金额:分');
+            $table->string('remark', 200)->nullable()->comment('备注');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('orders');
+    }
+}

+ 34 - 0
database/migrations/2018_07_03_213716_create_settings_table.php

xqd
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateSettingsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('settings', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('key', 200)->nullable()->comment('键');
+            $table->string('key_show', 200)->nullable()->comment('键显示');
+            $table->string('value', 200)->nullable()->comment('值');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('settings');
+    }
+}

+ 32 - 0
database/migrations/2018_07_03_220643_add_user_info_to_teacher.php

xqd
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddUserInfoToTeacher extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('teachers', function (Blueprint $table) {
+            $table->string('phone', 200)->nullable()->after('name')->comment('电话');
+            $table->string('password', 200)->nullable()->after('phone')->comment('密码');
+            $table->rememberToken();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+}

+ 1 - 1
resources/views/admin/base/menus/index.blade.php

xqd
@@ -31,7 +31,7 @@
 						</div>
 						@endif
 					</div>
-					<table class="table table-striped table-bordered table-hover dataTables-example">
+					<table class="table table-striped table-bordered table-hover" id="menu-table">
 						<thead>
 							<tr>
 							    <th>名称</th>

+ 135 - 0
resources/views/admin/orders/index.blade.php

xqd
@@ -0,0 +1,135 @@
+@extends('admin.layout')
+<style type="text/css">
+    .search-link {
+        margin-top: 7px;
+        font-size: 1.2em;
+    }
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $model_name . '列表' }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <form>
+                                <div class="col-sm-2 form-group">
+                                    <select name="pay_status" class="form-control">
+                                        <option value="0">全部</option>
+                                        @foreach($model->getPayStatuses() as $value)
+                                            <option value="{{ $value['key'] }}" {{ request('pay_status') == $value['key'] ? 'selected' : '' }}>{{ $value['value'] }}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                <div class="col-sm-2 form-group">
+                                    <input type="text" name="keyword" class="form-control" value="{{ request('keyword') }}" placeholder="输入关键词">
+                                </div>
+                                <div class="col-sm-2 form-group">
+                                    <input type="text" name="start_time" class="datepicker form-control" value="{{ request('start_time') }}" placeholder="开始时间" autocomplete="off">
+                                </div>
+                                <div class="col-sm-2 form-group">
+                                    <input type="text" name="end_time" class="datepicker form-control" value="{{ request('end_time') }}" placeholder="截止时间" autocomplete="off">
+                                </div>
+                                <div class="col-sm-1 search-link">
+                                    <a href="{{ $pre_uri . 'index?start_time=' . $seven_days_ago }}">近7天</a>
+                                </div>
+                                <div class="col-sm-1 search-link">
+                                    <a href="{{ $pre_uri . 'index?start_time=' . $one_month_ago }}">近30天</a>
+                                </div>
+                                <div class="col-sm-2 form-group">
+                                    <button class="btn btn-sm btn-primary" type="submit">搜素</button>
+                                </div>
+                            </form>
+                        </div>
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
+                            <thead>
+                                <tr>
+                                    <th>购买信息</th>
+                                    <th>金额</th>
+                                    <th>订单状态</th>
+                                    <th>操作</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                @if($list->count() <= 0)
+                                    <tr>
+                                        <td colspan="4" style="text-align: center;">暂无{{ $model_name }}</td>
+                                    </tr>
+                                @else
+                                    @foreach($list as $item)
+                                        <tr>
+                                            <td colspan="4" style="text-align: left">
+                                                {{ $item->created_at . ' 订单号:' . $item->out_trade_no . ' 用户:' . $item->getStudentName() . ' 电话:' . $item->phone }}
+                                            </td>
+                                        </tr>
+                                        <tr>
+                                            <td>{{ $item->getPayPosition() }}</td>
+                                            <td>{{ $item->money }}</td>
+                                            <td>
+                                                <div>付款状态:{!! $item->getPayStatusLabel() !!}</div>
+                                                <div>支付方式:{!! $item->getPayMethodLabel() !!}</div>
+                                            </td>
+                                            <td>
+                                                <div class="btn-group">
+                                                    <a class="btn btn-sm btn-primary btn-detail" href="{{ $pre_uri . 'show?id=' . $item->id }}">详情</a>
+                                                    <a class="btn btn-sm btn-info btn-remark" href="{{ $pre_uri . 'remark?id=' . $item->id }}">备注</a>
+                                                    <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                    @endforeach
+                                @endif
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-12">{{ $list->links() }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
+    <div class="modal-dialog">
+        <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
+            {{ csrf_field() }}
+
+            <input type="hidden" name="id" id="delete-input-id">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    <button type="submit" class="btn btn-danger">删除</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+    $('#sg-main-table').on('click', '.btn-delete', function () {
+        $('#delete-input-id').val($(this).attr('data-id'));
+        $('#delete-modal').modal('show');
+    });
+})
+</script>
+@endsection

+ 67 - 0
resources/views/admin/settings/share.blade.php

xqd
@@ -0,0 +1,67 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>分享设置</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'updateShare' }}">
+                            {{ csrf_field() }}
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">图片</label>
+                                <div class="col-sm-8">
+                                    {!!  widget('Tools.ImgUpload')->single('share-image', 'share_image', $share_image->value) !!}
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">文本标签</label>
+                                <div class="col-sm-8">
+                                    <input class="form-control" type="text" name="share_text" value="{{ $share_text->value }}">
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">文本位置</label>
+                                <div class="col-sm-8">
+                                    <input class="form-control" type="text" name="share_text_pos" value="{{ $share_text_pos->value }}">
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">保存设置</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 51 - 0
resources/views/teacher/auth/login.blade.php

xqd
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="renderer" content="webkit">
+    <title>讲师后台</title>
+    <meta name="keywords" content="讲师后台">
+    <link href="/base/css/bootstrap.min.css" rel="stylesheet">
+    <link href="/base/css/font-awesome.min.css"  rel="stylesheet">
+    <link href="/base/css/animate.min.css" rel="stylesheet">
+    <link href="/base/css/style.min.css"  rel="stylesheet">
+    <script src="/base/js/jquery-2.1.1.min.js" ></script>
+</head>
+
+<body class="gray-bg">
+
+    <div class="middle-box text-center loginscreen  animated fadeInDown">
+        <div>
+            <div>
+                <div>
+                    <h1 class="logo-name">A+</h1>
+                </div>
+                <h3>讲师后台</h3>
+            </div>
+            <form class="m-t" role="form" accept-charset="UTF-8" method="post">
+                {{ csrf_field() }}
+                <div class="form-group">
+                    <input name="phone" class="form-control" placeholder="手机号" required="">
+                </div>
+                <div class="form-group">
+                    <input type="password" name="password" class="form-control" placeholder="密码" required="">
+                </div>
+                <div class="form-group">
+                    {!! Geetest::render() !!}
+                </div>
+                <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
+                <button type="submit" class="btn btn-primary block full-width m-b">登 录</button>
+            </form>
+        </div>
+    </div>
+
+<!-- 全局js -->
+<script src="/base/js/bootstrap.min.js?v=3.4.0" ></script>
+
+
+<!--统计代码,可删除-->
+
+</body>
+
+</html>

+ 153 - 0
resources/views/teacher/base/index/index.blade.php

xqd
@@ -0,0 +1,153 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="renderer" content="webkit">
+
+    <title>讲师后台</title>
+
+    <!--[if lt IE 8]>
+    <script>
+        alert('H+已不支持IE6-8,请使用谷歌、火狐等浏览器\n或360、QQ等国产浏览器的极速模式浏览本页面!');
+    </script>
+    <![endif]-->
+
+    <link href="/base/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
+    <link href="/base/css/font-awesome.min.css?v=4.3.0" rel="stylesheet">
+    <link href="/base/css/animate.min.css" rel="stylesheet">
+    <link href="/base/css/style.min.css?v={{config("sys.version")}}" rel="stylesheet">
+
+    <style type="text/css">
+        .gray-bg {
+            overflow-x: hidden !important;
+        }
+    </style>
+</head>
+
+<body class="fixed-sidebar full-height-layout gray-bg">
+    <div id="wrapper">
+        <!--左侧导航开始-->
+        <nav class="navbar-default navbar-static-side" role="navigation">
+            <div class="nav-close"><i class="fa fa-times-circle"></i>
+            </div>
+            <div class="sidebar-collapse">
+                <ul class="nav" id="side-menu">
+                    <li class="nav-header">
+                        <div class="dropdown profile-element">
+                            <a data-toggle="dropdown" class="dropdown-toggle" href="#">
+                                <span class="clear">
+                                <span class="block m-t-xs"><strong class="font-bold">{{ $_user['phone'] }}</strong></span>
+                                <span class="text-muted text-xs block">{{ $_user['name'] }}<b class="caret"></b></span>
+                                </span>
+                            </a>
+                            <ul class="dropdown-menu animated fadeInRight m-t-xs">
+                                <li><a target="_blank" href="/">网站首页</a></li>
+                                {{--<li><a href="/admin/changePassword" class="J_menuItem">修改密码</a></li>--}}
+                                <li class="divider"></li>
+                                <li><a href="/teacher/logout">安全退出</a>
+                                </li>
+                            </ul>
+                        </div>
+                        <div class="logo-element">
+                        </div>
+                    </li>
+                    <li>
+                        <a href="/teacher/Student/index" class="J_menuItem">
+                            <i class="fa fa-users"></i>
+                            <span class="nav-label">学员列表</span>
+                        </a>
+                        <a href="/teacher/CheckCard/index" class="J_menuItem">
+                            <i class="fa fa-check-square"></i>
+                            <span class="nav-label">打卡记录</span>
+                        </a>
+                        <a href="/teacher/Leave/index" class="J_menuItem">
+                            <i class="fa fa-plane"></i>
+                            <span class="nav-label">请假记录</span>
+                        </a>
+                    </li>
+                </ul>
+            </div>
+        </nav>
+        <!--左侧导航结束-->
+        <!--右侧部分开始-->
+        <div id="page-wrapper" class="gray-bg dashbard-1">
+            <div class="row border-bottom">
+                <nav class="navbar navbar-static-top" role="navigation" style="margin-bottom: 0">
+                    <div class="navbar-header"><a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>
+                        {{--<form role="search" class="navbar-form-custom" method="post" action="search_results.html">--}}
+                            {{--<div class="form-group">--}}
+                                {{--<input type="text" placeholder="请输入您需要查找的内容 …" class="form-control" name="top-search" id="top-search">--}}
+                            {{--</div>--}}
+                        {{--</form>--}}
+                    </div>
+                    <ul class="nav navbar-top-links navbar-right">
+                        
+                        <li class="dropdown hidden-xs">
+                            <a class="right-sidebar-toggle" aria-expanded="false">
+                                <i class="fa fa-tasks"></i>
+                            </a>
+                        </li>
+                    </ul>
+                </nav>
+            </div>
+            <div class="row content-tabs">
+                <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
+                </button>
+                <nav class="page-tabs J_menuTabs">
+                    <div class="page-tabs-content">
+                        <a href="javascript:;" class="active J_menuTab" data-id="index_v1.html">首页</a>
+                    </div>
+                </nav>
+                <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>
+                </button>
+                <div class="btn-group roll-nav roll-right">
+                    <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span>
+
+                    </button>
+                    <ul role="menu" class="dropdown-menu dropdown-menu-right">
+                        <li class="J_tabShowActive"><a>定位当前选项卡</a>
+                        </li>
+                        <li class="divider"></li>
+                        <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
+                        </li>
+                        <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
+                        </li>
+                    </ul>
+                </div>
+                <a href="/teacher/logout" class="roll-nav roll-right J_tabExit"><i class="fa fa fa-sign-out"></i> 退出</a>
+            </div>
+            <div class="row J_mainContent" id="content-main">
+                <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="/teacher/Base/Index/welcome" frameborder="0" data-id="index_v1.html" seamless></iframe>
+            </div>
+            <div class="footer">
+                <div class="pull-right">&copy; 2014-2019 <a href="http://www.9026.com/" target="_blank">思维定制</a>
+                </div>
+            </div>
+        </div>
+        <!--右侧部分结束-->
+        <!--右侧边栏开始-->
+        <div id="right-sidebar">
+           
+        </div>
+        <!--右侧边栏结束-->
+    <!-- 全局js -->
+    <script src="/base/js/jquery-2.1.1.min.js?v={{config("sys.version")}}" ></script>
+    <script src="/base/js/bootstrap.min.js?v=3.4.0"></script>
+    <script src="/base/js/plugins/metisMenu/jquery.metisMenu.js?v={{config("sys.version")}}" ></script>
+    <script src="/base/js/plugins/slimscroll/jquery.slimscroll.min.js?v={{config("sys.version")}}" ></script>
+    <script src="/base/js/plugins/layer/layer.min.js?v={{config("sys.version")}}" ></script>
+
+    <!-- 自定义js -->
+    <script src="/base/js/hplus.min.js?v=3.2.0"></script>
+    <script type="text/javascript" src="/base/js/contabs.min.js?v={{config("sys.version")}}" ></script>
+
+    <!-- 第三方插件 -->
+    <script src="/base/js/plugins/pace/pace.min.js?v={{config("sys.version")}}" ></script>
+    
+    
+    
+</body>
+
+</html>

+ 1 - 0
resources/views/teacher/base/index/welcome.blade.php

xqd
@@ -0,0 +1 @@
+欢迎

+ 106 - 0
resources/views/teacher/check-cards/index.blade.php

xqd
@@ -0,0 +1,106 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $model_name . '记录' }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <form>
+                                <div class="col-sm-3 form-group">
+                                    <input type="text" class="form-control datepicker" name="begin_date" value="{{ request('begin_date') }}" placeholder="开始时间" autocomplete="off">
+                                </div>
+                                <div class="col-sm-3 form-group">
+                                    <input type="text" class="form-control datepicker" name="end_date" value="{{ request('end_date') }}" placeholder="截止时间" autocomplete="off">
+                                </div>
+                                <div class="col-sm-3 form-group">
+                                    <input type="text" class="form-control" name="keyword" value="{{ request('keyword') }}" placeholder="请输入学员/课程名搜索">
+                                </div>
+                                <div class="col-sm-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">搜索</button>
+                                </div>
+                            </form>
+                        </div>
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
+                            <thead>
+                                <tr>
+                                    <th>姓名</th>
+                                    <th>课程名称</th>
+                                    <th>开始打卡</th>
+                                    <th>结束打卡</th>
+                                    <th>累计时间</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                @if($list->count() <= 0)
+                                    <tr>
+                                        <td colspan="5" style="text-align: center;">暂无{{ $model_name }}</td>
+                                    </tr>
+                                @else
+                                    @foreach($list as $item)
+                                        <tr>
+                                            <td>{{ $item->student->name }}</td>
+                                            <td>{{ $item->course->name }}</td>
+                                            <td>{{ $item->begin_date_time }}</td>
+                                            <td>{{ $item->end_date_time }}</td>
+                                            <td>{{ $item->duration }}</td>
+                                        </tr>
+                                    @endforeach
+                                @endif
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-12">{{ $list->links() }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
+    <div class="modal-dialog">
+        <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
+            {{ csrf_field() }}
+
+            <input type="hidden" name="id" id="delete-input-id">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    <button type="submit" class="btn btn-danger">删除</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+    $('#sg-main-table').on('click', '.btn-delete', function () {
+        $('#delete-input-id').val($(this).attr('data-id'));
+        $('#delete-modal').modal('show');
+    });
+})
+</script>
+@endsection

+ 102 - 0
resources/views/teacher/leaves/index.blade.php

xqd
@@ -0,0 +1,102 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $model_name . '记录' }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-4">
+                                <form>
+                                    <div class="input-group">
+                                        <input type="text" value="{{ request('keyword') }}"	placeholder="请输入学员/课程名搜索" name="keyword" class="input-sm form-control">
+                                        <span class="input-group-btn">
+                                            <button type="submit" class="btn btn-sm btn-primary">搜索</button>
+                                        </span>
+                                    </div>
+                                </form>
+                            </div>
+                        </div>
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
+                            <thead>
+                                <tr>
+                                    <th>姓名</th>
+                                    <th>课程名称</th>
+                                    <th>请假日期</th>
+                                    <th>请假类型</th>
+                                    <th>说明</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                @if($list->count() <= 0)
+                                    <tr>
+                                        <td colspan="5" style="text-align: center;">暂无{{ $model_name }}</td>
+                                    </tr>
+                                @else
+                                    @foreach($list as $item)
+                                        <tr>
+                                            <td>{{ $item->student->name }}</td>
+                                            <td>{{ $item->course->name }}</td>
+                                            <td>{{ $item->date }}</td>
+                                            <td>{{ ($item->type == 1 ? '短假' : '长假') . $item->days . '天' }}</td>
+                                            <td>{{ $item->remark }}</td>
+                                        </tr>
+                                    @endforeach
+                                @endif
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-12">{{ $list->links() }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
+    <div class="modal-dialog">
+        <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
+            {{ csrf_field() }}
+
+            <input type="hidden" name="id" id="delete-input-id">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    <button type="submit" class="btn btn-danger">删除</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+    $('#sg-main-table').on('click', '.btn-delete', function () {
+        $('#delete-input-id').val($(this).attr('data-id'));
+        $('#delete-modal').modal('show');
+    });
+})
+</script>
+@endsection

+ 110 - 0
resources/views/teacher/students/courses/create.blade.php

xqd
@@ -0,0 +1,110 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ '添加' . $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-12 pull-right">
+                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                            </div>
+                        </div>
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'store' }}">
+                            {{ csrf_field() }}
+
+                            <input type="hidden" name="data[student_id]" value="{{ $student->id }}">
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">合同编号</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[number]" class="form-control" placeholder="请输入合同编号" value="{{ isset(old('data')['number']) ? old('data')['number'] : '' }}" required>
+                                </div>
+                                @if($errors->has('number'))
+                                    <span class="help-block">{{ $errors->first('number') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">课程种类</label>
+                                <div class="col-sm-8">
+                                    <select class="form-control" name="data[course_id]">
+                                        @foreach($courses as $course)
+                                            <option value="{{ $course->id }}" {{ isset(old('data')['course_id']) && old('data')['course_id'] == $course->id ? 'selected' : '' }}>{{ $course->name }}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                @if($errors->has('course_id'))
+                                    <span class="help-block">{{ $errors->first('course_id') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">报名日期</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[apply_date]" class="form-control datepicker" placeholder="请输入报名日期" value="{{ isset(old('data')['apply_date']) ? old('data')['apply_date'] : \Carbon\Carbon::now()->toDateString() }}" readonly>
+                                </div>
+                                @if($errors->has('apply_date'))
+                                    <span class="help-block">{{ $errors->first('apply_date') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">课程持续时间</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[duration]" class="form-control" placeholder="请输入课程持续时间" value="{{ isset(old('data')['duration']) ? old('data')['duration'] : '' }}">
+                                </div>
+                                @if($errors->has('duration'))
+                                    <span class="help-block">{{ $errors->first('duration') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">讲师分配</label>
+                                <div class="col-sm-8">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" class="sg-checkbox" id="check-all-teachers" name="assign_teacher" value="1">所有讲师
+                                    </label>
+                                    @foreach($teachers as $teacher)
+                                        <label class="checkbox-inline">
+                                            <input type="checkbox" class="sg-checkbox teachers-checkbox" name="teachers[]" value="{{ $teacher->id }}">{{ $teacher->name }}
+                                        </label>
+                                    @endforeach
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 111 - 0
resources/views/teacher/students/courses/edit.blade.php

xqd
@@ -0,0 +1,111 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ '编辑' . $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-12 pull-right">
+                                <a href="{{ $pre_uri . 'index?student_id=' . $item->student_id }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                            </div>
+                        </div>
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'update' }}">
+                            {{ csrf_field() }}
+
+                            <input type="hidden" name="id" value="{{ $item->id }}">
+                            <input type="hidden" name="data[student_id]" value="{{ $item->student_id }}">
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">合同编号</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[number]" class="form-control" placeholder="请输入合同编号" value="{{ $item->number }}" required>
+                                </div>
+                                @if($errors->has('number'))
+                                    <span class="help-block">{{ $errors->first('number') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">课程种类</label>
+                                <div class="col-sm-8">
+                                    <select class="form-control" name="data[course_id]">
+                                        @foreach($courses as $course)
+                                            <option value="{{ $course->id }}" {{ $item->course_id == $course->id ? 'selected' : '' }}>{{ $course->name }}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                @if($errors->has('course_id'))
+                                    <span class="help-block">{{ $errors->first('course_id') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">报名日期</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[apply_date]" class="form-control datepicker" placeholder="请输入报名日期" value="{{ $item->apply_date }}" readonly>
+                                </div>
+                                @if($errors->has('apply_date'))
+                                    <span class="help-block">{{ $errors->first('apply_date') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">课程持续时间</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[duration]" class="form-control" placeholder="请输入课程持续时间" value="{{ $item->duration }}">
+                                </div>
+                                @if($errors->has('duration'))
+                                    <span class="help-block">{{ $errors->first('duration') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">讲师分配</label>
+                                <div class="col-sm-8">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" class="sg-checkbox" id="check-all-teachers" name="assign_teacher" value="1" {{ $item->assign_teacher == 1 ? 'checked' : '' }}>所有讲师
+                                    </label>
+                                    @foreach($teachers as $teacher)
+                                        <label class="checkbox-inline">
+                                            <input type="checkbox" class="sg-checkbox teachers-checkbox" name="teachers[]" value="{{ $teacher->id }}" {{ $item->getTeacherIds()->contains($teacher->id) ? 'checked' : '' }}>{{ $teacher->name }}
+                                        </label>
+                                    @endforeach
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 112 - 0
resources/views/teacher/students/courses/index.blade.php

xqd
@@ -0,0 +1,112 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $student->name . '的' . $model_name . '列表' }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-4">
+                                <form>
+                                    <div class="input-group">
+                                        <input type="text" value="{{ request('keyword') }}"	placeholder="请输入课程名称" name="keyword" class="input-sm form-control">
+                                        <span class="input-group-btn">
+									        <button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								        </span>
+                                    </div>
+                                </form>
+                            </div>
+                            <div class="col-sm-8 pull-right">
+                                <a href="{{ $pre_uri . 'create?student_id=' . $student->id }}" class="btn btn-sm btn-primary pull-right">添加{{ $model_name }}</a>
+                            </div>
+                        </div>
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
+                            <thead>
+                                <tr>
+                                    <th>课程种类</th>
+                                    <th>报名日期</th>
+                                    <th>课程截止日期</th>
+                                    <th>课程剩余天数</th>
+                                    <th>讲师分配</th>
+                                    <th>操作</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                @if($list->count() <= 0)
+                                    <tr>
+                                        <td colspan="9" style="text-align: center;">暂无{{ $model_name }}</td>
+                                    </tr>
+                                @else
+                                    @foreach($list as $item)
+                                        <tr>
+                                            <td>{{ $item->course->name }}</td>
+                                            <td>{{ $item->apply_date }}</td>
+                                            <td>{{ $item->end_date }}</td>
+                                            <td>{{ $item->remain_days }}</td>
+                                            <td>{{ $item->getTeacherNames() }}</td>
+                                            <td>
+                                                <div class="btn-group">
+                                                    <a class="btn btn-sm btn-info btn-edit" href="{{ $pre_uri . 'edit?id=' . $item->id }}">编辑</a>
+                                                    <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                    @endforeach
+                                @endif
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-12">{{ $list->links() }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
+    <div class="modal-dialog">
+        <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
+            {{ csrf_field() }}
+
+            <input type="hidden" name="id" id="delete-input-id">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    <button type="submit" class="btn btn-danger">删除</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+    $('#sg-main-table').on('click', '.btn-delete', function () {
+        $('#delete-input-id').val($(this).attr('data-id'));
+        $('#delete-modal').modal('show');
+    });
+})
+</script>
+@endsection

+ 135 - 0
resources/views/teacher/students/create.blade.php

xqd
@@ -0,0 +1,135 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ '添加' . $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-12 pull-right">
+                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                            </div>
+                        </div>
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'store' }}">
+                            {{ csrf_field() }}
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">学员姓名</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[name]" class="form-control" placeholder="请输入学员姓名" value="{{ isset(old('data')['name']) ? old('data')['name'] : '' }}" required>
+                                </div>
+                                @if($errors->has('name'))
+                                    <span class="help-block">{{ $errors->first('name') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">年龄</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[age]" class="form-control" placeholder="请输入年龄" value="{{ isset(old('data')['age']) ? old('data')['age'] : '' }}" required>
+                                </div>
+                                @if($errors->has('age'))
+                                    <span class="help-block">{{ $errors->first('age') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">婚姻状况</label>
+                                <div class="col-sm-8">
+                                    <select name="data[marry]" class="form-control">
+                                        @foreach($model->getMarryList() as $marry)
+                                            <option value="{{ $marry['key'] }}" {{ isset(old('data')['marry']) && old('data')['marry'] == $marry['key'] ? 'selected' : '' }}>{{ $marry['show_value'] }}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                @if($errors->has('marry'))
+                                    <span class="help-block">{{ $errors->first('marry') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">职业</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[job]" class="form-control" placeholder="请输入职业" value="{{ isset(old('data')['job']) ? old('data')['job'] : '' }}">
+                                </div>
+                                @if($errors->has('job'))
+                                    <span class="help-block">{{ $errors->first('job') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">工作地点</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[work_addr]" class="form-control" placeholder="请输入工作地点" value="{{ isset(old('data')['work_addr']) ? old('data')['work_addr'] : '' }}">
+                                </div>
+                                @if($errors->has('work_addr'))
+                                    <span class="help-block">{{ $errors->first('work_addr') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">住址</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[addr]" class="form-control" placeholder="请输入住址" value="{{ isset(old('data')['addr']) ? old('data')['addr'] : '' }}">
+                                </div>
+                                @if($errors->has('addr'))
+                                    <span class="help-block">{{ $errors->first('addr') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">请假次数(短假)</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[short_leave_times]" class="form-control" placeholder="请输入请假次数(短假)" value="{{ isset(old('data')['short_leave_times']) ? old('data')['short_leave_times'] : '0' }}">
+                                </div>
+                                @if($errors->has('short_leave_times'))
+                                    <span class="help-block">{{ $errors->first('short_leave_times') }}</span>
+                                @endif
+                            </div>
+                            
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">请假次数(长假)</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[long_leave_times]" class="form-control" placeholder="请输入请假次数(长假)" value="{{ isset(old('data')['long_leave_times']) ? old('data')['long_leave_times'] : '0' }}">
+                                </div>
+                                @if($errors->has('long_leave_times'))
+                                    <span class="help-block">{{ $errors->first('long_leave_times') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 136 - 0
resources/views/teacher/students/edit.blade.php

xqd
@@ -0,0 +1,136 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ '编辑' . $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-12 pull-right">
+                                <a href="{{ $pre_uri . 'index' }}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+                            </div>
+                        </div>
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'update' }}">
+                            {{ csrf_field() }}
+
+                            <input type="hidden" name="id" value="{{ $item->id }}">
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">学员姓名</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[name]" class="form-control" placeholder="请输入学员姓名" value="{{ $item->name }}" required>
+                                </div>
+                                @if($errors->has('name'))
+                                    <span class="help-block">{{ $errors->first('name') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">年龄</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[age]" class="form-control" placeholder="请输入年龄" value="{{ $item->age }}" required>
+                                </div>
+                                @if($errors->has('age'))
+                                    <span class="help-block">{{ $errors->first('age') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">婚姻状况</label>
+                                <div class="col-sm-8">
+                                    <select name="data[marry]" class="form-control">
+                                        @foreach($model->getMarryList() as $marry)
+                                            <option value="{{ $marry['key'] }}" {{ $item->marry == $marry['key'] ? 'selected' : '' }}>{{ $marry['show_value'] }}</option>
+                                        @endforeach
+                                    </select>
+                                </div>
+                                @if($errors->has('marry'))
+                                    <span class="help-block">{{ $errors->first('marry') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">职业</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[job]" class="form-control" placeholder="请输入职业" value="{{ $item->job }}">
+                                </div>
+                                @if($errors->has('job'))
+                                    <span class="help-block">{{ $errors->first('job') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">工作地点</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[work_addr]" class="form-control" placeholder="请输入工作地点" value="{{ $item->work_addr }}">
+                                </div>
+                                @if($errors->has('work_addr'))
+                                    <span class="help-block">{{ $errors->first('work_addr') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">住址</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[addr]" class="form-control" placeholder="请输入住址" value="{{ $item->addr }}">
+                                </div>
+                                @if($errors->has('addr'))
+                                    <span class="help-block">{{ $errors->first('addr') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">请假次数(短假)</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[short_leave_times]" class="form-control" placeholder="请输入请假次数(短假)" value="{{ $item->short_leave_times }}">
+                                </div>
+                                @if($errors->has('short_leave_times'))
+                                    <span class="help-block">{{ $errors->first('short_leave_times') }}</span>
+                                @endif
+                            </div>
+                            
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">请假次数(长假)</label>
+                                <div class="col-sm-8">
+                                    <input type="text" name="data[long_leave_times]" class="form-control" placeholder="请输入请假次数(长假)" value="{{ $item->long_leave_times }}">
+                                </div>
+                                @if($errors->has('long_leave_times'))
+                                    <span class="help-block">{{ $errors->first('long_leave_times') }}</span>
+                                @endif
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">提交</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 118 - 0
resources/views/teacher/students/index.blade.php

xqd
@@ -0,0 +1,118 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $model_name . '列表' }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="row">
+                            <div class="col-sm-4">
+                                <form>
+                                    <div class="input-group">
+                                        <input type="text" value="{{ request('keyword') }}"	placeholder="请输入学员姓名" name="keyword" class="input-sm form-control">
+                                        <span class="input-group-btn">
+									        <button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								        </span>
+                                    </div>
+                                </form>
+                            </div>
+                            <div class="col-sm-8 pull-right">
+                                <a href="{{ $pre_uri . 'create' }}" class="btn btn-sm btn-primary pull-right">添加{{ $model_name }}</a>
+                            </div>
+                        </div>
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
+                            <thead>
+                                <tr>
+                                    <th>姓名</th>
+                                    <th>年龄</th>
+                                    <th>婚姻状况</th>
+                                    <th>职业</th>
+                                    <th>工作地点</th>
+                                    <th>住址</th>
+                                    <th colspan="2">请假次数</th>
+                                    <th>操作</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                @if($list->count() <= 0)
+                                    <tr>
+                                        <td colspan="9" style="text-align: center;">暂无{{ $model_name }}</td>
+                                    </tr>
+                                @else
+                                    @foreach($list as $item)
+                                        <tr>
+                                            <td>{{ $item->name }}</td>
+                                            <td>{{ $item->age }}</td>
+                                            <td>{{ $item->getMarry() }}</td>
+                                            <td>{{ $item->job }}</td>
+                                            <td>{{ $item->work_addr }}</td>
+                                            <td>{{ $item->addr }}</td>
+                                            <td>{{ empty($item->short_leave_times) ? 0 : $item->short_leave_times }}</td>
+                                            <td>{{ empty($item->long_leave_times) ? 0 : $item->long_leave_times }}</td>
+                                            <td>
+                                                <div class="btn-group">
+                                                    <a class="btn btn-sm btn-success btn-courses" href="{{ $pre_uri . 'Course/index?student_id=' . $item->id }}">课程</a>
+                                                    <a class="btn btn-sm btn-info btn-edit" href="{{ $pre_uri . 'edit?id=' . $item->id }}">编辑</a>
+                                                    <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                    @endforeach
+                                @endif
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-12">{{ $list->links() }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
+    <div class="modal-dialog">
+        <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
+            {{ csrf_field() }}
+
+            <input type="hidden" name="id" id="delete-input-id">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    <button type="submit" class="btn btn-danger">删除</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+    $('#sg-main-table').on('click', '.btn-delete', function () {
+        $('#delete-input-id').val($(this).attr('data-id'));
+        $('#delete-modal').modal('show');
+    });
+})
+</script>
+@endsection

+ 33 - 0
routes/teacher.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Route;
+
+Route::get('login', 'Auth\LoginController@showLoginForm')->name('teacher.login');
+Route::post('login','Auth\LoginController@login');
+Route::get('logout', 'Auth\LoginController@logout');
+
+
+Route::group(['middleware' => ['auth.teacher']], function() {
+
+    $uri =  request()->path();
+    $uri = str_replace('teacher/' ,'', $uri);
+    $uri = str_replace('teacher' ,'', $uri);
+    if ($uri == '') {
+        Route::any('/', ['as' => 'admin',
+            'uses' => 'Base\IndexController@index']);
+    } else {
+        $aUri = $baseUri = explode('/', $uri);
+        if (count($aUri) > 1) {
+            unset($aUri[count($aUri) - 1]);
+            $file = app_path() . '/Http/Controllers/Teacher/' . implode("/", $aUri) . "Controller.php";
+            if (file_exists($file)) {
+                $controller = implode("\\", $aUri) . "Controller";
+                $action = $controller . "@" . $baseUri[count($aUri)];
+                Route::any($uri, ['as' => 'teacher',
+                    'uses' => $action]);
+            }
+        }
+
+    }
+
+});