sequelone / songs-crud
An admin panel for music, using Backpack\CRUD on Laravel 5.
Requires
- backpack/crud: ^5.0
- cviebrock/eloquent-sluggable: ^9.0||^8.0||^7.0||^6.0||4.8
- owen-oj/laravel-getid3: ^2.0
- spatie/laravel-translatable: ^4.6
Requires (Dev)
- phpunit/phpunit: ^9.0||^7.0
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3 || ~3.0
README
This package adds sections to the admin panel for creating a music portal. The scope of application is huge. From small labels to distributors.
Installation
Since SongsCRUD is just a Backpack\CRUD example, you can choose to install it one of two ways.
** Download and place files in your application** (recommended; remember to also composer require cviebrock/eloquent-sluggable
)
- In your terminal, run:
composer require sequelone/songs-crud
- Publish the migration:
php artisan vendor:publish --provider="SequelONE\SongsCRUD\SongsCRUDServiceProvider"
- Run the migration to have the database table we need:
php artisan migrate
- [optional] Add a menu item for it in
resources/views/vendor/backpack/base/inc/sidebar.blade.php
ormenu.blade.php
:
<!-- Songs --> <li class="nav-item nav-dropdown"> <a class="nav-link nav-dropdown-toggle" href="#"><i class="nav-icon la la-diamond"></i>{{ trans('songs-crud::songscrud.music') }}</a> <ul class="nav-dropdown-items"> <li class="nav-item"><a class="nav-link" href="{{ backpack_url('songs/releases') }}"><i class="nav-icon la la-microphone"></i> {{ trans('songs-crud::songscrud.releases') }}</a></li> <li class="nav-item"><a class="nav-link" href="{{ backpack_url('songs/labels') }}"><i class="nav-icon la la-star"></i> {{ trans('songs-crud::songscrud.labels') }}</a></li> <li class="nav-item"><a class="nav-link" href="{{ backpack_url('songs/artists') }}"><i class="nav-icon la la-users"></i> {{ trans('songs-crud::songscrud.artists') }}</a></li> <li class="nav-item"><a class="nav-link" href="{{ backpack_url('songs/types') }}"><i class="nav-icon la la-check-square-o"></i> {{ trans('songs-crud::songscrud.types') }}</a></li> <li class="nav-item"><a class="nav-link" href="{{ backpack_url('songs/genres') }}"><i class="nav-icon la la-list-ul"></i> {{ trans('songs-crud::songscrud.genres') }}</a></li> <li class="nav-item"><a class="nav-link" href="{{ backpack_url('songs') }}"><i class="nav-icon la la-music"></i> {{ trans('songs-crud::songscrud.tracks') }}</a></li> </ul> </li>
- [optional] If you need the browse field to upload images, please install Laravel-Backpack/FileManager.
Extra Field Type
Shortlink
Generates short links by click. You can add a new field type.
$this->crud->addField([
'name' => 'shortlink',
'label' => 'Shortlink (URL)',
'type' => 'shortlink',
'generate' => 'small_alphanumeric',
'length' => 4,
'hint' => 'Will be automatically generated from your name, if left empty.',
]);
The length
parameter is responsible for the length of the generated short link.
Example:
'generate' => 'small_alphanumeric',
'length' => 4,
Output:
d2f8
Available options for the generate
parameter.
Upload Tracks
$this->crud->addField([
'name' => 'shortlink',
'label' => 'Shortlink (URL)',
'type' => 'shortlink',
'generate' => 'small_alphanumeric',
'length' => 4,
'hint' => 'Will be automatically generated from your name, if left empty.',
]);
Add in /config/filesystems.php
'uploads' => [
'driver' => 'local',
'root' => storage_path('uploads'), // that's where your backups are stored by default: storage/uploads
],
'tracks' => [
'driver' => 'local',
'root' => storage_path('uploads/tracks'), // that's where your backups are stored by default: storage/uploads
],
'covers' => [
'driver' => 'local',
'root' => storage_path('uploads/tracks/covers'), // that's where your backups are stored by default: storage/uploads
],
Console
This command updates the database with the default release formats. You can use this command if you don't want to insert your data into the table.
php artisan songscrud:types
Executing this command loads all genres.
php artisan songscrud:genres
WARNING! ACHTUNG! ВНИМАНИЕ!
Executing this command completely clears the songs_types
and songs_genres
tables.
php artisan songscrud:clear
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Overwriting functionality
If you need to modify how this works in a project:
- create a
routes/backpack/songscrud.php
file; the package will see that, and load your routes file, instead of the one in the package; - create controllers/models that extend the ones in the package, and use those in your new routes file;
- modify anything you'd like in the new controllers/models;
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Credits
License
Backpack is free for non-commercial use and Backpack PRO 69€/project for commercial use. Please see License File and backpackforlaravel.com for more information.