@@ -17,78 +17,78 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | public static function send($config) |
| 19 | 19 | { |
| 20 | - if(!empty($config['type'])){ |
|
| 21 | - if($config['type'] == 1) { //to a leader that member apply to join the group |
|
| 22 | - $messages = Message::where([ |
|
| 20 | + if (!empty($config['type'])) { |
|
| 21 | + if ($config['type']==1) { //to a leader that member apply to join the group |
|
| 22 | + $messages=Message::where([ |
|
| 23 | 23 | 'receiver' => $config['receiver'], |
| 24 | 24 | 'type' => $config['type'], |
| 25 | 25 | 'unread' => 1 |
| 26 | 26 | ])->get(); |
| 27 | - if(!empty($messages)) { |
|
| 28 | - foreach($messages as $message) { |
|
| 29 | - $data = json_decode($message->data,true); |
|
| 30 | - if($data['group']['gcode'] == $config['data']['group']['gcode']) { |
|
| 31 | - array_push($data['user'],$config['data']['user'][0]); |
|
| 32 | - $message->data = json_encode($data); |
|
| 27 | + if (!empty($messages)) { |
|
| 28 | + foreach ($messages as $message) { |
|
| 29 | + $data=json_decode($message->data, true); |
|
| 30 | + if ($data['group']['gcode']==$config['data']['group']['gcode']) { |
|
| 31 | + array_push($data['user'], $config['data']['user'][0]); |
|
| 32 | + $message->data=json_encode($data); |
|
| 33 | 33 | $message->save(); |
| 34 | 34 | return true; |
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | - }elseif ($config['type'] == 2) { //to a leader that member agree to join the group |
|
| 39 | - $messages = Message::where([ |
|
| 38 | + }elseif ($config['type']==2) { //to a leader that member agree to join the group |
|
| 39 | + $messages=Message::where([ |
|
| 40 | 40 | 'receiver' => $config['receiver'], |
| 41 | 41 | 'type' => $config['type'], |
| 42 | 42 | 'unread' => 1 |
| 43 | 43 | ])->get(); |
| 44 | - if(!empty($messages)) { |
|
| 45 | - foreach($messages as $message) { |
|
| 46 | - $data = json_decode($message->data,true); |
|
| 47 | - if($data['group'] == $config['data']['group']) { |
|
| 48 | - array_push($data['user'],$config['data']['user'][0]); |
|
| 49 | - $message->data = json_encode($data); |
|
| 44 | + if (!empty($messages)) { |
|
| 45 | + foreach ($messages as $message) { |
|
| 46 | + $data=json_decode($message->data, true); |
|
| 47 | + if ($data['group']==$config['data']['group']) { |
|
| 48 | + array_push($data['user'], $config['data']['user'][0]); |
|
| 49 | + $message->data=json_encode($data); |
|
| 50 | 50 | $message->save(); |
| 51 | 51 | return true; |
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | - }elseif ($config['type'] == 3) { //to a person that solution was passed |
|
| 56 | - $message = Message::where([ |
|
| 55 | + }elseif ($config['type']==3) { //to a person that solution was passed |
|
| 56 | + $message=Message::where([ |
|
| 57 | 57 | 'receiver' => $config['receiver'], |
| 58 | 58 | 'type' => $config['type'], |
| 59 | 59 | 'unread' => 1 |
| 60 | 60 | ])->first(); |
| 61 | - if(!empty($message)) { |
|
| 62 | - $data = json_decode($message->data,true); |
|
| 63 | - array_push($data,$config['data']); |
|
| 64 | - $message->data = json_encode($data); |
|
| 61 | + if (!empty($message)) { |
|
| 62 | + $data=json_decode($message->data, true); |
|
| 63 | + array_push($data, $config['data']); |
|
| 64 | + $message->data=json_encode($data); |
|
| 65 | 65 | $message->save(); |
| 66 | 66 | return true; |
| 67 | 67 | } |
| 68 | - }elseif ($config['type'] == 4) { //to a person that solution was blocked |
|
| 69 | - $message = Message::where([ |
|
| 68 | + }elseif ($config['type']==4) { //to a person that solution was blocked |
|
| 69 | + $message=Message::where([ |
|
| 70 | 70 | 'receiver' => $config['receiver'], |
| 71 | 71 | 'type' => $config['type'], |
| 72 | 72 | 'unread' => 1 |
| 73 | 73 | ])->first(); |
| 74 | - if(!empty($message)) { |
|
| 75 | - $data = json_decode($message->data,true); |
|
| 76 | - array_push($data,$config['data']); |
|
| 77 | - $message->data = json_encode($data); |
|
| 74 | + if (!empty($message)) { |
|
| 75 | + $data=json_decode($message->data, true); |
|
| 76 | + array_push($data, $config['data']); |
|
| 77 | + $message->data=json_encode($data); |
|
| 78 | 78 | $message->save(); |
| 79 | 79 | return true; |
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - $message = new Message; |
|
| 84 | - $message->sender = $config['sender']; |
|
| 85 | - $message->receiver = $config['receiver']; |
|
| 86 | - $message->title = $config['title']; |
|
| 87 | - if(isset($config['data']) && isset($config['type'])){ |
|
| 88 | - $message->type = $config['type'] ?? null; |
|
| 89 | - $message->data = json_encode($config['data']); |
|
| 90 | - }else{ |
|
| 91 | - $message->content = $config['content']; |
|
| 83 | + $message=new Message; |
|
| 84 | + $message->sender=$config['sender']; |
|
| 85 | + $message->receiver=$config['receiver']; |
|
| 86 | + $message->title=$config['title']; |
|
| 87 | + if (isset($config['data']) && isset($config['type'])) { |
|
| 88 | + $message->type=$config['type'] ?? null; |
|
| 89 | + $message->data=json_encode($config['data']); |
|
| 90 | + } else { |
|
| 91 | + $message->content=$config['content']; |
|
| 92 | 92 | } |
| 93 | 93 | /* |
| 94 | 94 | if(isset($config['reply'])){ |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $message->reply = $config['allow_reply']; |
| 99 | 99 | } |
| 100 | 100 | */ |
| 101 | - $message->official = 1; |
|
| 101 | + $message->official=1; |
|
| 102 | 102 | $message->save(); |
| 103 | 103 | return true; |
| 104 | 104 | } |
@@ -132,9 +132,9 @@ discard block |
||
| 132 | 132 | { |
| 133 | 133 | |
| 134 | 134 | return static::with('sender_user') |
| 135 | - ->where('receiver',$uid) |
|
| 136 | - ->orderBy('unread','desc') |
|
| 137 | - ->orderBy('updated_at','desc') |
|
| 135 | + ->where('receiver', $uid) |
|
| 136 | + ->orderBy('unread', 'desc') |
|
| 137 | + ->orderBy('updated_at', 'desc') |
|
| 138 | 138 | ->paginate(15); |
| 139 | 139 | } |
| 140 | 140 | |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | */ |
| 148 | 148 | public static function read($mid) |
| 149 | 149 | { |
| 150 | - $message = static::with('sender_user')->find($mid); |
|
| 151 | - if(!empty($message)){ |
|
| 152 | - $message->unread = 0; |
|
| 150 | + $message=static::with('sender_user')->find($mid); |
|
| 151 | + if (!empty($message)) { |
|
| 152 | + $message->unread=0; |
|
| 153 | 153 | $message->save(); |
| 154 | 154 | } |
| 155 | 155 | return $message; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public static function allRead($uid) |
| 166 | 166 | { |
| 167 | - return static::where('receiver',$uid) |
|
| 167 | + return static::where('receiver', $uid) |
|
| 168 | 168 | ->update(['unread' => 0]); |
| 169 | 169 | } |
| 170 | 170 | |
@@ -192,20 +192,20 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public static function remove($messages) |
| 194 | 194 | { |
| 195 | - $del_count = 0; |
|
| 196 | - if(is_array($messages)){ |
|
| 195 | + $del_count=0; |
|
| 196 | + if (is_array($messages)) { |
|
| 197 | 197 | foreach ($messages as $mid) { |
| 198 | - $message = static::find($mid); |
|
| 199 | - if(!empty($message)){ |
|
| 198 | + $message=static::find($mid); |
|
| 199 | + if (!empty($message)) { |
|
| 200 | 200 | $message->delete(); |
| 201 | - $del_count ++; |
|
| 201 | + $del_count++; |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | - }else{ |
|
| 205 | - $message = static::find($messages); |
|
| 206 | - if(!empty($message)){ |
|
| 204 | + } else { |
|
| 205 | + $message=static::find($messages); |
|
| 206 | + if (!empty($message)) { |
|
| 207 | 207 | $message->delete(); |
| 208 | - $del_count ++; |
|
| 208 | + $del_count++; |
|
| 209 | 209 | } |
| 210 | 210 | } |
| 211 | 211 | return $del_count; |
@@ -213,36 +213,36 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | public function getContentAttribute($value) |
| 215 | 215 | { |
| 216 | - if(!empty($this->type)){ |
|
| 217 | - $data = json_decode($this->data,true); |
|
| 218 | - $content = ''; |
|
| 219 | - if($this->type == 1) { |
|
| 220 | - foreach($data['user'] as $user) { |
|
| 221 | - $content .= "[{$user['name']}]({$user['url']}), "; |
|
| 216 | + if (!empty($this->type)) { |
|
| 217 | + $data=json_decode($this->data, true); |
|
| 218 | + $content=''; |
|
| 219 | + if ($this->type==1) { |
|
| 220 | + foreach ($data['user'] as $user) { |
|
| 221 | + $content.="[{$user['name']}]({$user['url']}), "; |
|
| 222 | 222 | } |
| 223 | - $content = substr($content,0,strlen($content)-2); |
|
| 224 | - $content .= " want to join your group [{$data['group']['name']}]({$data['group']['url']})"; |
|
| 223 | + $content=substr($content, 0, strlen($content)-2); |
|
| 224 | + $content.=" want to join your group [{$data['group']['name']}]({$data['group']['url']})"; |
|
| 225 | 225 | return $content; |
| 226 | - }elseif($this->type == 2) { |
|
| 227 | - foreach($data['user'] as $user) { |
|
| 228 | - $content .= "[{$user['name']}]({$user['url']}), "; |
|
| 226 | + }elseif ($this->type==2) { |
|
| 227 | + foreach ($data['user'] as $user) { |
|
| 228 | + $content.="[{$user['name']}]({$user['url']}), "; |
|
| 229 | 229 | } |
| 230 | - $content = substr($content,0,strlen($content)-2); |
|
| 231 | - $content .= " have agreed to join your group [{$data['group']['name']}]({$data['group']['url']})"; |
|
| 230 | + $content=substr($content, 0, strlen($content)-2); |
|
| 231 | + $content.=" have agreed to join your group [{$data['group']['name']}]({$data['group']['url']})"; |
|
| 232 | 232 | return $content; |
| 233 | 233 | } //todo |
| 234 | - }else{ |
|
| 234 | + } else { |
|
| 235 | 235 | return $value; |
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | public function sender_user() |
| 240 | 240 | { |
| 241 | - return $this->belongsTo('App\Models\Eloquent\User','sender','id'); |
|
| 241 | + return $this->belongsTo('App\Models\Eloquent\User', 'sender', 'id'); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | public function receiver_user() |
| 245 | 245 | { |
| 246 | - return $this->belongsTo('App\Models\Eloquent\User','receiver','id'); |
|
| 246 | + return $this->belongsTo('App\Models\Eloquent\User', 'receiver', 'id'); |
|
| 247 | 247 | } |
| 248 | 248 | } |
@@ -67,14 +67,14 @@ |
||
| 67 | 67 | ], |
| 68 | 68 | ]; |
| 69 | 69 | |
| 70 | - public static function getTheme($id){ |
|
| 71 | - if(!isset(self::$theme[$id])){ |
|
| 70 | + public static function getTheme($id) { |
|
| 71 | + if (!isset(self::$theme[$id])) { |
|
| 72 | 72 | return self::$theme['default']; |
| 73 | 73 | } |
| 74 | 74 | return self::$theme[$id]; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - public static function getAll(){ |
|
| 77 | + public static function getAll() { |
|
| 78 | 78 | return self::$theme; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -7,8 +7,8 @@ |
||
| 7 | 7 | |
| 8 | 8 | class ImageHosting extends Model |
| 9 | 9 | { |
| 10 | - protected $table = 'image_hostings'; |
|
| 11 | - protected $primaryKey = 'id'; |
|
| 10 | + protected $table='image_hostings'; |
|
| 11 | + protected $primaryKey='id'; |
|
| 12 | 12 | |
| 13 | 13 | protected $fillable=[ |
| 14 | 14 | 'user_id', 'relative_path' |
@@ -4,12 +4,12 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Socialite |
| 6 | 6 | { |
| 7 | - protected static $config=['github','aauth']; |
|
| 7 | + protected static $config=['github', 'aauth']; |
|
| 8 | 8 | |
| 9 | - public static function getAvailable(){ |
|
| 9 | + public static function getAvailable() { |
|
| 10 | 10 | $ret=[]; |
| 11 | - foreach(self::$config as $conf){ |
|
| 12 | - if(config("services.$conf.enable")){ |
|
| 11 | + foreach (self::$config as $conf) { |
|
| 12 | + if (config("services.$conf.enable")) { |
|
| 13 | 13 | $ret[]=$conf; |
| 14 | 14 | } |
| 15 | 15 | } |
@@ -7,16 +7,16 @@ |
||
| 7 | 7 | class AppSettings |
| 8 | 8 | { |
| 9 | 9 | public static function get($key, $default) { |
| 10 | - $ret = Setting::where(['key' => $key])->first(); |
|
| 11 | - if(blank($ret) || blank($ret->content)) { |
|
| 10 | + $ret=Setting::where(['key' => $key])->first(); |
|
| 11 | + if (blank($ret) || blank($ret->content)) { |
|
| 12 | 12 | return $default; |
| 13 | 13 | } |
| 14 | 14 | return $ret->is_json ? json_decode($ret->content) : $ret->content; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public static function set($key, $content) { |
| 18 | - $ret = Setting::where(['key' => $key])->first(); |
|
| 19 | - if(blank($ret)) { |
|
| 18 | + $ret=Setting::where(['key' => $key])->first(); |
|
| 19 | + if (blank($ret)) { |
|
| 20 | 20 | return Setting::create([ |
| 21 | 21 | 'key' => $key, |
| 22 | 22 | 'content' => $content, |
@@ -262,14 +262,14 @@ |
||
| 262 | 262 | ] |
| 263 | 263 | ]; |
| 264 | 264 | |
| 265 | - public static function getTheme($id){ |
|
| 266 | - if(!isset(self::$theme[$id])){ |
|
| 265 | + public static function getTheme($id) { |
|
| 266 | + if (!isset(self::$theme[$id])) { |
|
| 267 | 267 | return self::$theme['vs-dark']; |
| 268 | 268 | } |
| 269 | 269 | return self::$theme[$id]; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - public static function getAll(){ |
|
| 272 | + public static function getAll() { |
|
| 273 | 273 | return self::$theme; |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -22,39 +22,39 @@ discard block |
||
| 22 | 22 | public static function boot() |
| 23 | 23 | { |
| 24 | 24 | parent::boot(); |
| 25 | - static::saving(function ($model) { |
|
| 26 | - if( $model->custom_icon != "" && $model->custom_icon != null && $model->custom_icon[0] != "/" ) { |
|
| 27 | - $model->custom_icon = "/$model->custom_icon"; |
|
| 25 | + static::saving(function($model) { |
|
| 26 | + if ($model->custom_icon!="" && $model->custom_icon!=null && $model->custom_icon[0]!="/") { |
|
| 27 | + $model->custom_icon="/$model->custom_icon"; |
|
| 28 | 28 | } |
| 29 | - if( $model->img != "" && $model->img != null && $model->img[0] != "/" ) { |
|
| 30 | - $model->img = "/$model->img"; |
|
| 29 | + if ($model->img!="" && $model->img!=null && $model->img[0]!="/") { |
|
| 30 | + $model->img="/$model->img"; |
|
| 31 | 31 | } |
| 32 | 32 | }); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | //Repository function |
| 36 | - public function participants($ignore_frozen = true) |
|
| 36 | + public function participants($ignore_frozen=true) |
|
| 37 | 37 | { |
| 38 | - if($this->registration){ |
|
| 39 | - $participants = ContestParticipant::where('cid',$this->cid)->get(); |
|
| 38 | + if ($this->registration) { |
|
| 39 | + $participants=ContestParticipant::where('cid', $this->cid)->get(); |
|
| 40 | 40 | $participants->load('user'); |
| 41 | - $users = collect(); |
|
| 41 | + $users=collect(); |
|
| 42 | 42 | foreach ($participants as $participant) { |
| 43 | - $user = $participant->user; |
|
| 43 | + $user=$participant->user; |
|
| 44 | 44 | $users->add($user); |
| 45 | 45 | } |
| 46 | 46 | return $users->unique(); |
| 47 | - }else{ |
|
| 47 | + } else { |
|
| 48 | 48 | $this->load('submissions.user'); |
| 49 | - if($ignore_frozen){ |
|
| 50 | - $frozen_time = $this->frozen_time; |
|
| 51 | - $submissions = $this->submissions()->where('submission_date','<',$frozen_time)->get(); |
|
| 52 | - }else{ |
|
| 53 | - $submissions = $this->submissions; |
|
| 49 | + if ($ignore_frozen) { |
|
| 50 | + $frozen_time=$this->frozen_time; |
|
| 51 | + $submissions=$this->submissions()->where('submission_date', '<', $frozen_time)->get(); |
|
| 52 | + } else { |
|
| 53 | + $submissions=$this->submissions; |
|
| 54 | 54 | } |
| 55 | - $users = collect(); |
|
| 55 | + $users=collect(); |
|
| 56 | 56 | foreach ($submissions as $submission) { |
| 57 | - $user = $submission->user; |
|
| 57 | + $user=$submission->user; |
|
| 58 | 58 | $users->add($user); |
| 59 | 59 | } |
| 60 | 60 | return $users->unique(); |
@@ -64,18 +64,18 @@ discard block |
||
| 64 | 64 | // Repository/Service? function |
| 65 | 65 | public function rankRefresh() |
| 66 | 66 | { |
| 67 | - $ret = []; |
|
| 68 | - $participants = $this->participants(); |
|
| 69 | - $contest_problems = $this->problems; |
|
| 67 | + $ret=[]; |
|
| 68 | + $participants=$this->participants(); |
|
| 69 | + $contest_problems=$this->problems; |
|
| 70 | 70 | $contest_problems->load('problem'); |
| 71 | - if($this->rule == 1){ |
|
| 71 | + if ($this->rule==1) { |
|
| 72 | 72 | // ACM/ICPC Mode |
| 73 | 73 | foreach ($participants as $participant) { |
| 74 | 74 | $prob_detail=[]; |
| 75 | 75 | $totPen=0; |
| 76 | 76 | $totScore=0; |
| 77 | 77 | foreach ($contest_problems as $contest_problem) { |
| 78 | - $prob_stat = $contest_problem->userStatus($participant); |
|
| 78 | + $prob_stat=$contest_problem->userStatus($participant); |
|
| 79 | 79 | $prob_detail[]=[ |
| 80 | 80 | 'ncode'=>$contest_problem->ncode, |
| 81 | 81 | 'pid'=>$contest_problem->pid, |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | "problem_detail" => $prob_detail |
| 102 | 102 | ]; |
| 103 | 103 | } |
| 104 | - usort($ret, function ($a, $b) { |
|
| 104 | + usort($ret, function($a, $b) { |
|
| 105 | 105 | if ($a["score"]==$b["score"]) { |
| 106 | 106 | if ($a["penalty"]==$b["penalty"]) { |
| 107 | 107 | return 0; |
@@ -118,53 +118,53 @@ discard block |
||
| 118 | 118 | }); |
| 119 | 119 | Cache::tags(['contest', 'rank'])->put($this->cid, $ret, 60); |
| 120 | 120 | return $ret; |
| 121 | - }else{ |
|
| 121 | + } else { |
|
| 122 | 122 | // IO Mode |
| 123 | - $c = new OutdatedContestModel(); |
|
| 123 | + $c=new OutdatedContestModel(); |
|
| 124 | 124 | return $c->contestRankCache($this->cid); |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public function clarifications() |
| 129 | 129 | { |
| 130 | - return $this->hasMany('App\Models\Eloquent\ContestClarification','cid','cid'); |
|
| 130 | + return $this->hasMany('App\Models\Eloquent\ContestClarification', 'cid', 'cid'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public function problems() |
| 134 | 134 | { |
| 135 | - return $this->hasMany('App\Models\Eloquent\ContestProblem','cid','cid'); |
|
| 135 | + return $this->hasMany('App\Models\Eloquent\ContestProblem', 'cid', 'cid'); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | public function submissions() |
| 139 | 139 | { |
| 140 | - return $this->hasMany('App\Models\Eloquent\Submission','cid','cid'); |
|
| 140 | + return $this->hasMany('App\Models\Eloquent\Submission', 'cid', 'cid'); |
|
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | public function group() |
| 144 | 144 | { |
| 145 | - return $this->hasOne('App\Models\Eloquent\Group','gid','gid'); |
|
| 145 | + return $this->hasOne('App\Models\Eloquent\Group', 'gid', 'gid'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | public function getFrozenTimeAttribute() |
| 149 | 149 | { |
| 150 | - $end_time = strtotime($this->end_time); |
|
| 151 | - return $end_time - $this->froze_length; |
|
| 150 | + $end_time=strtotime($this->end_time); |
|
| 151 | + return $end_time-$this->froze_length; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | public function getIsEndAttribute() |
| 155 | 155 | { |
| 156 | - return strtotime($this->end_time) < time(); |
|
| 156 | + return strtotime($this->end_time)<time(); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | public static function getProblemSet($cid, $renderLatex=false) |
| 160 | 160 | { |
| 161 | 161 | $ret=[]; |
| 162 | - $problemset=ContestProblem::where('cid', $cid)->orderBy('number','asc')->get(); |
|
| 163 | - foreach($problemset as $problem){ |
|
| 162 | + $problemset=ContestProblem::where('cid', $cid)->orderBy('number', 'asc')->get(); |
|
| 163 | + foreach ($problemset as $problem) { |
|
| 164 | 164 | $problemDetail=ProblemModel::find($problem->pid); |
| 165 | 165 | $problemRet=(new OutdatedProblemModel())->detail($problemDetail->pcode); |
| 166 | - if ($renderLatex){ |
|
| 167 | - foreach (['description','input','output','note'] as $section){ |
|
| 166 | + if ($renderLatex) { |
|
| 167 | + foreach (['description', 'input', 'output', 'note'] as $section) { |
|
| 168 | 168 | $problemRet['parsed'][$section]=latex2Image($problemRet['parsed'][$section]); |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -178,6 +178,6 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | public function isJudgingComplete() |
| 180 | 180 | { |
| 181 | - return $this->submissions->whereIn('verdict',['Waiting','Pending'])->count()==0; |
|
| 181 | + return $this->submissions->whereIn('verdict', ['Waiting', 'Pending'])->count()==0; |
|
| 182 | 182 | } |
| 183 | 183 | } |
@@ -44,12 +44,12 @@ discard block |
||
| 44 | 44 | $users->add($user); |
| 45 | 45 | } |
| 46 | 46 | return $users->unique(); |
| 47 | - }else{ |
|
| 47 | + } else{ |
|
| 48 | 48 | $this->load('submissions.user'); |
| 49 | 49 | if($ignore_frozen){ |
| 50 | 50 | $frozen_time = $this->frozen_time; |
| 51 | 51 | $submissions = $this->submissions()->where('submission_date','<',$frozen_time)->get(); |
| 52 | - }else{ |
|
| 52 | + } else{ |
|
| 53 | 53 | $submissions = $this->submissions; |
| 54 | 54 | } |
| 55 | 55 | $users = collect(); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | }); |
| 119 | 119 | Cache::tags(['contest', 'rank'])->put($this->cid, $ret, 60); |
| 120 | 120 | return $ret; |
| 121 | - }else{ |
|
| 121 | + } else{ |
|
| 122 | 122 | // IO Mode |
| 123 | 123 | $c = new OutdatedContestModel(); |
| 124 | 124 | return $c->contestRankCache($this->cid); |
@@ -16,6 +16,6 @@ |
||
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function oj() { |
| 19 | - return $this->belongsTo('App\Models\Eloquent\OJ','oid','oid'); |
|
| 19 | + return $this->belongsTo('App\Models\Eloquent\OJ', 'oid', 'oid'); |
|
| 20 | 20 | } |
| 21 | 21 | } |
@@ -12,13 +12,13 @@ |
||
| 12 | 12 | protected $table='group_member'; |
| 13 | 13 | protected $primaryKey='gmid'; |
| 14 | 14 | |
| 15 | - protected $fillable = ['gid', 'uid', 'role', 'nick_name', 'sub_group', 'ranking']; |
|
| 15 | + protected $fillable=['gid', 'uid', 'role', 'nick_name', 'sub_group', 'ranking']; |
|
| 16 | 16 | |
| 17 | 17 | public function user() { |
| 18 | - return $this->belongsTo('App\Models\Eloquent\User','uid','id'); |
|
| 18 | + return $this->belongsTo('App\Models\Eloquent\User', 'uid', 'id'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | public function group() { |
| 22 | - return $this->belongsTo('App\Models\Eloquent\Group','gid','gid'); |
|
| 22 | + return $this->belongsTo('App\Models\Eloquent\Group', 'gid', 'gid'); |
|
| 23 | 23 | } |
| 24 | 24 | } |