diff options
| author | Zach DeCook <zachdecook@librem.one> | 2020-11-19 04:17:42 +0000 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2020-11-19 04:17:42 +0000 |
| commit | 8d16bfb506ed722ad17a04c87a512d491e06a86c (patch) | |
| tree | 2a3fa8d80c204bcf5c6499265b9f57d368f995de /laravel/app/Song.php | |
| parent | e04ccd05b9ad4e45d28246eb200613e678636747 (diff) | |
| download | prosongsa-8d16bfb506ed722ad17a04c87a512d491e06a86c.tar.gz | |
* Song: Add method for transposing
Diffstat (limited to 'laravel/app/Song.php')
| -rw-r--r-- | laravel/app/Song.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/laravel/app/Song.php b/laravel/app/Song.php index a6e3a54..4ae3920 100644 --- a/laravel/app/Song.php +++ b/laravel/app/Song.php @@ -3,6 +3,7 @@ namespace App; use Illuminate\Database\Eloquent\Model; +use App\Http\Controllers\SongController; class Song extends Model { @@ -11,6 +12,18 @@ class Song extends Model { return $this->belongsToMany('App\Playlist'); } + public function textTranspose($key) + { + $sc = new SongController(); + $transp = $key; + if ($key && $this->plain_key){ + $try = $sc->keydiff($this->plain_key, $key); + if ($try !== null){ + $transp = $try; + } + } + return $sc->transposeBlock($this->text, $transp); + } public function getNameAttribute() { return $this->title |
