app\models\Song::byPath PHP Method

byPath() public static method

Get a Song record using its path.
public static byPath ( string $path ) : Song | null
$path string
return Song | null
    public static function byPath($path)
    {
        return self::find(File::getHash($path));
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Remove a song whose info matches with data sent from AWS.
  *
  * @param RemoveSongRequest $request
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function remove(RemoveSongRequest $request)
 {
     abort_unless($song = Song::byPath("s3://{$request->bucket}/{$request->key}"), 404);
     $song->delete();
     event(new LibraryChanged());
     return response()->json();
 }
All Usage Examples Of app\models\Song::byPath