コード例 #1
0
ファイル: Admin.php プロジェクト: attackpoint10/ubr
 public function setupDel(Request $request)
 {
     $validator = Validator::make($request->all(), ['table' => 'required', 'id' => 'required']);
     if ($validator->fails()) {
         return 'false';
     } else {
         switch (strtolower($request->get('table'))) {
             case 'cate':
                 SetupCate::find($request->get('id'))->delete();
                 SetupKind::where('idCate', $request->get('id'))->delete();
                 SetupValue::where('idCate', $request->get('id'))->delete();
                 break;
             case 'kind':
                 SetupKind::find($request->get('id'))->delete();
                 SetupValue::where('idKind', $request->get('id'))->delete();
                 break;
             case 'value':
                 SetupValue::find($request->get('id'))->delete();
                 break;
         }
         return $request->get('id');
     }
 }
コード例 #2
0
ファイル: Admin.php プロジェクト: komphet5139/ubr
 public function setupDel(Request $request)
 {
     $validator = Validator::make($request->all(), ['table' => 'required', 'id' => 'required']);
     if ($validator->fails()) {
         return 'false';
     } else {
         switch (strtolower($request->get('table'))) {
             case 'cate':
                 SetupCate::find($request->get('id'))->delete();
                 SetupKind::where('idCate', $request->get('id'))->delete();
                 SetupValue::where('idCate', $request->get('id'))->delete();
                 break;
             case 'kind':
                 SetupKind::find($request->get('id'))->delete();
                 SetupValue::where('idKind', $request->get('id'))->delete();
                 break;
             case 'value':
                 SetupValue::find($request->get('id'))->delete();
                 break;
         }
         $log = new Log();
         $log->memberId = Auth::user()->id;
         $log->detail = 'Delete Setup table = ' . strtolower($request->get('table')) . ', id =' . trim($request->get('id'));
         $log->save();
         return $request->get('id');
     }
 }