2017-08-06 09:43:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API\Interaction;
|
|
|
|
|
2017-12-09 18:34:27 +00:00
|
|
|
use App\Http\Requests\API\SongLikeRequest;
|
2017-08-06 09:43:59 +00:00
|
|
|
use App\Models\Interaction;
|
|
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
|
|
|
|
class LikeController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Like or unlike a song as the currently authenticated user.
|
|
|
|
*
|
2017-12-09 18:34:27 +00:00
|
|
|
* @param SongLikeRequest $request
|
2017-08-06 09:43:59 +00:00
|
|
|
*
|
|
|
|
* @return JsonResponse
|
|
|
|
*/
|
2017-12-09 18:34:27 +00:00
|
|
|
public function store(SongLikeRequest $request)
|
2017-08-06 09:43:59 +00:00
|
|
|
{
|
|
|
|
return response()->json(Interaction::toggleLike($request->song, $request->user()));
|
|
|
|
}
|
|
|
|
}
|