@@ -70,7 +70,7 @@ discard block  | 
                                                    ||
| 70 | 70 | |
| 71 | 71 | // Fills the list of allowed show ids.  | 
                                                        
| 72 | 72 |                      foreach ($shows as $show) { | 
                                                        
| 73 | -                        if ($user->hasAccess(['cosmicradiotv.podcast.access_show_' . $show->slug])) { | 
                                                        |
| 73 | +                        if ($user->hasAccess(['cosmicradiotv.podcast.access_show_'.$show->slug])) { | 
                                                        |
| 74 | 74 | $show_ids_allowed[] = $show->id;  | 
                                                        
| 75 | 75 | }  | 
                                                        
| 76 | 76 | }  | 
                                                        
@@ -118,9 +118,9 @@ discard block  | 
                                                    ||
| 118 | 118 | // Add the permissions for individual shows  | 
                                                        
| 119 | 119 | $shows = Show::all();  | 
                                                        
| 120 | 120 |          foreach ($shows as $show) { | 
                                                        
| 121 | - $permissions['cosmicradiotv.podcast.access_show_' . $show->slug] = [  | 
                                                        |
| 121 | + $permissions['cosmicradiotv.podcast.access_show_'.$show->slug] = [  | 
                                                        |
| 122 | 122 | 'tab' => 'cosmicradiotv.podcast::lang.permissions.tab_labels.shows',  | 
                                                        
| 123 | -                'label' => e(trans('cosmicradiotv.podcast::lang.permissions.labels.access_show')) . ' ' . $show->name | 
                                                        |
| 123 | +                'label' => e(trans('cosmicradiotv.podcast::lang.permissions.labels.access_show')).' '.$show->name | 
                                                        |
| 124 | 124 | ];  | 
                                                        
| 125 | 125 | }  | 
                                                        
| 126 | 126 | |
@@ -30,9 +30,9 @@  | 
                                                    ||
| 30 | 30 | $table->primary(['episode_id', 'tag_id']);  | 
                                                        
| 31 | 31 | |
| 32 | 32 |                  $table->foreign('episode_id')->references('id')->on('cosmicradiotv_podcast_episodes') | 
                                                        
| 33 | -                      ->onUpdate('cascade')->onDelete('cascade'); | 
                                                        |
| 33 | +                        ->onUpdate('cascade')->onDelete('cascade'); | 
                                                        |
| 34 | 34 |                  $table->foreign('tag_id')->references('id')->on('cosmicradiotv_podcast_tags') | 
                                                        
| 35 | -                      ->onUpdate('cascade')->onDelete('cascade'); | 
                                                        |
| 35 | +                        ->onUpdate('cascade')->onDelete('cascade'); | 
                                                        |
| 36 | 36 | });  | 
                                                        
| 37 | 37 | });  | 
                                                        
| 38 | 38 | }  | 
                                                        
@@ -30,7 +30,7 @@  | 
                                                    ||
| 30 | 30 | $table->timestamps();  | 
                                                        
| 31 | 31 | |
| 32 | 32 |                  $table->foreign('show_id')->references('id')->on('cosmicradiotv_podcast_shows') | 
                                                        
| 33 | -                      ->onUpdate('cascade'); | 
                                                        |
| 33 | +                        ->onUpdate('cascade'); | 
                                                        |
| 34 | 34 | $table->unique(['show_id', 'slug']);  | 
                                                        
| 35 | 35 | });  | 
                                                        
| 36 | 36 | });  | 
                                                        
@@ -36,9 +36,9 @@  | 
                                                    ||
| 36 | 36 | $table->timestamps();  | 
                                                        
| 37 | 37 | |
| 38 | 38 |                  $table->foreign('episode_id')->references('id')->on('cosmicradiotv_podcast_episodes') | 
                                                        
| 39 | -                      ->onUpdate('cascade'); | 
                                                        |
| 39 | +                        ->onUpdate('cascade'); | 
                                                        |
| 40 | 40 |                  $table->foreign('release_type_id')->references('id')->on('cosmicradiotv_podcast_release_types') | 
                                                        
| 41 | -                      ->onUpdate('cascade'); | 
                                                        |
| 41 | +                        ->onUpdate('cascade'); | 
                                                        |
| 42 | 42 | |
| 43 | 43 | });  | 
                                                        
| 44 | 44 | });  | 
                                                        
@@ -14,7 +14,7 @@  | 
                                                    ||
| 14 | 14 | */  | 
                                                        
| 15 | 15 | public function up()  | 
                                                        
| 16 | 16 |      { | 
                                                        
| 17 | -        DB::transaction(function() { | 
                                                        |
| 17 | +        DB::transaction(function () { | 
                                                        |
| 18 | 18 |              Schema::create('cosmicradiotv_podcast_release_types', function (Blueprint $table) { | 
                                                        
| 19 | 19 | $table->engine = 'InnoDB';  | 
                                                        
| 20 | 20 |                  $table->increments('id'); | 
                                                        
@@ -7,7 +7,8 @@  | 
                                                    ||
| 7 | 7 | use October\Rain\Database\Updates\Migration;  | 
                                                        
| 8 | 8 | use Schema;  | 
                                                        
| 9 | 9 | |
| 10 | -class CreateReleasesTable extends Migration { | 
                                                        |
| 10 | +class CreateReleasesTable extends Migration  | 
                                                        |
| 11 | +{ | 
                                                        |
| 11 | 12 | |
| 12 | 13 | /**  | 
                                                        
| 13 | 14 | * Migration  | 
                                                        
@@ -9,29 +9,29 @@  | 
                                                    ||
| 9 | 9 | |
| 10 | 10 | class AddSortOrderToReleaseTypes extends Migration  | 
                                                        
| 11 | 11 |  { | 
                                                        
| 12 | - /**  | 
                                                        |
| 13 | - * Migration  | 
                                                        |
| 14 | - */  | 
                                                        |
| 15 | - public function up()  | 
                                                        |
| 16 | -	{ | 
                                                        |
| 17 | -		DB::transaction(function() { | 
                                                        |
| 18 | -			Schema::table('cosmicradiotv_podcast_release_types', function (Blueprint $table) { | 
                                                        |
| 19 | -				$table->unsignedInteger('sort_order'); | 
                                                        |
| 20 | - });  | 
                                                        |
| 21 | - });  | 
                                                        |
| 22 | - }  | 
                                                        |
| 12 | + /**  | 
                                                        |
| 13 | + * Migration  | 
                                                        |
| 14 | + */  | 
                                                        |
| 15 | + public function up()  | 
                                                        |
| 16 | +    { | 
                                                        |
| 17 | +        DB::transaction(function() { | 
                                                        |
| 18 | +            Schema::table('cosmicradiotv_podcast_release_types', function (Blueprint $table) { | 
                                                        |
| 19 | +                $table->unsignedInteger('sort_order'); | 
                                                        |
| 20 | + });  | 
                                                        |
| 21 | + });  | 
                                                        |
| 22 | + }  | 
                                                        |
| 23 | 23 | |
| 24 | - /**  | 
                                                        |
| 25 | - * Rollback  | 
                                                        |
| 26 | - */  | 
                                                        |
| 27 | - public function down()  | 
                                                        |
| 28 | -	{ | 
                                                        |
| 29 | -		DB::transaction(function() { | 
                                                        |
| 30 | -			Schema::table('cosmicradiotv_podcast_release_types', function (Blueprint $table) { | 
                                                        |
| 31 | - $table->dropColumn([  | 
                                                        |
| 32 | - 'sort_order',  | 
                                                        |
| 33 | - ]);  | 
                                                        |
| 34 | - });  | 
                                                        |
| 35 | - });  | 
                                                        |
| 36 | - }  | 
                                                        |
| 24 | + /**  | 
                                                        |
| 25 | + * Rollback  | 
                                                        |
| 26 | + */  | 
                                                        |
| 27 | + public function down()  | 
                                                        |
| 28 | +    { | 
                                                        |
| 29 | +        DB::transaction(function() { | 
                                                        |
| 30 | +            Schema::table('cosmicradiotv_podcast_release_types', function (Blueprint $table) { | 
                                                        |
| 31 | + $table->dropColumn([  | 
                                                        |
| 32 | + 'sort_order',  | 
                                                        |
| 33 | + ]);  | 
                                                        |
| 34 | + });  | 
                                                        |
| 35 | + });  | 
                                                        |
| 36 | + }  | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | \ No newline at end of file  | 
                                                        
@@ -14,7 +14,7 @@ discard block  | 
                                                    ||
| 14 | 14 | */  | 
                                                        
| 15 | 15 | public function up()  | 
                                                        
| 16 | 16 |  	{ | 
                                                        
| 17 | -		DB::transaction(function() { | 
                                                        |
| 17 | +		DB::transaction(function () { | 
                                                        |
| 18 | 18 |  			Schema::table('cosmicradiotv_podcast_release_types', function (Blueprint $table) { | 
                                                        
| 19 | 19 |  				$table->unsignedInteger('sort_order'); | 
                                                        
| 20 | 20 | });  | 
                                                        
@@ -26,7 +26,7 @@ discard block  | 
                                                    ||
| 26 | 26 | */  | 
                                                        
| 27 | 27 | public function down()  | 
                                                        
| 28 | 28 |  	{ | 
                                                        
| 29 | -		DB::transaction(function() { | 
                                                        |
| 29 | +		DB::transaction(function () { | 
                                                        |
| 30 | 30 |  			Schema::table('cosmicradiotv_podcast_release_types', function (Blueprint $table) { | 
                                                        
| 31 | 31 | $table->dropColumn([  | 
                                                        
| 32 | 32 | 'sort_order',  | 
                                                        
@@ -33,7 +33,7 @@  | 
                                                    ||
| 33 | 33 |          $this->addCss('/plugins/cosmicradiotv/podcast/assets/stylesheet/release_type_sort.css'); | 
                                                        
| 34 | 34 | |
| 35 | 35 |          $this->pageTitle = e(trans('cosmicradiotv.podcast::lang.release_type.reorder')); | 
                                                        
| 36 | -        $this->vars['records'] = ReleaseType::query()->orderBy('sort_order','asc')->get(); | 
                                                        |
| 36 | +        $this->vars['records'] = ReleaseType::query()->orderBy('sort_order', 'asc')->get(); | 
                                                        |
| 37 | 37 | }  | 
                                                        
| 38 | 38 | |
| 39 | 39 | public function onSaveOrder()  | 
                                                        
@@ -6,8 +6,8 @@  | 
                                                    ||
| 6 | 6 | use CosmicRadioTV\Podcast\Models\Episode;  | 
                                                        
| 7 | 7 | use CosmicRadioTV\Podcast\Models\Show;  | 
                                                        
| 8 | 8 | /**  | 
                                                        
| 9 | - * Episodes Back-end Controller  | 
                                                        |
| 10 | - */  | 
                                                        |
| 9 | + * Episodes Back-end Controller  | 
                                                        |
| 10 | + */  | 
                                                        |
| 11 | 11 | class Episodes extends Controller  | 
                                                        
| 12 | 12 |  { | 
                                                        
| 13 | 13 | public $implement = [  | 
                                                        
@@ -59,7 +59,7 @@  | 
                                                    ||
| 59 | 59 | }  | 
                                                        
| 60 | 60 | }  | 
                                                        
| 61 | 61 | |
| 62 | -            $query->whereIn('show_id',$show_ids_allowed); | 
                                                        |
| 62 | +            $query->whereIn('show_id', $show_ids_allowed); | 
                                                        |
| 63 | 63 | }  | 
                                                        
| 64 | 64 | |
| 65 | 65 | }  | 
                                                        
@@ -34,8 +34,9 @@ discard block  | 
                                                    ||
| 34 | 34 |          if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) { | 
                                                        
| 35 | 35 | |
| 36 | 36 |              foreach ($checkedIds as $episodeId) { | 
                                                        
| 37 | - if (!$episode = Episode::find($episodeId))  | 
                                                        |
| 38 | - continue;  | 
                                                        |
| 37 | +                if (!$episode = Episode::find($episodeId)) { | 
                                                        |
| 38 | + continue;  | 
                                                        |
| 39 | + }  | 
                                                        |
| 39 | 40 | |
| 40 | 41 | $episode->delete();  | 
                                                        
| 41 | 42 | }  | 
                                                        
@@ -46,7 +47,8 @@ discard block  | 
                                                    ||
| 46 | 47 | return $this->listRefresh();  | 
                                                        
| 47 | 48 | }  | 
                                                        
| 48 | 49 | |
| 49 | -    public function listExtendQuery($query, $definition = null) { | 
                                                        |
| 50 | + public function listExtendQuery($query, $definition = null)  | 
                                                        |
| 51 | +    { | 
                                                        |
| 50 | 52 | $user = BackendAuth::getUser();  | 
                                                        
| 51 | 53 | |
| 52 | 54 |          if (!$user->hasAccess(['cosmicradiotv.podcast.access_episodes_all'])) { | 
                                                        
@@ -49,7 +49,7 @@  | 
                                                    ||
| 49 | 49 | */  | 
                                                        
| 50 | 50 | |
| 51 | 51 | public $hasMany = [  | 
                                                        
| 52 | - 'releases' => ['CosmicRadioTV\Podcast\Models\Release','delete' => 'true'],  | 
                                                        |
| 52 | + 'releases' => ['CosmicRadioTV\Podcast\Models\Release', 'delete' => 'true'],  | 
                                                        |
| 53 | 53 | ];  | 
                                                        
| 54 | 54 | |
| 55 | 55 | |
@@ -130,9 +130,9 @@ discard block  | 
                                                    ||
| 130 | 130 |      public function next($ofShow = false) { | 
                                                        
| 131 | 131 | $query = self::query();  | 
                                                        
| 132 | 132 |          if ($ofShow) { | 
                                                        
| 133 | -            $query = $query->where('show_id',$this->show_id); | 
                                                        |
| 133 | +            $query = $query->where('show_id', $this->show_id); | 
                                                        |
| 134 | 134 | }  | 
                                                        
| 135 | -        return $query->where('published',true)->where('release','>',$this->release)->orderBy('release','asc')->take(1)->get()->first(); | 
                                                        |
| 135 | +        return $query->where('published', true)->where('release', '>', $this->release)->orderBy('release', 'asc')->take(1)->get()->first(); | 
                                                        |
| 136 | 136 | }  | 
                                                        
| 137 | 137 | /**  | 
                                                        
| 138 | 138 | * Returns the previous episode  | 
                                                        
@@ -142,9 +142,9 @@ discard block  | 
                                                    ||
| 142 | 142 |      public function previous($ofShow = false) { | 
                                                        
| 143 | 143 | $query = self::query();  | 
                                                        
| 144 | 144 |          if ($ofShow) { | 
                                                        
| 145 | -            $query = $query->where('show_id',$this->show_id); | 
                                                        |
| 145 | +            $query = $query->where('show_id', $this->show_id); | 
                                                        |
| 146 | 146 | }  | 
                                                        
| 147 | -        return $query->where('published',true)->where('release','<',$this->release)->orderBy('release','desc')->take(1)->get()->first(); | 
                                                        |
| 147 | +        return $query->where('published', true)->where('release', '<', $this->release)->orderBy('release', 'desc')->take(1)->get()->first(); | 
                                                        |
| 148 | 148 | }  | 
                                                        
| 149 | 149 | |
| 150 | 150 | /**  | 
                                                        
@@ -172,7 +172,7 @@ discard block  | 
                                                    ||
| 172 | 172 |                  if (starts_with($rulePart, 'unique')) { | 
                                                        
| 173 | 173 | // Has format up to current instance's ID  | 
                                                        
| 174 | 174 |                      if ($data['show_id']) { | 
                                                        
| 175 | - $ruleParts[$key] .= ',id,show_id,' . $data['show_id'];  | 
                                                        |
| 175 | + $ruleParts[$key] .= ',id,show_id,'.$data['show_id'];  | 
                                                        |
| 176 | 176 | }  | 
                                                        
| 177 | 177 | }  | 
                                                        
| 178 | 178 | }  | 
                                                        
@@ -205,7 +205,7 @@ discard block  | 
                                                    ||
| 205 | 205 | |
| 206 | 206 |          while ($this->newQuery()->where('show_id', $this->show_id)->where($name, $_value)->count() > 0) { | 
                                                        
| 207 | 207 | $counter++;  | 
                                                        
| 208 | - $_value = $value . $separator . $counter;  | 
                                                        |
| 208 | + $_value = $value.$separator.$counter;  | 
                                                        |
| 209 | 209 | }  | 
                                                        
| 210 | 210 | |
| 211 | 211 | return $_value;  | 
                                                        
@@ -103,7 +103,8 @@ discard block  | 
                                                    ||
| 103 | 103 | * @param boolean $ofShow If true returns the next episode of the same show  | 
                                                        
| 104 | 104 | * @return Episode The next episode  | 
                                                        
| 105 | 105 | */  | 
                                                        
| 106 | -    public function nextCached($ofShow = false) { | 
                                                        |
| 106 | + public function nextCached($ofShow = false)  | 
                                                        |
| 107 | +    { | 
                                                        |
| 107 | 108 |          if (empty($this->nextEpisodeCache[$ofShow])) { | 
                                                        
| 108 | 109 | $this->nextEpisodeCache[$ofShow] = $this->next($ofShow);  | 
                                                        
| 109 | 110 | }  | 
                                                        
@@ -115,7 +116,8 @@ discard block  | 
                                                    ||
| 115 | 116 | * @param boolean $ofShow If true returns the next episode of the same show  | 
                                                        
| 116 | 117 | * @return Episode The previous episode  | 
                                                        
| 117 | 118 | */  | 
                                                        
| 118 | -    public function previousCached($ofShow = false) { | 
                                                        |
| 119 | + public function previousCached($ofShow = false)  | 
                                                        |
| 120 | +    { | 
                                                        |
| 119 | 121 |          if (empty($this->previousEpisodeCache[$ofShow])) { | 
                                                        
| 120 | 122 | $this->previousEpisodeCache[$ofShow] = $this->previous($ofShow);  | 
                                                        
| 121 | 123 | }  | 
                                                        
@@ -127,7 +129,8 @@ discard block  | 
                                                    ||
| 127 | 129 | * @param boolean $ofShow If true returns the next episode of the same show  | 
                                                        
| 128 | 130 | * @return Episode The next episode  | 
                                                        
| 129 | 131 | */  | 
                                                        
| 130 | -    public function next($ofShow = false) { | 
                                                        |
| 132 | + public function next($ofShow = false)  | 
                                                        |
| 133 | +    { | 
                                                        |
| 131 | 134 | $query = self::query();  | 
                                                        
| 132 | 135 |          if ($ofShow) { | 
                                                        
| 133 | 136 |              $query = $query->where('show_id',$this->show_id); | 
                                                        
@@ -139,7 +142,8 @@ discard block  | 
                                                    ||
| 139 | 142 | * @param boolean $ofShow If true returns the previous episode of the same show  | 
                                                        
| 140 | 143 | * @return Episode The previous episode  | 
                                                        
| 141 | 144 | */  | 
                                                        
| 142 | -    public function previous($ofShow = false) { | 
                                                        |
| 145 | + public function previous($ofShow = false)  | 
                                                        |
| 146 | +    { | 
                                                        |
| 143 | 147 | $query = self::query();  | 
                                                        
| 144 | 148 |          if ($ofShow) { | 
                                                        
| 145 | 149 |              $query = $query->where('show_id',$this->show_id); |