File: /var/www/vhost/disk-apps/comfama.sports-crowd.com/app/Http/Controllers/AlbumController.php
<?php
namespace App\Http\Controllers;
use App\Album;
use App\Ticket;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
class AlbumController extends Controller
{
public function validateTicketsAlbum($match_event){
$tickets = Ticket::where('user_id',Auth::user()->id)->where('match_event_id',$match_event)->get();
if($tickets->toArray()){
foreach($tickets as $ticket){
$ticket->is_on_album = 1;
$ticket->update();
}
return true;
}else{
return false;
}
}
public function getValidations(){
$match_events = Ticket::select('match_event_id')->where('user_id',Auth::user()->id)
->where('is_on_album',1)
->groupBy('match_event_id')->get()->toArray();
return response()->json($match_events, 200);
}
}