Beispiel #1
0
 public function AddBar($input)
 {
     $addbar = new Bar();
     foreach ($input as $index => $value) {
         $addbar->{$index} = $value;
     }
     $addbar->save();
     return $addbar->barid;
 }
 public function getlist(User $User, Bar $bar)
 {
     if (!isset($input['email'])) {
         return response('請輸入帳號', '403');
     } elseif (!isset($input['passwd'])) {
         return response('請輸入密碼', '403');
     }
     if ($User->CheckMember($input['email'], $input['passwd'])) {
         $baridlist = $bar->GetList($User->GetUserId);
         $baridlist->status = "success";
         return response()->json($baridlist);
     }
 }
Beispiel #3
0
 public function alertBar($barid, $action, $new_cron)
 {
     $bar = Bar::findOrFail($barid);
     $cron = $bar->alertdefine;
     switch ($action) {
         case 'add':
             if (empty($cron)) {
                 $bar->alertdefine = $new_cron;
             } else {
                 $bar->alertdefine = $cron . ',' . $new_cron;
             }
             break;
         case 'del':
             $bar->alertdefine = null;
             break;
         case 'replace':
             $bar->alertdefine = $new_cron;
             break;
     }
     $bar->save();
     return true;
 }