Skip to content

Commit 55d5116

Browse files
authored
Merge pull request #4662 from Roardom/playlist-category-description
(Add) Description to playlist categories
2 parents d01bf09 + 8e81c3c commit 55d5116

File tree

9 files changed

+91
-1
lines changed

9 files changed

+91
-1
lines changed

Diff for: app/Http/Requests/Staff/StorePlaylistCategoryRequest.php

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public function rules(): array
3737
'numeric',
3838
'decimal:0',
3939
],
40+
'description' => [
41+
'required',
42+
'string',
43+
],
4044
];
4145
}
4246
}

Diff for: app/Http/Requests/Staff/UpdatePlaylistCategoryRequest.php

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public function rules(): array
3737
'numeric',
3838
'decimal:0',
3939
],
40+
'description' => [
41+
'required',
42+
'string',
43+
],
4044
];
4145
}
4246
}

Diff for: app/Models/PlaylistCategory.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* @property int $id
2727
* @property string $name
2828
* @property int $position
29+
* @property string $description
2930
*/
3031
class PlaylistCategory extends Model
3132
{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* NOTICE OF LICENSE.
7+
*
8+
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
9+
* The details is bundled with this project in the file LICENSE.txt.
10+
*
11+
* @project UNIT3D Community Edition
12+
*
13+
* @author Roardom <roardom@protonmail.com>
14+
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
15+
*/
16+
17+
use Illuminate\Database\Migrations\Migration;
18+
use Illuminate\Database\Schema\Blueprint;
19+
use Illuminate\Support\Facades\Schema;
20+
21+
return new class () extends Migration {
22+
/**
23+
* Run the migrations.
24+
*/
25+
public function up(): void
26+
{
27+
Schema::table('playlist_categories', function (Blueprint $table): void {
28+
$table->text('description');
29+
});
30+
}
31+
};

Diff for: database/schema/mysql-schema.sql

+2
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,7 @@ CREATE TABLE `playlist_categories` (
11861186
`id` int unsigned NOT NULL AUTO_INCREMENT,
11871187
`position` smallint NOT NULL,
11881188
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
1189+
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
11891190
PRIMARY KEY (`id`)
11901191
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
11911192
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -2940,3 +2941,4 @@ INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (343,'2025_03_25_09
29402941
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (344,'2025_03_29_215845_create_playlist_categories',1);
29412942
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (345,'2025_04_03_085022_drop_season_and_episodes',1);
29422943
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (346,'2025_04_07_152108_split_recommendations_into_movie_and_tv',1);
2944+
INSERT INTO `migrations` (`id`, `migration`, `batch`) VALUES (347,'2025_04_15_075631_add_description_to_playlist_categories',1);

Diff for: resources/views/Staff/playlist-category/create.blade.php

+11
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ class="form__text"
4747
{{ __('common.position') }}
4848
</label>
4949
</p>
50+
<p class="form__group">
51+
<textarea
52+
id="description"
53+
name="description"
54+
class="form__textarea"
55+
placeholder=" "
56+
></textarea>
57+
<label class="form__label form__label--floating" for="description">
58+
{{ __('common.description') }}
59+
</label>
60+
</p>
5061
<p class="form__group">
5162
<button class="form__button form__button--filled">
5263
{{ __('common.submit') }}

Diff for: resources/views/Staff/playlist-category/edit.blade.php

+13
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,19 @@ class="form__text"
5757
{{ __('common.position') }}
5858
</label>
5959
</p>
60+
<p class="form__group">
61+
<textarea
62+
id="description"
63+
name="description"
64+
class="form__textarea"
65+
placeholder=" "
66+
>
67+
{{ $playlistCategory->description }}</textarea
68+
>
69+
<label class="form__label form__label--floating" for="description">
70+
{{ __('common.description') }}
71+
</label>
72+
</p>
6073
<p class="form__group">
6174
<button class="form__button form__button--filled">
6275
{{ __('common.submit') }}

Diff for: resources/views/Staff/playlist-category/index.blade.php

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class="panel__action"
3333
<th>ID</th>
3434
<th>{{ __('common.position') }}</th>
3535
<th>{{ __('common.name') }}</th>
36+
<th>{{ __('common.description') }}</th>
3637
<th>{{ __('common.action') }}</th>
3738
</tr>
3839
</thead>
@@ -48,6 +49,7 @@ class="panel__action"
4849
{{ $playlistCategory->name }}
4950
</a>
5051
</td>
52+
<td>{{ $playlistCategory->description }}</td>
5153
<td>
5254
<menu class="data-table__actions">
5355
<li class="data-table__action">

Diff for: resources/views/playlist/create.blade.php

+23-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@extends('layout.with-main')
1+
@extends('layout.with-main-and-sidebar')
22

33
@section('title')
44
<title>{{ __('playlist.title') }} - {{ config('other.title') }}</title>
@@ -95,3 +95,25 @@ class="form__checkbox"
9595
</div>
9696
</section>
9797
@endsection
98+
99+
@section('sidebar')
100+
<section class="panelV2">
101+
<h2 class="panel__heading">{{ __('torrent.categories') }}</h2>
102+
<table class="data-table">
103+
<thead>
104+
<tr>
105+
<th>{{ __('torrent.category') }}</th>
106+
<th>{{ __('torrent.description') }}</th>
107+
</tr>
108+
</thead>
109+
<tbody>
110+
@foreach ($playlistCategories as $playlistCategory)
111+
<tr>
112+
<td>{{ $playlistCategory->name }}</td>
113+
<td>{{ $playlistCategory->description }}</td>
114+
</tr>
115+
@endforeach
116+
</tbody>
117+
</table>
118+
</section>
119+
@endsection

0 commit comments

Comments
 (0)