@@ -13,10 +13,10 @@ |
||
13 | 13 | protected $primaryKey='gmid'; |
14 | 14 | |
15 | 15 | public function user() { |
16 | - return $this->belongsTo('App\Models\Eloquent\UserModel','uid','id'); |
|
16 | + return $this->belongsTo('App\Models\Eloquent\UserModel', 'uid', 'id'); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function group() { |
20 | - return $this->belongsTo('App\Models\Eloquent\Group','gid','gid'); |
|
20 | + return $this->belongsTo('App\Models\Eloquent\Group', 'gid', 'gid'); |
|
21 | 21 | } |
22 | 22 | } |
@@ -9,13 +9,13 @@ |
||
9 | 9 | { |
10 | 10 | use SoftDeletes; |
11 | 11 | |
12 | - protected $fillable = ['group_id', 'abuse_id', 'reason', 'removed_at']; |
|
12 | + protected $fillable=['group_id', 'abuse_id', 'reason', 'removed_at']; |
|
13 | 13 | |
14 | 14 | public function abuse() { |
15 | 15 | return $this->belongsTo('\App\Models\Eloquent\Abuse'); |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function group() { |
19 | - return $this->belongsTo('\App\Models\Eloquent\Group',null,'gid'); |
|
19 | + return $this->belongsTo('\App\Models\Eloquent\Group', null, 'gid'); |
|
20 | 20 | } |
21 | 21 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | public function canPass() |
28 | 28 | { |
29 | 29 | $tot=0; |
30 | - foreach($this->problems->sortBy('order') as $problem){ |
|
30 | + foreach ($this->problems->sortBy('order') as $problem) { |
|
31 | 31 | $problem=$problem->problem; |
32 | 32 | $tot+=$problem->problem_status['color']=='wemd-green-text'; |
33 | 33 | } |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | |
42 | 42 | public function getAvailabilityAttribute() |
43 | 43 | { |
44 | - foreach(explode(',', $this->precondition) as $dojo_id){ |
|
45 | - if(blank($dojo_id)) continue; |
|
46 | - if(!DojoPass::isPassed($dojo_id)) return 'locked'; |
|
44 | + foreach (explode(',', $this->precondition) as $dojo_id) { |
|
45 | + if (blank($dojo_id)) continue; |
|
46 | + if (!DojoPass::isPassed($dojo_id)) return 'locked'; |
|
47 | 47 | } |
48 | - return $this->passed?'passed':'available'; |
|
48 | + return $this->passed ? 'passed' : 'available'; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | } |
@@ -26,9 +26,9 @@ |
||
26 | 26 | |
27 | 27 | public static function isPassed($dojo_id) |
28 | 28 | { |
29 | - return Auth::check()?self::where([ |
|
29 | + return Auth::check() ?self::where([ |
|
30 | 30 | "dojo_id"=>$dojo_id, |
31 | 31 | "user_id"=>Auth::user()->id, |
32 | - ])->count()>0:false; |
|
32 | + ])->count()>0 : false; |
|
33 | 33 | } |
34 | 34 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | public function members() |
12 | 12 | { |
13 | - return $this->hasMany('App\Models\Eloquent\GroupMember', 'gid','gid'); |
|
13 | + return $this->hasMany('App\Models\Eloquent\GroupMember', 'gid', 'gid'); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public function banneds() |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | |
21 | 21 | public function getLeaderAttribute() |
22 | 22 | { |
23 | - return $this->members()->where('role',3)->first()->user; |
|
23 | + return $this->members()->where('role', 3)->first()->user; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | public function getLinkAttribute() |
27 | 27 | { |
28 | - return route('group.detail',['gcode' => $this->gcode]); |
|
28 | + return route('group.detail', ['gcode' => $this->gcode]); |
|
29 | 29 | } |
30 | 30 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | { |
10 | 10 | use SoftDeletes; |
11 | 11 | |
12 | - protected $fillable = ['user_id', 'abuse_id', 'reason', 'removed_at']; |
|
12 | + protected $fillable=['user_id', 'abuse_id', 'reason', 'removed_at']; |
|
13 | 13 | |
14 | 14 | public function abuse() { |
15 | 15 | return $this->belongsTo('\App\Models\Eloquent\Abuse'); |
@@ -17,7 +17,7 @@ |
||
17 | 17 | |
18 | 18 | public function fetch() |
19 | 19 | { |
20 | - $list=DB::table($this->table)->orderBy('created_at','desc')->get()->all(); |
|
20 | + $list=DB::table($this->table)->orderBy('created_at', 'desc')->get()->all(); |
|
21 | 21 | if (empty($list)) { |
22 | 22 | return []; |
23 | 23 | } |
@@ -9,12 +9,12 @@ |
||
9 | 9 | { |
10 | 10 | public static function info($ltxsource, $type="png") |
11 | 11 | { |
12 | - if(!in_array($type,['png','svg'])) return []; |
|
12 | + if (!in_array($type, ['png', 'svg'])) return []; |
|
13 | 13 | $url=route("latex.$type", ['ltxsource' => $ltxsource]); |
14 | - $image = new Imagick(); |
|
14 | + $image=new Imagick(); |
|
15 | 15 | $image->readImageBlob(Storage::get('latex-svg/'.urlencode($ltxsource).'.svg')); |
16 | - $width = $image->getImageWidth(); |
|
17 | - $height = $image->getImageHeight(); |
|
18 | - return [$url,$width/5,$height/5]; |
|
16 | + $width=$image->getImageWidth(); |
|
17 | + $height=$image->getImageHeight(); |
|
18 | + return [$url, $width / 5, $height / 5]; |
|
19 | 19 | } |
20 | 20 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @var string |
16 | 16 | */ |
17 | - protected $signature = 'babel:crawl |
|
17 | + protected $signature='babel:crawl |
|
18 | 18 | {extension : The package name of the extension} |
19 | 19 | {--action=crawl_problem : The action of the Crawler} |
20 | 20 | {--con=all : The target problemset of the Crawler} |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @var string |
28 | 28 | */ |
29 | - protected $description = 'Crawl problems for a given Babel Extension to NOJ'; |
|
29 | + protected $description='Crawl problems for a given Babel Extension to NOJ'; |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Create a new command instance. |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function handle() |
47 | 47 | { |
48 | - $extension = $this->argument('extension'); |
|
49 | - $action = $this->option('action'); |
|
50 | - $con = $this->option('con'); |
|
51 | - [$from, $to] = sscanf($this->option('range'),"%d:%d"); |
|
52 | - $cached = $this->option('cached'); |
|
48 | + $extension=$this->argument('extension'); |
|
49 | + $action=$this->option('action'); |
|
50 | + $con=$this->option('con'); |
|
51 | + [$from, $to]=sscanf($this->option('range'), "%d:%d"); |
|
52 | + $cached=$this->option('cached'); |
|
53 | 53 | $babel=new Babel(); |
54 | 54 | $babel->crawl([ |
55 | 55 | "name" => $extension, |