{"action":"created","comment":{"url":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/comments/43964246","id":43964246,"diff_hunk":"@@ -5,24 +5,158 @@\n use Illuminate\\Http\\Request;\n use App\\Http\\Requests;\n use App\\Http\\Controllers\\Controller;\n+use DB;\n+use App\\User;\n+use App\\Models\\Ticket;\n+use App\\Models\\Slot;\n+use App\\Models\\Event;\n+use App\\Models\\Presentation;\n+use App\\Models\\Zone;\n+use App\\Http\\Requests\\Booking\\StoreBookingRequest;\n+use Carbon\\Carbon;\n+use DateTime; use Date;\n \n class BookingController extends Controller\n {\n \tpublic function create($id)\n \t{\n-\t\treturn view('external.booking.create');\n+\t\t$event = Event::find($id);\n+\t\t$presentations = $event->presentations;\n+\t\tforeach ($presentations as $presentation) {\n+\t\t\t$presentation->starts_at = gmdate(\"d-m-Y H:i:s \", $presentation->starts_at);\n+\t\t}\n+\t\t$presentations = $presentations->lists('starts_at', 'id');\n+\t\t$zones = Zone::where('event_id', $id)->lists('name', 'id');\n+\t\t$array = ['event' => $event,\n+\t\t\t\t'presentations' => $presentations,\n+\t\t\t\t'zones'\t\t\t=> $zones];\n+\t\treturn view('external.booking.create', $array);\n \t}\n \n-\tpublic function store(Request $request)\n+\tpublic function store(StoreBookingRequest $request)\n \t{\n \t\t\n-\t\t//return view('external.home');\n-\t\treturn view('external.booking.results');\n-\t}\n+\t\t$event = Event::find($request['event_id']);\n+        $zone = Zone::find($request['zone_id']);\n+        $nTickets = $request['quantity'];\n+        $codigo_reserva = uniqid();\n+        $seats_array = array();\n+        if ($event->place->rows != null){ //Es numerado\n+            $seats = $request['seats'];\n+\n+            $seats = $this->getSelectedSlots($seats, $zone->id);\n+            \n+            foreach($seats as $seat_id){\n+                $seat = Slot::find($seat_id);\n+                array_push($seats_array, $seat);\n+                $slot = DB::table('slot_presentation')->where('slot_id',$seat_id)->where('presentation_id', $request['presentation_id'])->first();\n+\n+                if($slot->status != config('constants.seat_available')){\n+                    return back()->withInput($request->except('seats'))->withErrors(['El asiento '. $seat_id.' no esta libre']);\n+                }\n+            }\n+\n+        }else{ //No es numerado\n+            if($zone->capacity - $nTickets <= 0) //Deberia ser zona x presentacion","path":"app/Http/Controllers/BookingController.php","position":61,"original_position":61,"commit_id":"10b1e554e2304d2537a24038f1581562a645b224","original_commit_id":"10b1e554e2304d2537a24038f1581562a645b224","user":{"login":"TAMQuiroz","id":10441155,"avatar_url":"https://avatars.githubusercontent.com/u/10441155?v=3","gravatar_id":"","url":"https://api.github.com/users/TAMQuiroz","html_url":"https://github.com/TAMQuiroz","followers_url":"https://api.github.com/users/TAMQuiroz/followers","following_url":"https://api.github.com/users/TAMQuiroz/following{/other_user}","gists_url":"https://api.github.com/users/TAMQuiroz/gists{/gist_id}","starred_url":"https://api.github.com/users/TAMQuiroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TAMQuiroz/subscriptions","organizations_url":"https://api.github.com/users/TAMQuiroz/orgs","repos_url":"https://api.github.com/users/TAMQuiroz/repos","events_url":"https://api.github.com/users/TAMQuiroz/events{/privacy}","received_events_url":"https://api.github.com/users/TAMQuiroz/received_events","type":"User","site_admin":false},"body":"esto lo cambie, cambie varias cosas en realidad, revisa mi codigo x)","created_at":"2015-11-05T00:55:24Z","updated_at":"2015-11-05T00:55:24Z","html_url":"https://github.com/TAMQuiroz/starkTicket/pull/53#discussion_r43964246","pull_request_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/53","_links":{"self":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/comments/43964246"},"html":{"href":"https://github.com/TAMQuiroz/starkTicket/pull/53#discussion_r43964246"},"pull_request":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/53"}}},"pull_request":{"url":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/53","id":49766968,"html_url":"https://github.com/TAMQuiroz/starkTicket/pull/53","diff_url":"https://github.com/TAMQuiroz/starkTicket/pull/53.diff","patch_url":"https://github.com/TAMQuiroz/starkTicket/pull/53.patch","issue_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues/53","number":53,"state":"open","locked":false,"title":"Cecilia","user":{"login":"cecilia21","id":11398896,"avatar_url":"https://avatars.githubusercontent.com/u/11398896?v=3","gravatar_id":"","url":"https://api.github.com/users/cecilia21","html_url":"https://github.com/cecilia21","followers_url":"https://api.github.com/users/cecilia21/followers","following_url":"https://api.github.com/users/cecilia21/following{/other_user}","gists_url":"https://api.github.com/users/cecilia21/gists{/gist_id}","starred_url":"https://api.github.com/users/cecilia21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cecilia21/subscriptions","organizations_url":"https://api.github.com/users/cecilia21/orgs","repos_url":"https://api.github.com/users/cecilia21/repos","events_url":"https://api.github.com/users/cecilia21/events{/privacy}","received_events_url":"https://api.github.com/users/cecilia21/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-11-05T00:29:02Z","updated_at":"2015-11-05T00:55:24Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a05bd50d0725807b6de82d97cdfe4d343e83d296","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/53/commits","review_comments_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/53/comments","review_comment_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues/53/comments","statuses_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/statuses/10b1e554e2304d2537a24038f1581562a645b224","head":{"label":"TAMQuiroz:cecilia","ref":"cecilia","sha":"10b1e554e2304d2537a24038f1581562a645b224","user":{"login":"TAMQuiroz","id":10441155,"avatar_url":"https://avatars.githubusercontent.com/u/10441155?v=3","gravatar_id":"","url":"https://api.github.com/users/TAMQuiroz","html_url":"https://github.com/TAMQuiroz","followers_url":"https://api.github.com/users/TAMQuiroz/followers","following_url":"https://api.github.com/users/TAMQuiroz/following{/other_user}","gists_url":"https://api.github.com/users/TAMQuiroz/gists{/gist_id}","starred_url":"https://api.github.com/users/TAMQuiroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TAMQuiroz/subscriptions","organizations_url":"https://api.github.com/users/TAMQuiroz/orgs","repos_url":"https://api.github.com/users/TAMQuiroz/repos","events_url":"https://api.github.com/users/TAMQuiroz/events{/privacy}","received_events_url":"https://api.github.com/users/TAMQuiroz/received_events","type":"User","site_admin":false},"repo":{"id":42788123,"name":"starkTicket","full_name":"TAMQuiroz/starkTicket","owner":{"login":"TAMQuiroz","id":10441155,"avatar_url":"https://avatars.githubusercontent.com/u/10441155?v=3","gravatar_id":"","url":"https://api.github.com/users/TAMQuiroz","html_url":"https://github.com/TAMQuiroz","followers_url":"https://api.github.com/users/TAMQuiroz/followers","following_url":"https://api.github.com/users/TAMQuiroz/following{/other_user}","gists_url":"https://api.github.com/users/TAMQuiroz/gists{/gist_id}","starred_url":"https://api.github.com/users/TAMQuiroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TAMQuiroz/subscriptions","organizations_url":"https://api.github.com/users/TAMQuiroz/orgs","repos_url":"https://api.github.com/users/TAMQuiroz/repos","events_url":"https://api.github.com/users/TAMQuiroz/events{/privacy}","received_events_url":"https://api.github.com/users/TAMQuiroz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TAMQuiroz/starkTicket","description":"GIB GIB WOLOLOLOLO","fork":false,"url":"https://api.github.com/repos/TAMQuiroz/starkTicket","forks_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/forks","keys_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/teams","hooks_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/hooks","issue_events_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues/events{/number}","events_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/events","assignees_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/assignees{/user}","branches_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/branches{/branch}","tags_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/tags","blobs_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/refs{/sha}","trees_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/statuses/{sha}","languages_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/languages","stargazers_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/stargazers","contributors_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/contributors","subscribers_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/subscribers","subscription_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/subscription","commits_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/commits{/sha}","git_commits_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/commits{/sha}","comments_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/comments{/number}","issue_comment_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues/comments{/number}","contents_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/contents/{+path}","compare_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/merges","archive_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/downloads","issues_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues{/number}","pulls_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls{/number}","milestones_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/milestones{/number}","notifications_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/labels{/name}","releases_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/releases{/id}","created_at":"2015-09-19T20:15:15Z","updated_at":"2015-10-04T17:32:43Z","pushed_at":"2015-11-05T00:29:02Z","git_url":"git://github.com/TAMQuiroz/starkTicket.git","ssh_url":"git@github.com:TAMQuiroz/starkTicket.git","clone_url":"https://github.com/TAMQuiroz/starkTicket.git","svn_url":"https://github.com/TAMQuiroz/starkTicket","homepage":null,"size":11964,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"TAMQuiroz:master","ref":"master","sha":"f1dbb3255cd73e024937382335ff7d1b3c8f9903","user":{"login":"TAMQuiroz","id":10441155,"avatar_url":"https://avatars.githubusercontent.com/u/10441155?v=3","gravatar_id":"","url":"https://api.github.com/users/TAMQuiroz","html_url":"https://github.com/TAMQuiroz","followers_url":"https://api.github.com/users/TAMQuiroz/followers","following_url":"https://api.github.com/users/TAMQuiroz/following{/other_user}","gists_url":"https://api.github.com/users/TAMQuiroz/gists{/gist_id}","starred_url":"https://api.github.com/users/TAMQuiroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TAMQuiroz/subscriptions","organizations_url":"https://api.github.com/users/TAMQuiroz/orgs","repos_url":"https://api.github.com/users/TAMQuiroz/repos","events_url":"https://api.github.com/users/TAMQuiroz/events{/privacy}","received_events_url":"https://api.github.com/users/TAMQuiroz/received_events","type":"User","site_admin":false},"repo":{"id":42788123,"name":"starkTicket","full_name":"TAMQuiroz/starkTicket","owner":{"login":"TAMQuiroz","id":10441155,"avatar_url":"https://avatars.githubusercontent.com/u/10441155?v=3","gravatar_id":"","url":"https://api.github.com/users/TAMQuiroz","html_url":"https://github.com/TAMQuiroz","followers_url":"https://api.github.com/users/TAMQuiroz/followers","following_url":"https://api.github.com/users/TAMQuiroz/following{/other_user}","gists_url":"https://api.github.com/users/TAMQuiroz/gists{/gist_id}","starred_url":"https://api.github.com/users/TAMQuiroz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TAMQuiroz/subscriptions","organizations_url":"https://api.github.com/users/TAMQuiroz/orgs","repos_url":"https://api.github.com/users/TAMQuiroz/repos","events_url":"https://api.github.com/users/TAMQuiroz/events{/privacy}","received_events_url":"https://api.github.com/users/TAMQuiroz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TAMQuiroz/starkTicket","description":"GIB GIB WOLOLOLOLO","fork":false,"url":"https://api.github.com/repos/TAMQuiroz/starkTicket","forks_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/forks","keys_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/teams","hooks_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/hooks","issue_events_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues/events{/number}","events_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/events","assignees_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/assignees{/user}","branches_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/branches{/branch}","tags_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/tags","blobs_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/refs{/sha}","trees_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/statuses/{sha}","languages_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/languages","stargazers_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/stargazers","contributors_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/contributors","subscribers_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/subscribers","subscription_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/subscription","commits_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/commits{/sha}","git_commits_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/git/commits{/sha}","comments_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/comments{/number}","issue_comment_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues/comments{/number}","contents_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/contents/{+path}","compare_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/merges","archive_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/downloads","issues_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues{/number}","pulls_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls{/number}","milestones_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/milestones{/number}","notifications_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/labels{/name}","releases_url":"https://api.github.com/repos/TAMQuiroz/starkTicket/releases{/id}","created_at":"2015-09-19T20:15:15Z","updated_at":"2015-10-04T17:32:43Z","pushed_at":"2015-11-05T00:29:02Z","git_url":"git://github.com/TAMQuiroz/starkTicket.git","ssh_url":"git@github.com:TAMQuiroz/starkTicket.git","clone_url":"https://github.com/TAMQuiroz/starkTicket.git","svn_url":"https://github.com/TAMQuiroz/starkTicket","homepage":null,"size":11964,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/53"},"html":{"href":"https://github.com/TAMQuiroz/starkTicket/pull/53"},"issue":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues/53"},"comments":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/issues/53/comments"},"review_comments":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/53/comments"},"review_comment":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/pulls/53/commits"},"statuses":{"href":"https://api.github.com/repos/TAMQuiroz/starkTicket/statuses/10b1e554e2304d2537a24038f1581562a645b224"}}}}