}
     });
     // 執行刪除職稱
     Route::get('/delete_title/{titleId}', function ($titleId) {
         $title = Title::find($titleId);
         $message = '刪除《' . $title->title_name . '》完成';
         $title->delete();
         return Redirect::to('account/')->with('message', $message);
     });
 });
 /**
  * 班級、年級管理
  */
 Route::group(array('prefix' => 'class_year', 'before' => 'auth'), function () {
     // 讀取年級列表
     $GLOBALS['yearList'] = Year::orderBy('year_name')->get();
     // 顯示年級列表、年級新增表單
     Route::get('/', function () {
         return View::make('class_year')->with(array('yearList' => $GLOBALS['yearList'], 'year' => NULL));
     });
     // 執行新增年級
     Route::post('/add_year', function () {
         $validator = FormValidator::year(Input::all());
         if ($validator->fails()) {
             return Redirect::to('/class_year')->withInput()->withErrors($validator)->with('message', '輸入錯誤,請檢查');
         } else {
             $data = Input::all();
             if (Year::create($data)) {
                 $message = '新增年級《' . $data['year_name'] . '》完成';
             } else {
                 $message = '資料寫入錯誤';
Example #2
0
 public function getHistory()
 {
     $years = Year::orderBy('year', 'desc')->get();
     return View::make('home.history')->with('years', $years);
 }
Example #3
0
 public function get_show($id)
 {
     $executive = Executive::find($id);
     $years = Year::orderBy('year', 'desc')->get();
     return View::make('executives.show')->with('executive', $executive)->with('years', $years);
 }
Example #4
0
 public function get_index()
 {
     $years = Year::orderBy('year', 'desc')->get();
     return View::make('years.index', array('years' => $years, 'user' => Auth::user()));
 }