├── .env.example ├── .env.testing ├── .gitattributes ├── .gitignore ├── .travis.yml ├── Homestead.yaml.example ├── LICENSE ├── Vagrantfile ├── app ├── Console │ ├── Commands │ │ └── SendDiscordMessage.php │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── Api │ │ │ ├── GamesController.php │ │ │ ├── PlatformsController.php │ │ │ ├── PostsController.php │ │ │ ├── TeamsController.php │ │ │ ├── TournamentsController.php │ │ │ └── UsersController.php │ │ ├── Auth │ │ │ ├── ForgotPasswordController.php │ │ │ ├── LoginController.php │ │ │ ├── PasswordController.php │ │ │ ├── RegisterController.php │ │ │ └── ResetPasswordController.php │ │ ├── Controller.php │ │ └── Site │ │ │ ├── HomeController.php │ │ │ ├── PageController.php │ │ │ ├── PlayerController.php │ │ │ ├── ProfileController.php │ │ │ ├── SettingsController.php │ │ │ ├── TeamController.php │ │ │ ├── TeamInvitesController.php │ │ │ └── TournamentController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── RedirectIfAuthenticated.php │ │ └── VerifyCsrfToken.php │ └── Requests │ │ └── Request.php ├── Mail │ └── AccountCreated.php ├── Models │ ├── Game.php │ ├── Platform.php │ ├── Post.php │ ├── Team.php │ ├── TeamInvite.php │ ├── Tournament.php │ └── User.php ├── Notifications │ ├── JoinedTournamentConfirmation.php │ ├── ReceivedTeamInvitation.php │ └── TournamentStarting.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Support │ └── Helpers.php └── Traits │ ├── Teams │ └── TeamTrait.php │ └── Users │ └── HasTeams.php ├── artisan ├── bootstrap ├── app.php ├── autoload.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── compile.php ├── database.php ├── filesystems.php ├── mail.php ├── queue.php ├── services.php ├── session.php ├── teamwork.php └── view.php ├── database ├── .gitignore ├── factories │ └── ModelFactory.php ├── migrations │ ├── .gitkeep │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2016_05_25_043614_create_platforms_table.php │ ├── 2016_05_25_043623_create_games_table.php │ ├── 2016_05_25_184909_add_platform_game_table.php │ ├── 2016_07_29_061330_create_posts_table.php │ ├── 2016_08_18_021209_create_tournaments_table.php │ └── 2016_08_18_062025_setup_team_tables.php └── seeds │ ├── .gitkeep │ └── DatabaseSeeder.php ├── gulpfile.js ├── package.json ├── phpunit.xml ├── public ├── .htaccess ├── css │ ├── app.css │ └── app.css.map ├── favicon.ico ├── index.php ├── js │ ├── admin │ │ ├── 0.main.js │ │ └── main.js │ └── app.js ├── robots.txt └── web.config ├── readme.md ├── resources ├── assets │ ├── js │ │ ├── admin │ │ │ ├── components │ │ │ │ ├── AdminHeader.vue │ │ │ │ ├── App.vue │ │ │ │ ├── Dashboard.vue │ │ │ │ ├── GamesManager.vue │ │ │ │ ├── OauthSettings.vue │ │ │ │ ├── PlatformsManager.vue │ │ │ │ ├── UsersManager.vue │ │ │ │ └── passport │ │ │ │ │ ├── AuthorizedClients.vue │ │ │ │ │ ├── Clients.vue │ │ │ │ │ └── PersonalAccessTokens.vue │ │ │ └── main.js │ │ ├── app.js │ │ └── components │ │ │ └── Auth.vue │ └── sass │ │ ├── admin │ │ ├── _animate.scss │ │ └── styles.scss │ │ ├── app.scss │ │ └── default │ │ ├── _global.scss │ │ ├── _header.scss │ │ ├── _settings.scss │ │ └── styles.scss ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php └── views │ ├── admin │ └── index.blade.php │ ├── auth │ ├── emails │ │ └── password.blade.php │ ├── login.blade.php │ ├── passwords │ │ ├── email.blade.php │ │ └── reset.blade.php │ └── register.blade.php │ ├── emails │ └── accounts │ │ └── created.blade.php │ ├── errors │ ├── 404.blade.php │ └── 503.blade.php │ ├── layouts │ └── app.blade.php │ └── site │ ├── blog-view.blade.php │ ├── blog.blade.php │ ├── home.blade.php │ ├── partials │ └── news.blade.php │ ├── player-view.blade.php │ ├── players.blade.php │ ├── shared │ ├── footer.blade.php │ └── header.blade.php │ ├── team-view.blade.php │ ├── teams.blade.php │ ├── teams │ ├── create.blade.php │ ├── edit.blade.php │ ├── index.blade.php │ └── members.blade.php │ ├── tournament-view.blade.php │ └── tournaments.blade.php ├── routes ├── api.php └── web.php ├── server.php ├── tests ├── TestCase.php ├── integration │ └── Api │ │ ├── GamesControllerTest.php │ │ ├── PlatformControllerTest.php │ │ ├── PostsControllerTest.php │ │ ├── TeamsControllerTest.php │ │ └── UsersControllerTest.php └── unit │ └── ControllerTest.php └── webpack.config.js /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME="Bracket" 2 | APP_ENV="local" 3 | APP_DEBUG=true 4 | APP_LOG_LEVEL="debug" 5 | APP_URL="http://bracket" 6 | APP_KEY="" 7 | 8 | DB_CONNECTION="mysql" 9 | DB_HOST="127.0.0.1" 10 | DB_PORT=3306 11 | DB_DATABASE="homestead" 12 | DB_USERNAME="homestead" 13 | DB_PASSWORD="secret" 14 | 15 | CACHE_DRIVER="file" 16 | SESSION_DRIVER="file" 17 | QUEUE_DRIVER="sync" 18 | 19 | REDIS_HOST="127.0.0.1" 20 | REDIS_PASSWORD=null 21 | REDIS_PORT=6379 22 | 23 | MAIL_DRIVER="smtp" 24 | MAIL_HOST="mailtrap.io" 25 | MAIL_PORT=2525 26 | MAIL_USERNAME=null 27 | MAIL_PASSWORD=null 28 | MAIL_ENCRYPTION=null 29 | 30 | DISCORD_TOKEN= 31 | CHALLONGE_API= 32 | 33 | PUSHER_KEY= 34 | PUSHER_SECRET= 35 | PUSHER_APP_ID= 36 | -------------------------------------------------------------------------------- /.env.testing: -------------------------------------------------------------------------------- 1 | APP_NAME="Bracket" 2 | APP_ENV="testing" 3 | APP_DEBUG=true 4 | APP_KEY="base64:8vzW7BLhdFrgS90PQDYR7WCN+lJ1RKvpvLndS5AXS18=" 5 | APP_LOG_LEVEL="debug" 6 | 7 | DB_CONNECTION="sqlite" 8 | DB_DATABASE=":memory:" 9 | 10 | CACHE_DRIVER="file" 11 | SESSION_DRIVER="file" 12 | QUEUE_DRIVER="sync" 13 | 14 | REDIS_HOST="127.0.0.1" 15 | REDIS_PASSWORD=null 16 | REDIS_PORT=6379 17 | 18 | MAIL_DRIVER="smtp" 19 | MAIL_HOST="mailtrap.io" 20 | MAIL_PORT=2525 21 | MAIL_USERNAME=null 22 | MAIL_PASSWORD=null 23 | MAIL_ENCRYPTION=null 24 | 25 | PUSHER_KEY= 26 | PUSHER_SECRET= 27 | PUSHER_APP_ID= 28 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io/api/laravel 2 | 3 | ### Homestead ### 4 | Homestead.yaml 5 | 6 | ### Laravel ### 7 | vendor/ 8 | node_modules/ 9 | 10 | # Laravel 4 specific 11 | bootstrap/compiled.php 12 | app/storage/ 13 | 14 | # Laravel 5 & Lumen specific 15 | bootstrap/cache/ 16 | storage/ 17 | storage/framework/cache/* 18 | storage/framework/sessions/* 19 | storage/framework/views/* 20 | !storage/framework/cache/.gitkeep 21 | !storage/framework/sessions/.gitkeep 22 | !storage/framework/views/.gitkeep 23 | 24 | .vagrant/ 25 | .env.*.php 26 | .env.php 27 | .env 28 | 29 | # Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer 30 | .rocketeer/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - '5.6' 4 | - '7.0' 5 | before_script: 6 | - composer self-update 7 | install: 8 | - composer install --prefer-source --no-interaction --dev 9 | -------------------------------------------------------------------------------- /Homestead.yaml.example: -------------------------------------------------------------------------------- 1 | --- 2 | ip: "192.168.10.10" 3 | memory: 1024 4 | cpus: 1 5 | hostname: bracket 6 | name: bracket 7 | provider: virtualbox 8 | 9 | authorize: ~/.ssh/id_rsa.pub 10 | 11 | keys: 12 | - ~/.ssh/id_rsa 13 | 14 | folders: 15 | - map: "/path/to/bracket" 16 | to: "/home/vagrant/bracket" 17 | 18 | sites: 19 | - map: homestead.app 20 | to: "/home/vagrant/bracket/public" 21 | 22 | databases: 23 | - homestead 24 | 25 | # blackfire: 26 | # - id: foo 27 | # token: bar 28 | # client-id: foo 29 | # client-token: bar 30 | 31 | # ports: 32 | # - send: 50000 33 | # to: 5000 34 | # - send: 7777 35 | # to: 777 36 | # protocol: udp 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Joshua Kidd 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | require 'json' 2 | require 'yaml' 3 | 4 | VAGRANTFILE_API_VERSION ||= "2" 5 | confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__)) 6 | 7 | homesteadYamlPath = "Homestead.yaml" 8 | homesteadJsonPath = "Homestead.json" 9 | afterScriptPath = "after.sh" 10 | aliasesPath = "aliases" 11 | 12 | require File.expand_path(confDir + '/scripts/homestead.rb') 13 | 14 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 15 | if File.exists? aliasesPath then 16 | config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases" 17 | end 18 | 19 | if File.exists? homesteadYamlPath then 20 | Homestead.configure(config, YAML::load(File.read(homesteadYamlPath))) 21 | elsif File.exists? homesteadJsonPath then 22 | Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath))) 23 | end 24 | 25 | if File.exists? afterScriptPath then 26 | config.vm.provision "shell", path: afterScriptPath 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /app/Console/Commands/SendDiscordMessage.php: -------------------------------------------------------------------------------- 1 | argument('message'); 43 | 44 | if(!config('services.discord.token')) { 45 | $this->error("You need to set the DISCORD_TOKEN in the .env file!"); 46 | return false; 47 | } 48 | 49 | $discord = new Discord([ 50 | 'token' => config('services.discord.token') 51 | ]); 52 | 53 | $discord->on('ready', function($discord) { 54 | $discord->updatePresence($discord->factory(Game::class, ['name' => "with your minds!"]), false); 55 | $guild = $discord->guilds->first(); 56 | 57 | foreach($guild->channels->getAll('type', 'text') as $channel) { 58 | if($channel->name == "discord-tests") { 59 | $this->line($channel->name); 60 | $channel->sendMessage($this->argument('message')); 61 | } 62 | } 63 | 64 | $discord->close(); 65 | return true; 66 | }); 67 | 68 | $discord->run(); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire') 29 | // ->hourly(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 59 | return response()->json(['error' => 'Unauthenticated.'], 401); 60 | } else { 61 | return redirect()->guest('login'); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/GamesController.php: -------------------------------------------------------------------------------- 1 | gameModel = $gameModel; 15 | } 16 | 17 | /** 18 | * Display a listing of the resource. 19 | * 20 | * @return \Illuminate\Http\Response 21 | */ 22 | public function index() 23 | { 24 | $games = $this->gameModel->all(); 25 | 26 | return response()->json($games->toArray()); 27 | } 28 | 29 | /** 30 | * Store a newly created resource in storage. 31 | * 32 | * @param \Illuminate\Http\Request $request 33 | * 34 | * @return \Illuminate\Http\Response 35 | */ 36 | public function store(Request $request) 37 | { 38 | $this->validate($request, [ 39 | 'name' => 'required|max:255', 40 | 'short_name' => 'required|max:100' 41 | ]); 42 | 43 | $game = new $this->gameModel([ 44 | 'name' => $request->input('name'), 45 | 'short_name' => $request->input('short_name'), 46 | 'slug' => str_slug($request->input('name')), 47 | 'logo' => '', 48 | 'banner' => '' 49 | ]); 50 | 51 | $game->save(); 52 | $game->platforms()->attach($request->input('platforms')); 53 | 54 | return response()->json($game); 55 | } 56 | 57 | /** 58 | * Display the specified resource. 59 | * 60 | * @param int $id 61 | * 62 | * @return \Illuminate\Http\Response 63 | */ 64 | public function show($id) 65 | { 66 | $game = $this->gameModel->find($id); 67 | 68 | if (!$game) { 69 | return $this->recordNotFound(); 70 | } 71 | 72 | return response()->json($game); 73 | } 74 | 75 | /** 76 | * Update the specified resource in storage. 77 | * 78 | * @param \Illuminate\Http\Request $request 79 | * @param int $id 80 | * 81 | * @return \Illuminate\Http\Response 82 | */ 83 | public function update(Request $request, $id) 84 | { 85 | $this->validate($request, [ 86 | 'name' => 'required|max:255', 87 | 'short_name' => 'required|max:100' 88 | ]); 89 | 90 | $game = $this->gameModel->find($id); 91 | 92 | if (!$game) { 93 | return $this->recordNotFound(); 94 | } 95 | 96 | // TODO: Add support for updating the platforms, 97 | // that is once testing has been added for 98 | // platforms. 99 | $game->name = $request->input('name'); 100 | $game->short_name = $request->input('short_name'); 101 | $game->slug = str_slug($request->input('name')); 102 | $game->logo = $request->input('logo'); 103 | $game->banner = $request->input('banner'); 104 | 105 | $game->save(); 106 | 107 | return response()->json($game); 108 | } 109 | 110 | /** 111 | * Remove the specified resource from storage. 112 | * 113 | * @param int $id 114 | * 115 | * @return \Illuminate\Http\Response 116 | */ 117 | public function destroy($id) 118 | { 119 | $game = $this->gameModel->find($id); 120 | 121 | if (!$game) { 122 | return $this->recordNotFound(); 123 | } 124 | 125 | $game->delete(); 126 | 127 | return response(null, 200); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/PlatformsController.php: -------------------------------------------------------------------------------- 1 | platformModel = $platformModel; 15 | } 16 | 17 | /** 18 | * Display a listing of the resource. 19 | * 20 | * @return \Illuminate\Http\Response 21 | */ 22 | public function index() 23 | { 24 | $platforms = $this->platformModel->all(); 25 | 26 | return response()->json($platforms->toArray()); 27 | } 28 | 29 | /** 30 | * Store a newly created resource in storage. 31 | * 32 | * TODO: Add the banners and logos here... 33 | * @param \Illuminate\Http\Request $request 34 | * 35 | * @return \Illuminate\Http\Response 36 | */ 37 | public function store(Request $request) 38 | { 39 | $this->validate($request, [ 40 | 'name' => 'required|max:255', 41 | 'short_name' => 'required|max:100' 42 | ]); 43 | 44 | $platform = new $this->platformModel([ 45 | 'name' => $request->input('name'), 46 | 'short_name' => $request->input('short_name'), 47 | 'slug' => str_slug($request->input('name')), 48 | 'logo' => '', 49 | 'banner' => '' 50 | ]); 51 | $platform->save(); 52 | 53 | return response()->json($platform); 54 | } 55 | 56 | /** 57 | * Display the specified resource. 58 | * 59 | * @param int $id 60 | * 61 | * @return \Illuminate\Http\Response 62 | */ 63 | public function show($id) 64 | { 65 | $platform = $this->platformModel->find($id); 66 | 67 | if (!$platform) { 68 | return $this->recordNotFound(); 69 | } 70 | 71 | return response()->json($platform); 72 | } 73 | 74 | /** 75 | * Update the specified resource in storage. 76 | * 77 | * @param \Illuminate\Http\Request $request 78 | * @param int $id 79 | * 80 | * @return \Illuminate\Http\Response 81 | */ 82 | public function update(Request $request, $id) 83 | { 84 | $this->validate($request, [ 85 | 'name' => 'required|max:255', 86 | 'short_name' => 'required|max:100' 87 | ]); 88 | 89 | $platform = $this->platformModel->find($id); 90 | 91 | if (!$platform) { 92 | return $this->recordNotFound(); 93 | } 94 | 95 | $platform->name = $request->input('name'); 96 | $platform->short_name = $request->input('short_name'); 97 | $platform->slug = str_slug($request->input('name')); 98 | $platform->logo = $request->input('logo'); 99 | $platform->banner = $request->input('banner'); 100 | 101 | $platform->save(); 102 | 103 | return response()->json($platform); 104 | } 105 | 106 | /** 107 | * Remove the specified resource from storage. 108 | * 109 | * @param int $id 110 | * 111 | * @return \Illuminate\Http\Response 112 | */ 113 | public function destroy($id) 114 | { 115 | $platform = $this->platformModel->find($id); 116 | 117 | if (!$platform) { 118 | return $this->recordNotFound(); 119 | } 120 | 121 | $platform->delete(); 122 | 123 | return response(null, 200); 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/PostsController.php: -------------------------------------------------------------------------------- 1 | postModel = $postModel; 16 | } 17 | 18 | public function index() 19 | { 20 | $posts = $this->postModel->with('user')->get(); 21 | 22 | return response()->json($posts->toArray()); 23 | } 24 | 25 | public function show($id) 26 | { 27 | $post = $this->postModel->with('user')->find($id); 28 | 29 | if (!$post) { 30 | return $this->recordNotFound(); 31 | } 32 | 33 | return response()->json($post); 34 | } 35 | 36 | public function store(Request $request) 37 | { 38 | $this->validate($request, [ 39 | 'title' => 'required|max:255|unique:posts', 40 | 'content' => 'required', 41 | 'status' => 'required|in:published,draft', 42 | 'excerpt' => 'required' 43 | ]); 44 | 45 | $post = new $this->postModel([ 46 | 'title' => $request->input('title'), 47 | 'slug' => str_slug($request->input('name')), 48 | 'content' => $request->input('content'), 49 | 'status' => $request->input('status'), 50 | 'excerpt' => $request->input('excerpt') 51 | ]); 52 | $request->user()->posts()->save($post); 53 | 54 | return response()->json($post); 55 | } 56 | 57 | public function update(Request $request, $id) 58 | { 59 | $this->validate($request, [ 60 | 'title' => 'required|max:255|unique:posts', 61 | 'content' => 'required', 62 | 'status' => 'required|in:published,draft', 63 | 'excerpt' => 'required' 64 | ]); 65 | 66 | $post = $this->postModel->find($id); 67 | 68 | if (!$post) { 69 | return $this->recordNotFound(); 70 | } 71 | 72 | $post->title = $request->input('title'); 73 | $post->slug = str_slug($request->input('name')); 74 | $post->content = $request->input('content'); 75 | $post->status = $request->input('status'); 76 | $post->excerpt = $request->input('excerpt'); 77 | $post->save(); 78 | 79 | return response()->json($post); 80 | } 81 | 82 | public function destroy($id) 83 | { 84 | $post = $this->postModel->find($id); 85 | 86 | if (!$post) { 87 | return $this->recordNotFound(); 88 | } 89 | 90 | $post->delete(); 91 | 92 | return response(null, 200); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/TeamsController.php: -------------------------------------------------------------------------------- 1 | teamModel = $teamModel; 16 | } 17 | 18 | public function index() 19 | { 20 | $teams = $this->teamModel->all(); 21 | return response()->json($teams->toArray()); 22 | } 23 | 24 | public function show($id) 25 | { 26 | $team = $this->teamModel->find($id); 27 | 28 | if (!$team) { 29 | return $this->recordNotFound(); 30 | } 31 | 32 | return response()->json($team); 33 | } 34 | 35 | public function store(Request $request) 36 | { 37 | $this->validate($request, [ 38 | 'name' => 'required|max:255', 39 | 'description' => 'required' 40 | ]); 41 | 42 | $team = new $this->teamModel([ 43 | 'name' => $request->input('name'), 44 | 'slug' => str_slug($request->input('name')), 45 | 'description' => $request->input('description'), 46 | 'team_information' => 'Some default value... rip', 47 | 'owner_id' => $request->user()->id 48 | ]); 49 | $team->save(); 50 | 51 | return response()->json($team); 52 | } 53 | 54 | public function update(Request $request, $id) 55 | { 56 | $this->validate($request, [ 57 | 'name' => 'required|max:255', 58 | 'description' => 'required' 59 | ]); 60 | 61 | $team = $this->teamModel->find($id); 62 | 63 | if (!$team) { 64 | return $this->recordNotFound(); 65 | } 66 | 67 | $team->name = $request->input('name'); 68 | $team->slug = str_slug($request->input('name')); 69 | $team->description = $request->input('description'); 70 | 71 | $team->save(); 72 | 73 | return response()->json($team); 74 | } 75 | 76 | public function destroy($id) 77 | { 78 | $team = $this->teamModel->find($id); 79 | 80 | if (!$team) { 81 | return $this->recordNotFound(); 82 | } 83 | 84 | $team->delete(); 85 | 86 | return response(null, 200); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /app/Http/Controllers/Api/TournamentsController.php: -------------------------------------------------------------------------------- 1 | userModel = $userModel; 13 | } 14 | 15 | public function index() 16 | { 17 | $users = $this->userModel->all(); 18 | 19 | return response()->json($users->toArray()); 20 | } 21 | 22 | public function show($id) 23 | { 24 | $user = $this->userModel->find($id); 25 | 26 | if (!$user) { 27 | return $this->recordNotFound(); 28 | } 29 | 30 | return response()->json($user); 31 | } 32 | 33 | public function verify() 34 | { 35 | 36 | } 37 | 38 | public function destroy($id) 39 | { 40 | $user = $this->userModel->find($id); 41 | 42 | if (!$user) { 43 | return $this->recordNotFound(); 44 | } 45 | 46 | $user->delete(); 47 | return response(null, 200); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ForgotPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/LoginController.php: -------------------------------------------------------------------------------- 1 | middleware('guest', ['except' => 'logout']); 32 | } 33 | } -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/PasswordController.php: -------------------------------------------------------------------------------- 1 | middleware($this->guestMiddleware()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/RegisterController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 42 | } 43 | 44 | /** 45 | * Get a validator for an incoming registration request. 46 | * 47 | * @param array $data 48 | * @return \Illuminate\Contracts\Validation\Validator 49 | */ 50 | protected function validator(array $data) 51 | { 52 | return Validator::make($data, [ 53 | 'username' => 'required|unique:users', 54 | 'name' => 'required|max:255', 55 | 'email' => 'required|email|max:255|unique:users', 56 | 'password' => 'required|min:6|confirmed', 57 | ]); 58 | } 59 | 60 | /** 61 | * Create a new user instance after a valid registration. 62 | * 63 | * @param array $data 64 | * @return User 65 | */ 66 | protected function create(array $data) 67 | { 68 | $user = User::create([ 69 | 'username' => $data['username'], 70 | 'name' => $data['name'], 71 | 'email' => $data['email'], 72 | 'password' => bcrypt($data['password']), 73 | ]); 74 | 75 | // Create an access token for the user... 76 | // when there are JSON components in the front-end.. 77 | // $token = $user->createToken('Personal Token', ['regular'])->accessToken; 78 | 79 | // Probably should be queued... 80 | Mail::to($data['email'])->send(new AccountCreated($user)); 81 | return $user; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/Http/Controllers/Auth/ResetPasswordController.php: -------------------------------------------------------------------------------- 1 | middleware('guest'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | json([ 24 | 'message' => 'Record not found' 25 | ], 404); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /app/Http/Controllers/Site/HomeController.php: -------------------------------------------------------------------------------- 1 | getTournaments(); 28 | dd($tournaments); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Controllers/Site/PageController.php: -------------------------------------------------------------------------------- 1 | first(); 20 | return renderView('player-view', ['user' => $user]); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Controllers/Site/ProfileController.php: -------------------------------------------------------------------------------- 1 | middleware('auth'); 16 | } 17 | 18 | public function index() 19 | { 20 | return renderView('teams'); 21 | } 22 | 23 | public function show($id) 24 | { 25 | return renderView('team-view', ['team' => Team::find($id)]); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Controllers/Site/TeamInvitesController.php: -------------------------------------------------------------------------------- 1 | check()) { 22 | User::acceptInvite($invite); 23 | return redirect('/teams'); 24 | } else { 25 | session(['invite_token' => $token]); 26 | return redirect()->to('login'); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/Http/Controllers/Site/TournamentController.php: -------------------------------------------------------------------------------- 1 | $tournament]); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 27 | \App\Http\Middleware\EncryptCookies::class, 28 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 29 | \Illuminate\Session\Middleware\StartSession::class, 30 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 31 | \App\Http\Middleware\VerifyCsrfToken::class, 32 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 33 | ], 34 | 35 | 'api' => [ 36 | 'throttle:60,1', 37 | 'bindings', 38 | ], 39 | ]; 40 | 41 | /** 42 | * The application's route middleware. 43 | * 44 | * These middleware may be assigned to groups or used individually. 45 | * 46 | * @var array 47 | */ 48 | protected $routeMiddleware = [ 49 | 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 50 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 51 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 52 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 53 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 54 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 55 | 'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class, 56 | 'scope' => \Laravel\Passport\Http\Middleware\CheckForAnyScope::class, 57 | ]; 58 | } 59 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | check()) { 22 | return redirect('/'); 23 | } 24 | 25 | return $next($request); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | user = $user; 30 | } 31 | 32 | /** 33 | * Build the message. 34 | * 35 | * TODO: use the with() method to prevent developers from having to 36 | * specifically edit this file with more information? OR something like that. 37 | * @return $this 38 | */ 39 | public function build() 40 | { 41 | return $this->view('emails.accounts.created'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/Models/Game.php: -------------------------------------------------------------------------------- 1 | belongsToMany('App\Models\Platform', 'platform_game'); 23 | } 24 | 25 | public function toArray() 26 | { 27 | $data = parent::toArray(); 28 | 29 | if ($this->platforms) { 30 | $data['platforms'] = $this->platforms->toArray(); 31 | } else { 32 | $data['platforms'] = null; 33 | } 34 | 35 | return $data; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Models/Platform.php: -------------------------------------------------------------------------------- 1 | belongsToMany('App\Models\Game', 'platform_game'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Models/Post.php: -------------------------------------------------------------------------------- 1 | belongsTo('App\Models\User'); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /app/Models/Team.php: -------------------------------------------------------------------------------- 1 | belongsToMany('App\Models\User', 'team_user') 27 | ->withPivot(['is_admin']); 28 | } 29 | 30 | // A team can be signed-up for many tournaments. 31 | public function tournaments() 32 | { 33 | return $this->belongsToMany('App\Models\Tournament', 'team_tournament') 34 | ->withPivot(['checked_in', 'disqualified']); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/Models/TeamInvite.php: -------------------------------------------------------------------------------- 1 | where('accept_token', '=', $token)->first(); 13 | } 14 | 15 | public function team() 16 | { 17 | return $this->hasOne('App\Models\Team', 'id', 'team_id'); 18 | } 19 | 20 | public function user() 21 | { 22 | return $this->hasOne('App\Models\User', 'id', 'user_id'); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Models/Tournament.php: -------------------------------------------------------------------------------- 1 | belongsToMany('App\Models\Team', 'team_tournament'); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | teams()->toggle($invite->team); 36 | $invite->delete(); 37 | } 38 | 39 | public function posts() 40 | { 41 | return $this->hasMany('App\Models\Post'); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/Notifications/JoinedTournamentConfirmation.php: -------------------------------------------------------------------------------- 1 | line('The introduction to the notification.') 45 | ->action('Notification Action', 'https://laravel.com') 46 | ->line('Thank you for using our application!'); 47 | } 48 | 49 | /** 50 | * Get the array representation of the notification. 51 | * 52 | * @param mixed $notifiable 53 | * @return array 54 | */ 55 | public function toArray($notifiable) 56 | { 57 | return [ 58 | // 59 | ]; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/Notifications/ReceivedTeamInvitation.php: -------------------------------------------------------------------------------- 1 | team = $team; 25 | $this->invite_token = $invite_token; 26 | } 27 | 28 | /** 29 | * Get the notification's delivery channels. 30 | * 31 | * COULD Probably do a database notification as well for on-site notifications. 32 | * 33 | * @param mixed $notifiable 34 | * @return array 35 | */ 36 | public function via($notifiable) 37 | { 38 | return ['mail']; 39 | } 40 | 41 | /** 42 | * Get the mail representation of the notification. 43 | * 44 | * @param mixed $notifiable 45 | * @return \Illuminate\Notifications\Messages\MailMessage 46 | */ 47 | public function toMail($notifiable) 48 | { 49 | $invite_url = config('app.url') . '/teams/invite/' . $this->invite_token; 50 | return (new MailMessage) 51 | ->success() 52 | ->line('Congrats! You have just been invited to the team: "'. $this->team->name .'"!') 53 | ->action('Accept Invite', $invite_url) 54 | ->line('If there are any issues, please contact the team admin directly.'); 55 | } 56 | 57 | /** 58 | * Get the array representation of the notification. 59 | * 60 | * @param mixed $notifiable 61 | * @return array 62 | */ 63 | public function toArray($notifiable) 64 | { 65 | return [ 66 | // 67 | ]; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/Notifications/TournamentStarting.php: -------------------------------------------------------------------------------- 1 | `"); 40 | } 41 | 42 | /** 43 | * Get the mail representation of the notification. 44 | * THIS IS DUMMY DATA... 45 | * @param mixed $notifiable 46 | * @return \Illuminate\Notifications\Messages\MailMessage 47 | */ 48 | public function toMail($notifiable) 49 | { 50 | return (new MailMessage) 51 | ->line('The tournament you have joined is now starting.') 52 | ->action('Click Here to Check-in', 'https://bracket/tournament/12/checkin') 53 | ->line('GLHF!') 54 | ->line('You are receiving this notification because you signed up for a tournament.'); 55 | } 56 | 57 | /** 58 | * Get the array representation of the notification. 59 | * 60 | * @param mixed $notifiable 61 | * @return array 62 | */ 63 | public function toArray($notifiable) 64 | { 65 | return [ 66 | // 67 | ]; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 18 | ]; 19 | 20 | /** 21 | * Register any authentication / authorization services. 22 | * 23 | * @return void 24 | */ 25 | public function boot() 26 | { 27 | $this->registerPolicies(); 28 | 29 | // Permissions for API routes 30 | Passport::tokensCan([ 31 | 'admin' => 'Allows access to all API endpoints and actions.', 32 | 'users' => 'Allows read access to users and access to own user account.', 33 | 'posts' => 'Allows access to publish and read posts.', 34 | 'tournaments' => 'Allows read access to tournaments.', 35 | 'teams' => 'Allows read access to teams and write access to own account.', 36 | 'user' => 'Allows read/write access to own account and read access to most API endpoints.' 37 | ]); 38 | 39 | Passport::routes(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'App\Listeners\EventListener', 18 | ], 19 | ]; 20 | 21 | /** 22 | * Register any events for your application. 23 | * 24 | * @return void 25 | */ 26 | public function boot() 27 | { 28 | parent::boot(); 29 | 30 | // 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapWebRoutes(); 39 | 40 | $this->mapApiRoutes(); 41 | 42 | // 43 | } 44 | 45 | /** 46 | * Define the "web" routes for the application. 47 | * 48 | * These routes all receive session state, CSRF protection, etc. 49 | * 50 | * @return void 51 | */ 52 | protected function mapWebRoutes() 53 | { 54 | Route::group([ 55 | 'namespace' => $this->namespace, 'middleware' => 'web', 56 | ], function ($router) { 57 | require base_path('routes/web.php'); 58 | }); 59 | } 60 | 61 | /** 62 | * Define the "api" routes for the application. 63 | * 64 | * These routes are typically stateless. 65 | * TODO: RE-add auth:api to the middleware scope 66 | * @return void 67 | */ 68 | protected function mapApiRoutes() 69 | { 70 | Route::group([ 71 | 'middleware' => ['api'], 72 | 'namespace' => $this->namespace, 73 | 'prefix' => 'api', 74 | ], function ($router) { 75 | require base_path('routes/api.php'); 76 | }); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /app/Support/Helpers.php: -------------------------------------------------------------------------------- 1 | 'No extra data.']) { 5 | $defaults = [ 6 | 'games' => App\Models\Game::all(), 7 | 'platforms' => App\Models\Platform::all(), 8 | 'users' => App\Models\User::all(), 9 | 'teams' => App\Models\Team::all(), 10 | ]; 11 | 12 | // Filter out data based on what the view accesses? 13 | // or something similar... 14 | 15 | // TODO: figure out how to extract needed values? if this is wanted I suppose 16 | // renderView('members', ['members', 'teams', 'tournaments']); 17 | // renderView('members', 'view', ['members', 'teams', 'tournaments']); 18 | 19 | $page_data = array_merge($defaults, $extras); 20 | return view('site.' . $view, $page_data); 21 | } 22 | 23 | function getViewData($name) { 24 | // an array of things a view can access 25 | $accessible = [ 26 | 'users', 'games', 'platforms', 'tournaments' 27 | ]; 28 | 29 | // get the data based on name? 30 | // return the data as a collection? 31 | // do something? 32 | } -------------------------------------------------------------------------------- /app/Traits/Teams/TeamTrait.php: -------------------------------------------------------------------------------- 1 | user_id = $user; 17 | $invite->team_id = $this->id; 18 | $invite->email = $user->email; 19 | $invite->accept_token = $token; 20 | $invite->deny_token = $token; 21 | $invite->save(); 22 | 23 | $notification = new ReceivedTeamInvitation($this, $token); 24 | return $user->notify($notification); 25 | } 26 | 27 | // Should re-send the invitation based on the invitation $id. 28 | public function resendInvite() { return false; } 29 | 30 | // Removes a user from a team. 31 | public function removeUser(User $user) 32 | { 33 | return $this->members()->toggle($user); 34 | } 35 | 36 | public function hasMember(User $user) 37 | { 38 | return $this->members()->where('id', "=", $user->id)->first() ? true : false; 39 | } 40 | 41 | public function owner() 42 | { 43 | return $this->hasOne('App\Models\User', 'id', 'owner_id'); 44 | } 45 | 46 | public function invites() 47 | { 48 | // should return all the invites that have been sent out! 49 | } 50 | 51 | public function members() 52 | { 53 | return $this->belongsToMany('App\Models\User', 'team_user') 54 | ->withPivot(['is_admin']); 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /app/Traits/Users/HasTeams.php: -------------------------------------------------------------------------------- 1 | teams()->toggle($team); 13 | } 14 | 15 | // define the relationship 16 | public function teams() 17 | { 18 | return $this->belongsToMany('App\Models\Team', 'team_user'); 19 | } 20 | 21 | } -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 32 | 33 | $status = $kernel->handle( 34 | $input = new Symfony\Component\Console\Input\ArgvInput, 35 | new Symfony\Component\Console\Output\ConsoleOutput 36 | ); 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Shutdown The Application 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Once Artisan has finished running. We will fire off the shutdown events 44 | | so that any final work may be done by the application before we shut 45 | | down the process. This is the last thing to happen to the request. 46 | | 47 | */ 48 | 49 | $kernel->terminate($input, $status); 50 | 51 | exit($status); 52 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/autoload.php: -------------------------------------------------------------------------------- 1 | =5.6.4", 9 | "laravel/framework": "5.3.*", 10 | "team-reflex/challonge-php": "^1.0", 11 | "laravel/passport": "^1.0@dev", 12 | "laravel-notification-channels/discord": "^0.0.1", 13 | "team-reflex/discord-php": "^4.0" 14 | }, 15 | "require-dev": { 16 | "fzaninotto/faker": "~1.4", 17 | "mockery/mockery": "0.9.*", 18 | "phpunit/phpunit": "~5.0", 19 | "symfony/css-selector": "3.1.*", 20 | "symfony/dom-crawler": "3.1.*", 21 | "laravel/homestead": "^3.0", 22 | "doctrine/dbal": "^2.5" 23 | }, 24 | "autoload": { 25 | "classmap": [ 26 | "database" 27 | ], 28 | "psr-4": { 29 | "App\\": "app/" 30 | }, 31 | "files": [ 32 | "app/Support/Helpers.php" 33 | ] 34 | }, 35 | "autoload-dev": { 36 | "classmap": [ 37 | "tests/TestCase.php" 38 | ] 39 | }, 40 | "scripts": { 41 | "post-root-package-install": [ 42 | "php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 43 | ], 44 | "post-create-project-cmd": [ 45 | "php artisan key:generate" 46 | ], 47 | "post-install-cmd": [ 48 | "Illuminate\\Foundation\\ComposerScripts::postInstall", 49 | "php artisan optimize" 50 | ], 51 | "post-update-cmd": [ 52 | "Illuminate\\Foundation\\ComposerScripts::postUpdate", 53 | "php artisan optimize" 54 | ] 55 | }, 56 | "config": { 57 | "preferred-install": "dist" 58 | }, 59 | "minimum-stability": "dev", 60 | "prefer-stable": true 61 | } 62 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session", "token" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | 44 | 'api' => [ 45 | 'driver' => 'passport', 46 | 'provider' => 'users', 47 | ], 48 | ], 49 | 50 | /* 51 | |-------------------------------------------------------------------------- 52 | | User Providers 53 | |-------------------------------------------------------------------------- 54 | | 55 | | All authentication drivers have a user provider. This defines how the 56 | | users are actually retrieved out of your database or other storage 57 | | mechanisms used by this application to persist your user's data. 58 | | 59 | | If you have multiple user tables or models you may configure multiple 60 | | sources which represent each model / table. These sources may then 61 | | be assigned to any extra authentication guards you have defined. 62 | | 63 | | Supported: "database", "eloquent" 64 | | 65 | */ 66 | 67 | 'providers' => [ 68 | 'users' => [ 69 | 'driver' => 'eloquent', 70 | 'model' => App\Models\User::class, 71 | ], 72 | 73 | // 'users' => [ 74 | // 'driver' => 'database', 75 | // 'table' => 'users', 76 | // ], 77 | ], 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Resetting Passwords 82 | |-------------------------------------------------------------------------- 83 | | 84 | | Here you may set the options for resetting passwords including the view 85 | | that is your password reset e-mail. You may also set the name of the 86 | | table that maintains all of the reset tokens for your application. 87 | | 88 | | You may specify multiple password reset configurations if you have more 89 | | than one user table or model in the application and you want to have 90 | | separate password reset settings based on the specific user types. 91 | | 92 | | The expire time is the number of minutes that the reset token should be 93 | | considered valid. This security feature keeps tokens short-lived so 94 | | they have less time to be guessed. You may change this as needed. 95 | | 96 | */ 97 | 98 | 'passwords' => [ 99 | 'users' => [ 100 | 'provider' => 'users', 101 | 'table' => 'password_resets', 102 | 'expire' => 60, 103 | ], 104 | ], 105 | 106 | ]; 107 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'pusher'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_KEY'), 36 | 'secret' => env('PUSHER_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | // 40 | ], 41 | ], 42 | 43 | 'redis' => [ 44 | 'driver' => 'redis', 45 | 'connection' => 'default', 46 | ], 47 | 48 | 'log' => [ 49 | 'driver' => 'log', 50 | ], 51 | 52 | ], 53 | 54 | ]; 55 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | */ 30 | 31 | 'stores' => [ 32 | 33 | 'apc' => [ 34 | 'driver' => 'apc', 35 | ], 36 | 37 | 'array' => [ 38 | 'driver' => 'array', 39 | ], 40 | 41 | 'database' => [ 42 | 'driver' => 'database', 43 | 'table' => 'cache', 44 | 'connection' => null, 45 | ], 46 | 47 | 'file' => [ 48 | 'driver' => 'file', 49 | 'path' => storage_path('framework/cache'), 50 | ], 51 | 52 | 'memcached' => [ 53 | 'driver' => 'memcached', 54 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 55 | 'sasl' => [ 56 | env('MEMCACHED_USERNAME'), 57 | env('MEMCACHED_PASSWORD'), 58 | ], 59 | 'options' => [ 60 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 61 | ], 62 | 'servers' => [ 63 | [ 64 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 65 | 'port' => env('MEMCACHED_PORT', 11211), 66 | 'weight' => 100, 67 | ], 68 | ], 69 | ], 70 | 71 | 'redis' => [ 72 | 'driver' => 'redis', 73 | 'connection' => 'default', 74 | ], 75 | 76 | ], 77 | 78 | /* 79 | |-------------------------------------------------------------------------- 80 | | Cache Key Prefix 81 | |-------------------------------------------------------------------------- 82 | | 83 | | When utilizing a RAM based store such as APC or Memcached, there might 84 | | be other applications utilizing the same cache. So, we'll specify a 85 | | value to get prefixed to all our keys so we can avoid collisions. 86 | | 87 | */ 88 | 89 | 'prefix' => 'laravel', 90 | 91 | ]; 92 | -------------------------------------------------------------------------------- /config/compile.php: -------------------------------------------------------------------------------- 1 | [ 17 | // 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled File Providers 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may list service providers which define a "compiles" function 26 | | that returns additional files that should be compiled, providing an 27 | | easy way to get common files from any packages you are utilizing. 28 | | 29 | */ 30 | 31 | 'providers' => [ 32 | // 33 | ], 34 | 35 | ]; 36 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | PDO::FETCH_OBJ, 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Default Database Connection Name 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may specify which of the database connections below you wish 24 | | to use as your default connection for all database work. Of course 25 | | you may use many connections at once using the Database library. 26 | | 27 | */ 28 | 29 | 'default' => env('DB_CONNECTION', 'mysql'), 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Database Connections 34 | |-------------------------------------------------------------------------- 35 | | 36 | | Here are each of the database connections setup for your application. 37 | | Of course, examples of configuring each database platform that is 38 | | supported by Laravel is shown below to make development simple. 39 | | 40 | | 41 | | All database work in Laravel is done through the PHP PDO facilities 42 | | so make sure you have the driver for your particular database of 43 | | choice installed on your machine before you begin development. 44 | | 45 | */ 46 | 47 | 'connections' => [ 48 | 49 | 'sqlite' => [ 50 | 'driver' => 'sqlite', 51 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 52 | 'prefix' => '', 53 | ], 54 | 55 | 'mysql' => [ 56 | 'driver' => 'mysql', 57 | 'host' => env('DB_HOST', 'localhost'), 58 | 'port' => env('DB_PORT', '3306'), 59 | 'database' => env('DB_DATABASE', 'forge'), 60 | 'username' => env('DB_USERNAME', 'forge'), 61 | 'password' => env('DB_PASSWORD', ''), 62 | 'charset' => 'utf8', 63 | 'collation' => 'utf8_unicode_ci', 64 | 'prefix' => '', 65 | 'strict' => true, 66 | 'engine' => null, 67 | ], 68 | 69 | 'pgsql' => [ 70 | 'driver' => 'pgsql', 71 | 'host' => env('DB_HOST', 'localhost'), 72 | 'port' => env('DB_PORT', '5432'), 73 | 'database' => env('DB_DATABASE', 'forge'), 74 | 'username' => env('DB_USERNAME', 'forge'), 75 | 'password' => env('DB_PASSWORD', ''), 76 | 'charset' => 'utf8', 77 | 'prefix' => '', 78 | 'schema' => 'public', 79 | 'sslmode' => 'prefer', 80 | ], 81 | 82 | ], 83 | 84 | /* 85 | |-------------------------------------------------------------------------- 86 | | Migration Repository Table 87 | |-------------------------------------------------------------------------- 88 | | 89 | | This table keeps track of all the migrations that have already run for 90 | | your application. Using this information, we can determine which of 91 | | the migrations on disk haven't actually been run in the database. 92 | | 93 | */ 94 | 95 | 'migrations' => 'migrations', 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Redis Databases 100 | |-------------------------------------------------------------------------- 101 | | 102 | | Redis is an open source, fast, and advanced key-value store that also 103 | | provides a richer set of commands than a typical key-value systems 104 | | such as APC or Memcached. Laravel makes it easy to dig right in. 105 | | 106 | */ 107 | 108 | 'redis' => [ 109 | 110 | 'cluster' => false, 111 | 112 | 'default' => [ 113 | 'host' => env('REDIS_HOST', 'localhost'), 114 | 'password' => env('REDIS_PASSWORD', null), 115 | 'port' => env('REDIS_PORT', 6379), 116 | 'database' => 0, 117 | ], 118 | 119 | ], 120 | 121 | ]; 122 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | 'local', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Default Cloud Filesystem Disk 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Many applications store files both locally and in the cloud. For this 26 | | reason, you may specify a default "cloud" driver here. This driver 27 | | will be bound as the Cloud disk implementation in the container. 28 | | 29 | */ 30 | 31 | 'cloud' => 's3', 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Filesystem Disks 36 | |-------------------------------------------------------------------------- 37 | | 38 | | Here you may configure as many filesystem "disks" as you wish, and you 39 | | may even configure multiple disks of the same driver. Defaults have 40 | | been setup for each driver as an example of the required options. 41 | | 42 | */ 43 | 44 | 'disks' => [ 45 | 46 | 'local' => [ 47 | 'driver' => 'local', 48 | 'root' => storage_path('app'), 49 | ], 50 | 51 | 'public' => [ 52 | 'driver' => 'local', 53 | 'root' => storage_path('app/public'), 54 | 'visibility' => 'public', 55 | ], 56 | 57 | 's3' => [ 58 | 'driver' => 's3', 59 | 'key' => 'your-key', 60 | 'secret' => 'your-secret', 61 | 'region' => 'your-region', 62 | 'bucket' => 'your-bucket', 63 | ], 64 | 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_DRIVER', 'smtp'), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | SMTP Host Address 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may provide the host address of the SMTP server used by your 27 | | applications. A default option is provided that is compatible with 28 | | the Mailgun mail service which will provide reliable deliveries. 29 | | 30 | */ 31 | 32 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | SMTP Host Port 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This is the SMTP port used by your application to deliver e-mails to 40 | | users of the application. Like the host we have set this value to 41 | | stay compatible with the Mailgun e-mail application by default. 42 | | 43 | */ 44 | 45 | 'port' => env('MAIL_PORT', 587), 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Global "From" Address 50 | |-------------------------------------------------------------------------- 51 | | 52 | | You may wish for all e-mails sent by your application to be sent from 53 | | the same address. Here, you may specify a name and address that is 54 | | used globally for all e-mails that are sent by your application. 55 | | 56 | */ 57 | 58 | 'from' => ['address' => 'bracket@bracket.dev', 'name' => 'Bracket Development'], 59 | 60 | /* 61 | |-------------------------------------------------------------------------- 62 | | E-Mail Encryption Protocol 63 | |-------------------------------------------------------------------------- 64 | | 65 | | Here you may specify the encryption protocol that should be used when 66 | | the application send e-mail messages. A sensible default using the 67 | | transport layer security protocol should provide great security. 68 | | 69 | */ 70 | 71 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | SMTP Server Username 76 | |-------------------------------------------------------------------------- 77 | | 78 | | If your SMTP server requires a username for authentication, you should 79 | | set it here. This will get used to authenticate with your server on 80 | | connection. You may also set the "password" value below this one. 81 | | 82 | */ 83 | 84 | 'username' => env('MAIL_USERNAME'), 85 | 86 | /* 87 | |-------------------------------------------------------------------------- 88 | | SMTP Server Password 89 | |-------------------------------------------------------------------------- 90 | | 91 | | Here you may set the password required by your SMTP server to send out 92 | | messages from your application. This will be given to the server on 93 | | connection so that the application will be able to send messages. 94 | | 95 | */ 96 | 97 | 'password' => env('MAIL_PASSWORD'), 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Sendmail System Path 102 | |-------------------------------------------------------------------------- 103 | | 104 | | When using the "sendmail" driver to send e-mails, we will need to know 105 | | the path to where Sendmail lives on this server. A default path has 106 | | been provided here, which will work well on most of your systems. 107 | | 108 | */ 109 | 110 | 'sendmail' => '/usr/sbin/sendmail -bs', 111 | 112 | 'pretend' => false, 113 | 114 | ]; 115 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_DRIVER', 'sync'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Queue Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may configure the connection information for each server that 26 | | is used by your application. A default configuration has been added 27 | | for each back-end shipped with Laravel. You are free to add more. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | ], 43 | 44 | 'beanstalkd' => [ 45 | 'driver' => 'beanstalkd', 46 | 'host' => 'localhost', 47 | 'queue' => 'default', 48 | 'retry_after' => 90, 49 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => 'your-public-key', 54 | 'secret' => 'your-secret-key', 55 | 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', 56 | 'queue' => 'your-queue-name', 57 | 'region' => 'us-east-1', 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => 'default', 64 | 'retry_after' => 90, 65 | ], 66 | 67 | ], 68 | 69 | /* 70 | |-------------------------------------------------------------------------- 71 | | Failed Queue Jobs 72 | |-------------------------------------------------------------------------- 73 | | 74 | | These options configure the behavior of failed queue job logging so you 75 | | can control which database and table are used to store the jobs that 76 | | have failed. You may change them to any database / table you wish. 77 | | 78 | */ 79 | 80 | 'failed' => [ 81 | 'database' => env('DB_CONNECTION', 'mysql'), 82 | 'table' => 'failed_jobs', 83 | ], 84 | 85 | ]; 86 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | ], 21 | 22 | 'discord' => [ 23 | 'token' => env('DISCORD_TOKEN', null), 24 | ], 25 | 26 | 'ses' => [ 27 | 'key' => env('SES_KEY'), 28 | 'secret' => env('SES_SECRET'), 29 | 'region' => 'us-east-1', 30 | ], 31 | 32 | 'sparkpost' => [ 33 | 'secret' => env('SPARKPOST_SECRET'), 34 | ], 35 | 36 | 'stripe' => [ 37 | 'model' => App\User::class, 38 | 'key' => env('STRIPE_KEY'), 39 | 'secret' => env('STRIPE_SECRET'), 40 | ], 41 | 42 | ]; 43 | -------------------------------------------------------------------------------- /config/teamwork.php: -------------------------------------------------------------------------------- 1 | App\User::class, 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Teamwork users Table 24 | |-------------------------------------------------------------------------- 25 | | 26 | | This is the users table name used by Teamwork. 27 | | 28 | */ 29 | 'users_table' => 'users', 30 | 31 | /* 32 | |-------------------------------------------------------------------------- 33 | | Teamwork Team Model 34 | |-------------------------------------------------------------------------- 35 | | 36 | | This is the Team model used by Teamwork to create correct relations. Update 37 | | the team if it is in a different namespace. 38 | | 39 | */ 40 | 'team_model' => Mpociot\Teamwork\TeamworkTeam::class, 41 | 42 | /* 43 | |-------------------------------------------------------------------------- 44 | | Teamwork teams Table 45 | |-------------------------------------------------------------------------- 46 | | 47 | | This is the teams table name used by Teamwork to save teams to the database. 48 | | 49 | */ 50 | 'teams_table' => 'teams', 51 | 52 | /* 53 | |-------------------------------------------------------------------------- 54 | | Teamwork team_user Table 55 | |-------------------------------------------------------------------------- 56 | | 57 | | This is the team_user table used by Teamwork to save assigned teams to the 58 | | database. 59 | | 60 | */ 61 | 'team_user_table' => 'team_user', 62 | 63 | /* 64 | |-------------------------------------------------------------------------- 65 | | User Foreign key on Teamwork's team_user Table (Pivot) 66 | |-------------------------------------------------------------------------- 67 | */ 68 | 'user_foreign_key' => 'id', 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Teamwork Team Invite Model 73 | |-------------------------------------------------------------------------- 74 | | 75 | | This is the Team Invite model used by Teamwork to create correct relations. 76 | | Update the team if it is in a different namespace. 77 | | 78 | */ 79 | 'invite_model' => Mpociot\Teamwork\TeamInvite::class, 80 | 81 | /* 82 | |-------------------------------------------------------------------------- 83 | | Teamwork team invites Table 84 | |-------------------------------------------------------------------------- 85 | | 86 | | This is the team invites table name used by Teamwork to save sent/pending 87 | | invitation into teams to the database. 88 | | 89 | */ 90 | 'team_invites_table' => 'team_invites', 91 | ]; 92 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | realpath(base_path('resources/views')), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => realpath(storage_path('framework/views')), 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /database/factories/ModelFactory.php: -------------------------------------------------------------------------------- 1 | define(App\Models\User::class, function (Faker\Generator $faker) { 15 | return [ 16 | 'username' => $faker->username, 17 | 'name' => $faker->name, 18 | 'email' => $faker->safeEmail, 19 | 'password' => bcrypt(str_random(10)), 20 | 'remember_token' => str_random(10), 21 | ]; 22 | }); 23 | 24 | $factory->define(App\Models\Game::class, function (Faker\Generator $faker) { 25 | return [ 26 | 'name' => $faker->name, 27 | 'short_name' => $faker->word, 28 | 'slug' => str_replace(' ', '-', $faker->name), 29 | 'logo' => '', 30 | 'banner' => '' 31 | ]; 32 | }); 33 | 34 | $factory->define(App\Models\Platform::class, function (Faker\Generator $faker) { 35 | return [ 36 | 'name' => $faker->name, 37 | 'short_name' => $faker->word, 38 | 'slug' => str_replace(' ', '-', $faker->name), 39 | 'logo' => '', 40 | 'banner' => '' 41 | ]; 42 | }); 43 | 44 | $factory->define(App\Models\Post::class, function (Faker\Generator $faker) { 45 | return [ 46 | 'title' => $faker->name, 47 | 'slug' => str_replace(' ', '-', $faker->name), 48 | 'content' => $faker->text($maxNbvChars=500), 49 | 'excerpt' => $faker->paragraph, 50 | 'status' => 'published', 51 | 'user_id' => 1 52 | ]; 53 | }); 54 | 55 | $factory->define(App\Models\Team::class, function (Faker\Generator $faker) { 56 | return [ 57 | 'name' => $faker->name, 58 | 'slug' => str_replace(' ', '-', $faker->name), 59 | 'description' => $faker->paragraph, 60 | 'team_information' => $faker->text($maxNbvChars=500), 61 | 'owner_id' => 1 62 | ]; 63 | }); 64 | -------------------------------------------------------------------------------- /database/migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->string('username')->unique(); 19 | $table->string('email')->unique(); 20 | $table->string('password'); 21 | $table->rememberToken(); 22 | $table->timestamps(); 23 | }); 24 | } 25 | 26 | /** 27 | * Reverse the migrations. 28 | * 29 | * @return void 30 | */ 31 | public function down() 32 | { 33 | Schema::drop('users'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 17 | $table->string('token')->index(); 18 | $table->timestamp('created_at'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::drop('password_resets'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /database/migrations/2016_05_25_043614_create_platforms_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name'); 18 | $table->string('short_name'); 19 | $table->string('slug')->unique(); 20 | $table->string('logo'); 21 | $table->string('banner'); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('platforms'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2016_05_25_043623_create_games_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->string('name', 100); 18 | $table->string('short_name'); 19 | $table->string('slug')->unique(); 20 | $table->string('logo'); 21 | $table->string('banner'); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::drop('games'); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /database/migrations/2016_05_25_184909_add_platform_game_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->integer('game_id'); 18 | $table->integer('platform_id'); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::drop('platform_game'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2016_07_29_061330_create_posts_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 17 | $table->integer('user_id')->unsigned(); 18 | $table->enum('status', ['published', 'draft']); 19 | $table->string('title'); 20 | $table->string('slug'); 21 | $table->text('content'); 22 | $table->string('excerpt'); 23 | $table->foreign('user_id')->references('id')->on('users'); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | // Schema::table('posts', function(Blueprint $table) { 36 | // $table->dropForeign(['user_id']); 37 | // }); 38 | Schema::drop('posts'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /database/migrations/2016_08_18_021209_create_tournaments_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 18 | $table->string('name'); 19 | $table->string('slug')->unique(); 20 | $table->string('description'); 21 | $table->text('rules')->nullable(); 22 | $table->text('prizes')->nullable(); 23 | $table->enum('type', ['single_elimination', 'double_elimination', 'round_robin', 'swiss'])->default('single_elimination'); 24 | $table->integer('challonge_id')->nullable(); 25 | $table->integer('checkin_time'); 26 | $table->dateTime('start_at'); 27 | $table->timestamps(); 28 | }); 29 | } 30 | 31 | /** 32 | * Reverse the migrations. 33 | * 34 | * @return void 35 | */ 36 | public function down() 37 | { 38 | Schema::drop('tournaments'); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /database/migrations/2016_08_18_062025_setup_team_tables.php: -------------------------------------------------------------------------------- 1 | integer('current_team_id')->unsigned()->nullable(); 18 | }); 19 | 20 | Schema::create('teams', function(Blueprint $table) { 21 | $table->increments('id'); 22 | $table->integer('owner_id')->unsigned(); 23 | 24 | $table->string('name'); 25 | $table->string('slug')->unique(); 26 | $table->string('description'); 27 | $table->text('team_information'); 28 | 29 | $table->timestamps(); 30 | }); 31 | 32 | Schema::create('team_user', function(Blueprint $table) { 33 | $table->integer('user_id')->unsigned(); 34 | $table->integer('team_id')->unsigned(); 35 | $table->timestamps(); 36 | 37 | $table->foreign('user_id')->references('id')->on('users')->onUpdate('cascade')->onDelete('cascade'); 38 | $table->foreign('team_id')->references('id')->on('teams')->onDelete('cascade'); 39 | }); 40 | 41 | Schema::create('team_invites', function(Blueprint $table) { 42 | $table->increments('id'); 43 | $table->integer('user_id')->unsigned(); 44 | $table->integer('team_id')->unsigned(); 45 | $table->enum('type', ['invite', 'request']); 46 | $table->string('accept_token'); 47 | $table->string('deny_token'); 48 | $table->timestamps(); 49 | 50 | $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); 51 | }); 52 | } 53 | 54 | /** 55 | * Reverse the migrations. 56 | * 57 | * @return void 58 | */ 59 | public function down() 60 | { 61 | Schema::table('users', function(Blueprint $table) { 62 | $table->dropColumn('current_team_id'); 63 | }); 64 | 65 | Schema::table('team_user', function(Blueprint $table) { 66 | $table->dropForeign('team_user_user_id_foreign'); 67 | $table->dropForeign('team_user_team_id_foreign'); 68 | }); 69 | 70 | Schema::drop('team_user'); 71 | Schema::drop('team_invites'); 72 | Schema::drop('teams'); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /database/seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /database/seeds/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var elixir = require('laravel-elixir'); 2 | 3 | require('laravel-elixir-vue'); 4 | 5 | /* 6 | |-------------------------------------------------------------------------- 7 | | Elixir Asset Management 8 | |-------------------------------------------------------------------------- 9 | | 10 | | Elixir provides a clean, fluent API for defining some basic Gulp tasks 11 | | for your Laravel application. By default, we are compiling the Sass 12 | | file for our application, as well as publishing vendor resources. 13 | | 14 | */ 15 | 16 | elixir(function(mix) { 17 | mix.sass('app.scss') 18 | .webpack('app.js', 'public/js', 'resources/assets/js') 19 | .webpack('main.js', 'public/js/admin', 'resources/assets/js/admin') 20 | .browserSync({ 21 | proxy: 'bracket', 22 | notify: false, 23 | open: false 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "prod": "gulp --production", 5 | "dev": "gulp watch" 6 | }, 7 | "devDependencies": { 8 | "animate.css": "^3.5.1", 9 | "animejs": "^1.1.0", 10 | "babel-plugin-lodash": "^3.2.0", 11 | "babel-plugin-transform-object-rest-spread": "^6.8.0", 12 | "babel-preset-stage-2": "^6.11.0", 13 | "bootstrap": "^4.0.0-alpha.3", 14 | "bootstrap-sass": "^3.3.0", 15 | "gulp": "^3.9.1", 16 | "jquery": "^3.1.0", 17 | "js-cookie": "^2.1.2", 18 | "laravel-elixir": "^6.0.0-9", 19 | "laravel-elixir-browserify-official": "^0.1.3", 20 | "laravel-elixir-browsersync-official": "^1.0.0", 21 | "laravel-elixir-vue": "^0.1.4", 22 | "laravel-elixir-webpack-official": "^1.0.2", 23 | "lodash": "^4.13.1", 24 | "nprogress": "^0.2.0", 25 | "tether": "^1.3.4", 26 | "vue": "^1.0.26", 27 | "vue-moment": "^2.0.1", 28 | "vue-resource": "^0.9.3", 29 | "vue-router": "^0.7.13" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests 14 | 15 | 16 | 17 | 18 | ./app 19 | 20 | ./app/Http/routes.php 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Redirect Trailing Slashes If Not A Folder... 9 | RewriteCond %{REQUEST_FILENAME} !-d 10 | RewriteRule ^(.*)/$ /$1 [L,R=301] 11 | 12 | # Handle Front Controller... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteRule ^ index.php [L] 16 | 17 | # Handle Authorization Header 18 | RewriteCond %{HTTP:Authorization} . 19 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 20 | 21 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g33kidd/bracket/c165d5f4d8f6d7eb3fde8a4b19ca89a0d56ae8d4/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | 9 | /* 10 | |-------------------------------------------------------------------------- 11 | | Register The Auto Loader 12 | |-------------------------------------------------------------------------- 13 | | 14 | | Composer provides a convenient, automatically generated class loader for 15 | | our application. We just need to utilize it! We'll simply require it 16 | | into the script here so that we don't have to worry about manual 17 | | loading any of our classes later on. It feels nice to relax. 18 | | 19 | */ 20 | 21 | require __DIR__.'/../bootstrap/autoload.php'; 22 | 23 | /* 24 | |-------------------------------------------------------------------------- 25 | | Turn On The Lights 26 | |-------------------------------------------------------------------------- 27 | | 28 | | We need to illuminate PHP development, so let us turn on the lights. 29 | | This bootstraps the framework and gets it ready for use, then it 30 | | will load up this application so that we can run it and send 31 | | the responses back to the browser and delight our users. 32 | | 33 | */ 34 | 35 | $app = require_once __DIR__.'/../bootstrap/app.php'; 36 | 37 | /* 38 | |-------------------------------------------------------------------------- 39 | | Run The Application 40 | |-------------------------------------------------------------------------- 41 | | 42 | | Once we have the application, we can handle the incoming request 43 | | through the kernel, and send the associated response back to 44 | | the client's browser allowing them to enjoy the creative 45 | | and wonderful application we have prepared for them. 46 | | 47 | */ 48 | 49 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Illuminate\Http\Request::capture() 53 | ); 54 | 55 | $response->send(); 56 | 57 | $kernel->terminate($request, $response); 58 | -------------------------------------------------------------------------------- /public/js/admin/0.main.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],{ 2 | 3 | /***/ 114: 4 | /***/ function(module, exports, __webpack_require__) { 5 | 6 | eval("var map = {\n\t\"./components/App.vue\": 117\n};\nfunction webpackContext(req) {\n\treturn __webpack_require__(webpackContextResolve(req));\n};\nfunction webpackContextResolve(req) {\n\tvar id = map[req];\n\tif(!(id + 1)) // check for number\n\t\tthrow new Error(\"Cannot find module '\" + req + \"'.\");\n\treturn id;\n};\nwebpackContext.keys = function webpackContextKeys() {\n\treturn Object.keys(map);\n};\nwebpackContext.resolve = webpackContextResolve;\nmodule.exports = webpackContext;\nwebpackContext.id = 114;\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTE0LmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vcmVzb3VyY2VzL2Fzc2V0cy9qcy9hZG1pbiBeLipcXC52dWUkPzg4MjMiXSwic291cmNlc0NvbnRlbnQiOlsidmFyIG1hcCA9IHtcblx0XCIuL2NvbXBvbmVudHMvQXBwLnZ1ZVwiOiAxMTdcbn07XG5mdW5jdGlvbiB3ZWJwYWNrQ29udGV4dChyZXEpIHtcblx0cmV0dXJuIF9fd2VicGFja19yZXF1aXJlX18od2VicGFja0NvbnRleHRSZXNvbHZlKHJlcSkpO1xufTtcbmZ1bmN0aW9uIHdlYnBhY2tDb250ZXh0UmVzb2x2ZShyZXEpIHtcblx0dmFyIGlkID0gbWFwW3JlcV07XG5cdGlmKCEoaWQgKyAxKSkgLy8gY2hlY2sgZm9yIG51bWJlclxuXHRcdHRocm93IG5ldyBFcnJvcihcIkNhbm5vdCBmaW5kIG1vZHVsZSAnXCIgKyByZXEgKyBcIicuXCIpO1xuXHRyZXR1cm4gaWQ7XG59O1xud2VicGFja0NvbnRleHQua2V5cyA9IGZ1bmN0aW9uIHdlYnBhY2tDb250ZXh0S2V5cygpIHtcblx0cmV0dXJuIE9iamVjdC5rZXlzKG1hcCk7XG59O1xud2VicGFja0NvbnRleHQucmVzb2x2ZSA9IHdlYnBhY2tDb250ZXh0UmVzb2x2ZTtcbm1vZHVsZS5leHBvcnRzID0gd2VicGFja0NvbnRleHQ7XG53ZWJwYWNrQ29udGV4dC5pZCA9IDExNDtcblxuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vcmVzb3VyY2VzL2Fzc2V0cy9qcy9hZG1pbiBeLipcXC52dWUkXG4vLyBtb2R1bGUgaWQgPSAxMTRcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7Iiwic291cmNlUm9vdCI6IiJ9"); 7 | 8 | /***/ }, 9 | 10 | /***/ 116: 11 | /***/ function(module, exports) { 12 | 13 | eval("module.exports = \"\\n\\n
\\n\\t\\n\\t\\n
\\n\";//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTE2LmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vcmVzb3VyY2VzL2Fzc2V0cy9qcy9hZG1pbi9jb21wb25lbnRzL0FwcC52dWU/MmVlNyJdLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IFwiXFxuPGFkbWluLWhlYWRlcj48L2FkbWluLWhlYWRlcj5cXG48ZGl2IGNsYXNzPVxcXCJjb250YWluZXIgbS10LTJcXFwiPlxcblxcdDxyb3V0ZXItdmlld1xcblxcdFxcdGNsYXNzPVxcXCJhbmltYXRlZFxcXCJcXG5cXHRcXHR0cmFuc2l0aW9uPVxcXCJmYWRlXFxcIlxcblxcdFxcdHRyYW5zaXRpb24tbW9kZT1cXFwib3V0LWluXFxcIj5cXG5cXHQ8L3JvdXRlci12aWV3PlxcbjwvZGl2PlxcblwiO1xuXG5cbi8vLy8vLy8vLy8vLy8vLy8vL1xuLy8gV0VCUEFDSyBGT09URVJcbi8vIC4vfi92dWUtaHRtbC1sb2FkZXIhLi9+L3Z1ZS1sb2FkZXIvbGliL3NlbGVjdG9yLmpzP3R5cGU9dGVtcGxhdGUmaW5kZXg9MCEuL3Jlc291cmNlcy9hc3NldHMvanMvYWRtaW4vY29tcG9uZW50cy9BcHAudnVlXG4vLyBtb2R1bGUgaWQgPSAxMTZcbi8vIG1vZHVsZSBjaHVua3MgPSAwIl0sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIifQ=="); 14 | 15 | /***/ }, 16 | 17 | /***/ 117: 18 | /***/ function(module, exports, __webpack_require__) { 19 | 20 | eval("var __vue_script__, __vue_template__\n__vue_template__ = __webpack_require__(116)\nmodule.exports = __vue_script__ || {}\nif (module.exports.__esModule) module.exports = module.exports.default\nif (__vue_template__) {\n(typeof module.exports === \"function\" ? (module.exports.options || (module.exports.options = {})) : module.exports).template = __vue_template__\n}\nif (false) {(function () { module.hot.accept()\n var hotAPI = require(\"vue-hot-reload-api\")\n hotAPI.install(require(\"vue\"), false)\n if (!hotAPI.compatible) return\n var id = \"./App.vue\"\n if (!module.hot.data) {\n hotAPI.createRecord(id, module.exports)\n } else {\n hotAPI.update(id, module.exports, __vue_template__)\n }\n})()}//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMTE3LmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vcmVzb3VyY2VzL2Fzc2V0cy9qcy9hZG1pbi9jb21wb25lbnRzL0FwcC52dWU/MWRkYiJdLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgX192dWVfc2NyaXB0X18sIF9fdnVlX3RlbXBsYXRlX19cbl9fdnVlX3RlbXBsYXRlX18gPSByZXF1aXJlKFwiISF2dWUtaHRtbC1sb2FkZXIhLi8uLi8uLi8uLi8uLi8uLi9ub2RlX21vZHVsZXMvdnVlLWxvYWRlci9saWIvc2VsZWN0b3IuanM/dHlwZT10ZW1wbGF0ZSZpbmRleD0wIS4vQXBwLnZ1ZVwiKVxubW9kdWxlLmV4cG9ydHMgPSBfX3Z1ZV9zY3JpcHRfXyB8fCB7fVxuaWYgKG1vZHVsZS5leHBvcnRzLl9fZXNNb2R1bGUpIG1vZHVsZS5leHBvcnRzID0gbW9kdWxlLmV4cG9ydHMuZGVmYXVsdFxuaWYgKF9fdnVlX3RlbXBsYXRlX18pIHtcbih0eXBlb2YgbW9kdWxlLmV4cG9ydHMgPT09IFwiZnVuY3Rpb25cIiA/IChtb2R1bGUuZXhwb3J0cy5vcHRpb25zIHx8IChtb2R1bGUuZXhwb3J0cy5vcHRpb25zID0ge30pKSA6IG1vZHVsZS5leHBvcnRzKS50ZW1wbGF0ZSA9IF9fdnVlX3RlbXBsYXRlX19cbn1cbmlmIChtb2R1bGUuaG90KSB7KGZ1bmN0aW9uICgpIHsgIG1vZHVsZS5ob3QuYWNjZXB0KClcbiAgdmFyIGhvdEFQSSA9IHJlcXVpcmUoXCJ2dWUtaG90LXJlbG9hZC1hcGlcIilcbiAgaG90QVBJLmluc3RhbGwocmVxdWlyZShcInZ1ZVwiKSwgZmFsc2UpXG4gIGlmICghaG90QVBJLmNvbXBhdGlibGUpIHJldHVyblxuICB2YXIgaWQgPSBcIi4vQXBwLnZ1ZVwiXG4gIGlmICghbW9kdWxlLmhvdC5kYXRhKSB7XG4gICAgaG90QVBJLmNyZWF0ZVJlY29yZChpZCwgbW9kdWxlLmV4cG9ydHMpXG4gIH0gZWxzZSB7XG4gICAgaG90QVBJLnVwZGF0ZShpZCwgbW9kdWxlLmV4cG9ydHMsIF9fdnVlX3RlbXBsYXRlX18pXG4gIH1cbn0pKCl9XG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9yZXNvdXJjZXMvYXNzZXRzL2pzL2FkbWluL2NvbXBvbmVudHMvQXBwLnZ1ZVxuLy8gbW9kdWxlIGlkID0gMTE3XG4vLyBtb2R1bGUgY2h1bmtzID0gMCJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9"); 21 | 22 | /***/ } 23 | 24 | }); -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /public/web.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | [![bracket on discord](https://img.shields.io/badge/discord-bracket--on--discord-738bd7.svg?style=flat-square)](https://discord.gg/qQnBPDm) 2 | [![bracket on trello](https://img.shields.io/badge/trello-bracket--on--trello-blue.svg?style=flat-square)](https://trello.com/b/hZrNNmTs/bracket) 3 | [![travis-ci master](https://img.shields.io/travis/g33kidd/bracket/master.svg?maxAge=2592000?style=flat-square)](https://travis-ci.org/g33kidd/bracket) 4 | [![travis-ci develop](https://img.shields.io/travis/g33kidd/bracket/develop.svg?maxAge=2592000?style=flat-square)](https://travis-ci.org/g33kidd/bracket) 5 | 6 | # Bracket 7 | Bracket is an all-purpose tournament organization platform. It allows gaming/tournament communities to come together with their own custom platform for communication, organization, ladders and much more. The platform is built with the Laravel framework so it's easy to extend, customize and make your own! 8 | 9 | ## Development 10 | Currently, this project is in development. If you'd like to use it for a tournament website, such as http://prorl.com then use it at your own risk - it's not feature-complete and things may break. (Oh, and yeah, there are no roles yet, so anybody can access the admin...) 11 | 12 | Here's a quick guide to get you started and playing around with Bracket: 13 | 14 | - I am currently using Laravel's Homestead which works on Windows, Linux and macOS. 15 | - This project is built using Laravel, so do consult with the Laravel Documentation for any questions you may have about the structure and inner workings of the application. 16 | - More coming soon.. 17 | 18 | ## FAQ 19 | #### Why use Bootstrap 4? 20 | For most of the site I've decided to use Bootstrap 4 to help find bugs, fix them and get some experience using it. There aren't a ton of bugs at the moment, but I'm sure there will be. You can easily customize all the templates/styles to remove BS4 and replace with something like BS3 or Foundation. 21 | #### How do I contribute? 22 | I'll be setting up some standards for this soon! Just find me on twitter if you want to help or submit a PR. It's open source, after all. 23 | #### Where do I find Documentation? 24 | This is coming really soon! -------------------------------------------------------------------------------- /resources/assets/js/admin/components/AdminHeader.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 37 | 38 | 54 | -------------------------------------------------------------------------------- /resources/assets/js/admin/components/App.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 24 | -------------------------------------------------------------------------------- /resources/assets/js/admin/components/Dashboard.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /resources/assets/js/admin/components/GamesManager.vue: -------------------------------------------------------------------------------- 1 | 92 | 93 | 161 | -------------------------------------------------------------------------------- /resources/assets/js/admin/components/OauthSettings.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | -------------------------------------------------------------------------------- /resources/assets/js/admin/components/PlatformsManager.vue: -------------------------------------------------------------------------------- 1 | 80 | 81 | 135 | -------------------------------------------------------------------------------- /resources/assets/js/admin/components/UsersManager.vue: -------------------------------------------------------------------------------- 1 | 74 | 75 | 106 | -------------------------------------------------------------------------------- /resources/assets/js/admin/components/passport/AuthorizedClients.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | 49 | 50 | 91 | -------------------------------------------------------------------------------- /resources/assets/js/admin/main.js: -------------------------------------------------------------------------------- 1 | // TODO: Figure out how to clean up this file... 2 | // it's just a bit messy at this point. 3 | window.Tether = require('tether'); 4 | require('bootstrap/dist/js/bootstrap.js'); 5 | 6 | import Vue from 'vue'; 7 | import Router from 'vue-router'; 8 | import Resource from 'vue-resource'; 9 | import NProgress from 'nprogress'; 10 | import VueMoment from 'vue-moment'; 11 | 12 | import App from './components/App.vue'; 13 | 14 | Vue.use(Router); 15 | Vue.use(Resource); 16 | Vue.use(VueMoment); 17 | 18 | NProgress.start(); 19 | NProgress.inc(0.2); 20 | 21 | Vue.transition('fade', { 22 | enterClass: 'fadeIn', 23 | leaveClass: 'fadeOut' 24 | }); 25 | 26 | let router = new Router({ 27 | saveScrollPosition: false, 28 | transitionOnLoad: true, 29 | history: true, 30 | root: '/admin' 31 | }); 32 | 33 | Vue.http.interceptors.push((request, next) => { 34 | NProgress.inc(0.2); 35 | request.headers['X-CSRF-TOKEN'] = Laravel.csrfToken; 36 | next((response) => { 37 | NProgress.done(); 38 | return response; 39 | }); 40 | }); 41 | 42 | router.beforeEach(({next}) => { 43 | // Close any and all bootstrap modals. 44 | $('.modal').modal('hide'); 45 | // Start the progress bar.. 46 | NProgress.start(); 47 | next(); 48 | }); 49 | 50 | router.afterEach(() => { 51 | NProgress.done(); 52 | }); 53 | 54 | router.map({ 55 | '/': { 56 | name: 'dashboard', 57 | navbar: "Dashboard", 58 | component: require('./components/Dashboard.vue') 59 | }, 60 | '/games': { 61 | name: 'games', 62 | navbar: 'Games', 63 | component: require('./components/GamesManager.vue') 64 | }, 65 | '/platforms': { 66 | name: 'platforms', 67 | navbar: 'Platforms', 68 | component: require('./components/PlatformsManager.vue') 69 | }, 70 | '/users': { 71 | name: 'users', 72 | navbar: 'Manage Users', 73 | component: require('./components/UsersManager.vue') 74 | }, 75 | '/oauth': { 76 | name: 'oauth-settings', 77 | navbar: 'OAuth Settings', 78 | component: require('./components/OauthSettings.vue') 79 | } 80 | }); 81 | 82 | router.redirect({ '*': '/' }); 83 | router.start(App, '#app'); 84 | -------------------------------------------------------------------------------- /resources/assets/js/app.js: -------------------------------------------------------------------------------- 1 | Vue.component('auth', require('./components/Auth.vue')); 2 | 3 | const app = new Vue({ 4 | el: 'body' 5 | }); -------------------------------------------------------------------------------- /resources/assets/js/components/Auth.vue: -------------------------------------------------------------------------------- 1 | 51 | 52 | -------------------------------------------------------------------------------- /resources/assets/sass/admin/styles.scss: -------------------------------------------------------------------------------- 1 | @import "animate"; 2 | @import "node_modules/nprogress/nprogress"; 3 | 4 | #nprogress { 5 | $color: #48e79a; 6 | 7 | .bar { 8 | background: $color; 9 | } 10 | .peg { 11 | box-shadow: 0 0 10px $color, 0 0 5px $color; 12 | } 13 | 14 | .spinner-icon { 15 | border-top-color: $color; 16 | border-left-color: $color; 17 | } 18 | } -------------------------------------------------------------------------------- /resources/assets/sass/app.scss: -------------------------------------------------------------------------------- 1 | // Bootstrap 3 2 | // @import "node_modules/bootstrap-sass/assets/stylesheets/bootstrap"; 3 | 4 | // Bootstrap 4 5 | @import "node_modules/bootstrap/scss/bootstrap"; 6 | 7 | @import "default/styles"; 8 | 9 | // Move this somewhere else... 10 | @import "admin/styles"; -------------------------------------------------------------------------------- /resources/assets/sass/default/_global.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g33kidd/bracket/c165d5f4d8f6d7eb3fde8a4b19ca89a0d56ae8d4/resources/assets/sass/default/_global.scss -------------------------------------------------------------------------------- /resources/assets/sass/default/_header.scss: -------------------------------------------------------------------------------- 1 | .user-bar { 2 | padding: 10px 0; 3 | background: #F2F2F2; 4 | 5 | .guest-info { 6 | a { 7 | display: inline-block; 8 | padding: 5px 10px; 9 | background: #333; 10 | margin-right: 5px; 11 | color: #FFF; 12 | &:last-of-type { 13 | margin-right: 0px; 14 | } 15 | } 16 | } 17 | } 18 | 19 | .main-header { 20 | background: #FEFEFE; 21 | } -------------------------------------------------------------------------------- /resources/assets/sass/default/_settings.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g33kidd/bracket/c165d5f4d8f6d7eb3fde8a4b19ca89a0d56ae8d4/resources/assets/sass/default/_settings.scss -------------------------------------------------------------------------------- /resources/assets/sass/default/styles.scss: -------------------------------------------------------------------------------- 1 | @import "_settings"; 2 | 3 | @import "_global"; 4 | @import "_header"; -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Passwords must be at least six characters and match the confirmation.', 17 | 'reset' => 'Your password has been reset!', 18 | 'sent' => 'We have e-mailed your password reset link!', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that e-mail address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/views/admin/index.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{ config('app.name') }} Admin 10 | 11 | {{-- stylesheets --}} 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /resources/views/auth/emails/password.blade.php: -------------------------------------------------------------------------------- 1 | Click here to reset your password: {{ $link }} 2 | -------------------------------------------------------------------------------- /resources/views/auth/login.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Login
9 |
10 |
11 | {{ csrf_field() }} 12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 | @if ($errors->has('email')) 20 | 21 | {{ $errors->first('email') }} 22 | 23 | @endif 24 |
25 |
26 | 27 |
28 | 29 | 30 |
31 | 32 | 33 | @if ($errors->has('password')) 34 | 35 | {{ $errors->first('password') }} 36 | 37 | @endif 38 |
39 |
40 | 41 |
42 |
43 |
44 | 47 |
48 |
49 |
50 | 51 |
52 |
53 | 56 | 57 | 58 | Forgot Your Password? 59 | 60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | @endsection 69 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/email.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | 4 | @section('content') 5 |
6 |
7 |
8 |
9 |
Reset Password
10 |
11 | @if (session('status')) 12 |
13 | {{ session('status') }} 14 |
15 | @endif 16 | 17 |
18 | {{ csrf_field() }} 19 | 20 |
21 | 22 | 23 |
24 | 25 | 26 | @if ($errors->has('email')) 27 | 28 | {{ $errors->first('email') }} 29 | 30 | @endif 31 |
32 |
33 | 34 |
35 |
36 | 39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | @endsection 48 | -------------------------------------------------------------------------------- /resources/views/auth/passwords/reset.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Reset Password
9 | 10 |
11 |
12 | {{ csrf_field() }} 13 | 14 | 15 | 16 |
17 | 18 | 19 |
20 | 21 | 22 | @if ($errors->has('email')) 23 | 24 | {{ $errors->first('email') }} 25 | 26 | @endif 27 |
28 |
29 | 30 |
31 | 32 | 33 |
34 | 35 | 36 | @if ($errors->has('password')) 37 | 38 | {{ $errors->first('password') }} 39 | 40 | @endif 41 |
42 |
43 | 44 |
45 | 46 |
47 | 48 | 49 | @if ($errors->has('password_confirmation')) 50 | 51 | {{ $errors->first('password_confirmation') }} 52 | 53 | @endif 54 |
55 |
56 | 57 |
58 |
59 | 62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | @endsection 71 | -------------------------------------------------------------------------------- /resources/views/auth/register.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 |
6 |
7 |
8 |
Register
9 |
10 |
11 | {{ csrf_field() }} 12 | 13 |
14 | 15 | 16 |
17 | 18 | 19 | @if ($errors->has('username')) 20 | 21 | {{ $errors->first('username') }} 22 | 23 | @endif 24 |
25 |
26 | 27 |
28 | 29 | 30 |
31 | 32 | 33 | @if ($errors->has('name')) 34 | 35 | {{ $errors->first('name') }} 36 | 37 | @endif 38 |
39 |
40 | 41 |
42 | 43 | 44 |
45 | 46 | 47 | @if ($errors->has('email')) 48 | 49 | {{ $errors->first('email') }} 50 | 51 | @endif 52 |
53 |
54 | 55 |
56 | 57 | 58 |
59 | 60 | 61 | @if ($errors->has('password')) 62 | 63 | {{ $errors->first('password') }} 64 | 65 | @endif 66 |
67 |
68 | 69 |
70 | 71 | 72 |
73 | 74 | 75 | @if ($errors->has('password_confirmation')) 76 | 77 | {{ $errors->first('password_confirmation') }} 78 | 79 | @endif 80 |
81 |
82 | 83 |
84 |
85 | 88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | @endsection 97 | -------------------------------------------------------------------------------- /resources/views/emails/accounts/created.blade.php: -------------------------------------------------------------------------------- 1 |

Welcome to the site! {{ $user->name }}!

2 |

We have you with the username ({{ $user->username }}).

-------------------------------------------------------------------------------- /resources/views/errors/404.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Not the page you are looking for. 5 | 6 | 7 | 8 | 52 | 53 | 54 |
55 |
56 |
This doesn't seem right...
57 |
Does this page really exist?
58 | GO BACK HOME 59 |
60 |
61 | 62 | 63 | -------------------------------------------------------------------------------- /resources/views/errors/503.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Be right back. 5 | 6 | 7 | 8 | 39 | 40 | 41 |
42 |
43 |
Be right back.
44 |
45 |
46 | 47 | 48 | -------------------------------------------------------------------------------- /resources/views/layouts/app.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{ config('app.name') }} 10 | 11 | {{-- stylesheets --}} 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 24 | @include('site.shared.header') 25 | @yield('content') 26 | @include('site.shared.footer') 27 | 28 | {{-- If you have scripts that you need, add them here: --}} 29 | 30 | 31 | -------------------------------------------------------------------------------- /resources/views/site/blog-view.blade.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g33kidd/bracket/c165d5f4d8f6d7eb3fde8a4b19ca89a0d56ae8d4/resources/views/site/blog-view.blade.php -------------------------------------------------------------------------------- /resources/views/site/blog.blade.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g33kidd/bracket/c165d5f4d8f6d7eb3fde8a4b19ca89a0d56ae8d4/resources/views/site/blog.blade.php -------------------------------------------------------------------------------- /resources/views/site/home.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
5 | 6 |
7 | @endsection 8 | -------------------------------------------------------------------------------- /resources/views/site/partials/news.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
Latest News
3 | 4 |
5 |
6 | 7 |
Test Title
8 |
Some content excerpt...
9 | Read More 10 |
11 |
12 | 13 |
-------------------------------------------------------------------------------- /resources/views/site/player-view.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 | 5 |
6 |

{{ $user->username }}'s Profile

7 |
8 | 9 | @endsection -------------------------------------------------------------------------------- /resources/views/site/players.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 | 5 |
6 | @foreach($users as $user) 7 |

{{ $user->username }}

8 | @endforeach 9 |
10 | 11 | @endsection -------------------------------------------------------------------------------- /resources/views/site/shared/footer.blade.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g33kidd/bracket/c165d5f4d8f6d7eb3fde8a4b19ca89a0d56ae8d4/resources/views/site/shared/footer.blade.php -------------------------------------------------------------------------------- /resources/views/site/shared/header.blade.php: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | {{-- Authentication Vue Component --}} 5 | 6 |
7 |
8 |
9 | 10 | -------------------------------------------------------------------------------- /resources/views/site/team-view.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 | 5 |
6 |

{{ $team->name }}'s Profile

7 |
8 | 9 | @endsection -------------------------------------------------------------------------------- /resources/views/site/teams.blade.php: -------------------------------------------------------------------------------- 1 | @extends ('layouts.app') 2 | 3 | @section('content') 4 |
5 |

Just a list of teams.

6 | @foreach($teams as $team) 7 |
  • 8 |

    {{ $team->name }} | {{ $team->slug }}

    9 |
  • 10 | @endforeach 11 |
    12 | @endsection -------------------------------------------------------------------------------- /resources/views/site/teams/create.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
    5 |
    6 |
    7 |
    8 |
    Create a new team
    9 |
    10 |
    11 | {!! csrf_field() !!} 12 | 13 |
    14 | 15 | 16 |
    17 | 18 | 19 | @if ($errors->has('name')) 20 | 21 | {{ $errors->first('name') }} 22 | 23 | @endif 24 |
    25 |
    26 | 27 | 28 |
    29 |
    30 | 33 |
    34 |
    35 |
    36 |
    37 |
    38 |
    39 |
    40 |
    41 | @endsection 42 | -------------------------------------------------------------------------------- /resources/views/site/teams/edit.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
    5 |
    6 |
    7 |
    8 |
    Edit team {{$team->name}}
    9 |
    10 |
    11 | 12 | {!! csrf_field() !!} 13 | 14 |
    15 | 16 | 17 |
    18 | 19 | 20 | @if ($errors->has('name')) 21 | 22 | {{ $errors->first('name') }} 23 | 24 | @endif 25 |
    26 |
    27 | 28 | 29 |
    30 |
    31 | 34 |
    35 |
    36 |
    37 |
    38 |
    39 |
    40 |
    41 |
    42 | @endsection 43 | -------------------------------------------------------------------------------- /resources/views/site/teams/index.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 | 5 |
    6 |
    7 |
    8 |
    9 |

    My Teams

    10 | 11 | Create Team 12 | 13 |
    14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | @foreach($teams as $team) 24 | 25 | 26 | 33 | 59 | 60 | @endforeach 61 | 62 |
    NameStatus
    {{ $team->name }} 27 | @if(auth()->user()->isOwnerOfTeam($team)) 28 | Owner 29 | @else 30 | Member 31 | @endif 32 | 34 | @if(is_null(auth()->user()->currentTeam) || auth()->user()->currentTeam->getKey() !== $team->getKey()) 35 | 36 | Switch 37 | 38 | @else 39 | Current team 40 | @endif 41 | 42 | 43 | Members 44 | 45 | 46 | @if(auth()->user()->isOwnerOfTeam($team)) 47 | 48 | 49 | Edit 50 | 51 | 52 |
    53 | {!! csrf_field() !!} 54 | 55 | 56 |
    57 | @endif 58 |
    63 | 64 |
    65 |
    66 |
    67 | 68 | @endsection 69 | -------------------------------------------------------------------------------- /resources/views/site/teams/members.blade.php: -------------------------------------------------------------------------------- 1 | @extends('layouts.app') 2 | 3 | @section('content') 4 |
    5 |
    6 |
    7 |
    8 |

    Manage Members 9 | {{ $team->name }} 10 |

    11 | 12 | View All Teams 13 | 14 |
    15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | @foreach($team->users as $user) 25 | 26 | 27 | 38 | 39 | @endforeach 40 | 41 |
    UsernameAction
    {{ $user->username }} 28 | @if(auth()->user()->isOwnerOfTeam($team)) 29 | @if(auth()->user()->getKey() !== $user->getKey()) 30 |
    31 | {!! csrf_field() !!} 32 | 33 | 34 |
    35 | @endif 36 | @endif 37 |
    42 |
    43 | 44 |
    45 |
    46 |
    Invite Users
    47 |
    48 |
    49 | {!! csrf_field() !!} 50 |
    51 | 52 | 53 | 54 | @if ($errors->has('email')) 55 | 56 | {{ $errors->first('email') }} 57 | 58 | @endif 59 |
    60 | 61 | 62 |
    63 | 66 |
    67 |
    68 |
    69 |
    70 |
    71 |
    72 | 73 |
    74 |
    75 |
    76 |

    Team Invitations

    77 |
    78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | @foreach($team->invites as $invite) 87 | 88 | 89 | 94 | 95 | @endforeach 96 | 97 |
    Email AddressActions
    {{ $invite->email }} 90 | 91 | Resend invite 92 | 93 |
    98 |
    99 |
    100 |
    101 | @endsection -------------------------------------------------------------------------------- /resources/views/site/tournament-view.blade.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g33kidd/bracket/c165d5f4d8f6d7eb3fde8a4b19ca89a0d56ae8d4/resources/views/site/tournament-view.blade.php -------------------------------------------------------------------------------- /resources/views/site/tournaments.blade.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/g33kidd/bracket/c165d5f4d8f6d7eb3fde8a4b19ca89a0d56ae8d4/resources/views/site/tournaments.blade.php -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | 'users'], function() { 17 | Route::get('/me', 'Api\UsersController@verify')->middleware('scope:admin,user'); 18 | }); 19 | 20 | // Route::resource('games', 'Api\GamesController')->middleware('scope:admin,settings'); 21 | // Route::resource('platforms', 'Api\PlatformsController')->middleware('scope:admin,settings'); 22 | // Route::resource('users', 'Api\UsersController')->middleware('scope:admin,users'); 23 | // Route::resource('tournaments', 'Api\TournamentsController')->middleware('scope:admin,tournaments'); 24 | // Route::resource('posts', 'Api\PostsController')->middleware('scope:admin,posts'); 25 | // Route::resource('teams', 'Api\TeamsController')->middleware('scope:admin,teams'); 26 | 27 | // Route::group(['prefix' => 'games', 'namespace' => 'Api'], function() { 28 | // Route::get('/', 'GamesController@index'); 29 | // Route::get('/{id}', 'GamesController@show'); 30 | // Route::post('/', 'GamesController@store')->middleware('scope:admin,regular'); 31 | // Route::put('/', 'GamesController@update')->middleware('scope:admin,regular'); 32 | // Route::delete('/', 'GamesController@destroy')->middleware('scope:admin,regular'); 33 | // }); 34 | 35 | // Route::group(['prefix' => 'teams', 'namespace' => 'Api', function() { 36 | // Route::get('/', 'TeamsController@index'); 37 | // Route::'' 38 | // }]); -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | 'Admin', 12 | 'prefix' => 'admin', 13 | 'middleware' => 'auth'], 14 | function() { 15 | Route::get('/', function() { return view('admin.index'); }); 16 | Route::get('/{any}', function() { 17 | return view('admin.index'); 18 | })->where('any', '.*'); 19 | }); 20 | 21 | // The main site routes 22 | Route::group(['namespace' => 'Site'], function() { 23 | Route::get('/', 'HomeController@index'); 24 | Route::get('/challonge', 'HomeController@challonge'); 25 | 26 | // Tournaments 27 | Route::group(['prefix' => 'tournaments'], function() { 28 | Route::get('/{gameOrPlatformSlug}', 'TournamentController@index'); 29 | Route::get('/{slug}/view', 'TournamentController@show'); 30 | }); 31 | 32 | // Users/Players 33 | Route::group(['prefix' => 'players'], function() { 34 | Route::get('/', 'PlayerController@index'); 35 | Route::get('/{username}', 'PlayerController@show'); 36 | }); 37 | 38 | // Teams 39 | Route::group(['prefix' => 'teams'], function() { 40 | Route::get('/', 'TeamController@index'); 41 | Route::get('/{slug}', 'TeamController@show'); 42 | Route::post('/invite', 'TeamInvitesController@store'); 43 | Route::get('/accept/{token}', 'TeamInvitesController@index'); 44 | }); 45 | }); -------------------------------------------------------------------------------- /server.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | $uri = urldecode( 9 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) 10 | ); 11 | 12 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the 13 | // built-in PHP web server. This provides a convenient way to test a Laravel 14 | // application without having installed a "real" web server software here. 15 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) { 16 | return false; 17 | } 18 | 19 | require_once __DIR__.'/public/index.php'; 20 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | user = factory(App\Models\User::class)->create(); 18 | } catch(PDOException $e) { 19 | $this->user = null; 20 | } 21 | } 22 | 23 | /** 24 | * Creates the application. 25 | * 26 | * @return \Illuminate\Foundation\Application 27 | */ 28 | public function createApplication() 29 | { 30 | $app = require __DIR__.'/../bootstrap/app.php'; 31 | 32 | $app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap(); 33 | 34 | return $app; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/integration/Api/GamesControllerTest.php: -------------------------------------------------------------------------------- 1 | games = factory( 21 | Game::class, self::FACTORY_GAMES_TO_CREATE)->create(); 22 | } 23 | 24 | public function testGamesControllerExtendsController() 25 | { 26 | $this->assertTrue(is_subclass_of(GamesController::class, Controller::class)); 27 | } 28 | 29 | public function testGamesIndexReturnsAListOfGames() 30 | { 31 | $this->get('/api/games'); 32 | 33 | $this->assertResponseOk(); 34 | $this->seeJsonStructure([ 35 | '*' => [ 36 | 'id', 'name', 'short_name', 'slug', 'logo', 37 | 'banner', 'platforms' 38 | ] 39 | ]); 40 | } 41 | 42 | public function testGamesShowReturnsASingleGame() 43 | { 44 | $this->get('/api/games/1'); 45 | 46 | $this->assertResponseOk(); 47 | $this->seeJsonStructure([ 48 | 'id', 'name', 'short_name', 'slug', 'logo', 49 | 'banner', 'platforms' 50 | ]); 51 | } 52 | 53 | public function testGamesShowReturns404IfRecordDoesntExist() 54 | { 55 | $this->get('/api/games/99999'); 56 | 57 | $this->assertResponseStatus(404); 58 | $this->seeJson([ 59 | 'message' => 'Record not found' 60 | ]); 61 | } 62 | 63 | public function testGamesDestroyRemovesGameWithId() 64 | { 65 | $game = Game::find('1'); 66 | 67 | // Assert that game exists before api call 68 | $this->assertTrue($game instanceof Game); 69 | 70 | // Call delete on the existing Game 71 | $this->delete('/api/games/1'); 72 | 73 | $game = Game::find('1'); 74 | 75 | $this->assertResponseOk(); 76 | $this->assertEquals($game, null); 77 | } 78 | 79 | public function testGamesDestroyReturns404IfRecordDoesntExist() 80 | { 81 | $this->delete('/api/games/99999'); 82 | 83 | $this->assertResponseStatus(404); 84 | $this->seeJson([ 85 | 'message' => 'Record not found' 86 | ]); 87 | } 88 | 89 | public function testGamesStoreRequiresNameFields() 90 | { 91 | $this->actingAs($this->user)->post('/api/games', [ 92 | 'name' => '' 93 | ]); 94 | 95 | $this->assertSessionHasErrors(['name', 'short_name']); 96 | } 97 | 98 | public function testGamesStoreAddsNewGame() 99 | { 100 | $this->actingAs($this->user)->post('/api/games', [ 101 | 'name' => 'Rocket League', 102 | 'short_name' => 'RL' 103 | ]); 104 | 105 | $this->assertResponseOk(); 106 | $this->seeJsonStructure(['id']); 107 | 108 | $nextId = GamesControllerTest::FACTORY_GAMES_TO_CREATE + 1; 109 | $game = Game::find($nextId); 110 | 111 | $this->assertTrue($game instanceof Game); 112 | } 113 | 114 | public function testGamesUpdateReturns404IfResourceDoesntExist() 115 | { 116 | $this->actingAs($this->user)->put('/api/games/99999', [ 117 | 'name' => 'Rocket League', 118 | 'short_name' => 'RL' 119 | ]); 120 | 121 | $this->assertResponseStatus(404); 122 | $this->seeJson([ 123 | 'message' => 'Record not found' 124 | ]); 125 | } 126 | 127 | public function testGamesUpdateAllowsUpdatesToAllFields() 128 | { 129 | $newName = 'This is an entirely new name.'; 130 | $newShortName = 'this is the new short name.'; 131 | $newLogoPath = '/some/path/to/a/logo.jpg'; 132 | $newBannerPath = '/some/path/to/a/banner.png'; 133 | 134 | $this->actingAs($this->user)->put('/api/games/1', [ 135 | 'name' => $newName, 136 | 'short_name' => $newShortName, 137 | 'logo' => $newLogoPath, 138 | 'banner' => $newBannerPath 139 | ]); 140 | 141 | $game = Game::find(1); 142 | 143 | $this->assertTrue($game->name === $newName); 144 | $this->assertTrue($game->short_name === $newShortName); 145 | $this->assertTrue($game->logo === $newLogoPath); 146 | $this->assertTrue($game->banner == $newBannerPath); 147 | } 148 | 149 | public function testGamesUpdateReturnsValidationErrorIfNameFieldsArentSupplied() 150 | { 151 | $this->actingAs($this->user)->put('/api/games/1', [ 152 | 'logo' => '' 153 | ]); 154 | 155 | $this->assertSessionHasErrors(['name', 'short_name']); 156 | } 157 | 158 | } 159 | -------------------------------------------------------------------------------- /tests/integration/Api/PlatformControllerTest.php: -------------------------------------------------------------------------------- 1 | games = factory( 21 | Platform::class, PlatformsControllerTest::FACTORY_PLATFORMS_TO_CREATE)->create(); 22 | } 23 | 24 | public function testPlatformsControllerExtendsController() 25 | { 26 | $this->assertTrue(is_subclass_of(PlatformsController::class, Controller::class)); 27 | } 28 | 29 | public function testPlatformsIndexReturnsAListOfPlatforms() 30 | { 31 | $this->get('/api/platforms'); 32 | 33 | $this->assertResponseOk(); 34 | $this->seeJsonStructure([ 35 | '*' => [ 36 | 'name', 'short_name', 'logo', 'banner' 37 | ] 38 | ]); 39 | } 40 | 41 | public function testPlatformsShowReturnsASinglePlatform() 42 | { 43 | $this->get('/api/platforms/1'); 44 | 45 | $this->assertResponseOk(); 46 | $this->seeJsonStructure([ 47 | 'name', 'short_name', 'logo', 'banner' 48 | ]); 49 | } 50 | 51 | public function testPlatformsShowReturns404IfRecordDoesntExist() 52 | { 53 | $this->get('/api/platforms/99999'); 54 | 55 | $this->assertResponseStatus(404); 56 | $this->seeJson([ 57 | 'message' => 'Record not found' 58 | ]); 59 | } 60 | 61 | public function testPlatformsDestroyRemovesPlatformWithId() 62 | { 63 | $platform = Platform::find('1'); 64 | 65 | // Assert that game exists before api call 66 | $this->assertTrue($platform instanceof Platform); 67 | 68 | // Call delete on the existing Platform 69 | $this->delete('/api/platforms/1'); 70 | 71 | $platform = Platform::find('1'); 72 | 73 | $this->assertResponseOk(); 74 | $this->assertEquals($platform, null); 75 | } 76 | 77 | public function testPlatformsDestroyReturns404IfRecordDoesntExist() 78 | { 79 | $this->delete('/api/platforms/99999'); 80 | 81 | $this->assertResponseStatus(404); 82 | $this->seeJson([ 83 | 'message' => 'Record not found' 84 | ]); 85 | } 86 | 87 | public function testPlatformsStoreRequiresNameFields() 88 | { 89 | $this->actingAs($this->user)->post('/api/platforms', [ 90 | 'name' => '' 91 | ]); 92 | 93 | $this->assertSessionHasErrors(['name', 'short_name']); 94 | } 95 | 96 | public function testPlatformsStoreAddsNewPlatform() 97 | { 98 | $this->actingAs($this->user)->post('/api/platforms', [ 99 | 'name' => 'Steam', 100 | 'short_name' => 'ST' 101 | ]); 102 | 103 | $this->assertResponseOk(); 104 | $this->seeJsonStructure(['id']); 105 | 106 | $nextId = PlatformsControllerTest::FACTORY_PLATFORMS_TO_CREATE + 1; 107 | $platform = Platform::find($nextId); 108 | 109 | $this->assertTrue($platform instanceof Platform); 110 | } 111 | 112 | public function testPlatformsUpdateReturns404IfResourceDoesntExist() 113 | { 114 | $this->actingAs($this->user)->put('/api/platforms/99999', [ 115 | 'name' => 'Rocket League', 116 | 'short_name' => 'RL' 117 | ]); 118 | 119 | $this->assertResponseStatus(404); 120 | $this->seeJson([ 121 | 'message' => 'Record not found' 122 | ]); 123 | } 124 | 125 | public function testPlatformsUpdateReturnsValidationErrorIfRequiredFieldsArentSupplied() 126 | { 127 | $this->actingAs($this->user)->put('/api/platforms/1', [ 128 | 'logo' => '' 129 | ]); 130 | 131 | $this->assertSessionHasErrors(['name', 'short_name']); 132 | } 133 | 134 | public function testPlatformsUpdateAllowsUpdatesToAllFields() 135 | { 136 | $newName = 'This is an entirely new name.'; 137 | $newShortName = 'this is the new short name.'; 138 | $newLogoPath = '/some/path/to/a/logo.jpg'; 139 | $newBannerPath = '/some/path/to/a/banner.png'; 140 | 141 | $this->actingAs($this->user)->put('/api/platforms/1', [ 142 | 'name' => $newName, 143 | 'short_name' => $newShortName, 144 | 'logo' => $newLogoPath, 145 | 'banner' => $newBannerPath 146 | ]); 147 | 148 | $platform = Platform::find(1); 149 | 150 | $this->assertTrue($platform->name === $newName); 151 | $this->assertTrue($platform->short_name === $newShortName); 152 | $this->assertTrue($platform->logo === $newLogoPath); 153 | $this->assertTrue($platform->banner == $newBannerPath); 154 | } 155 | 156 | } 157 | -------------------------------------------------------------------------------- /tests/integration/Api/PostsControllerTest.php: -------------------------------------------------------------------------------- 1 | posts = factory( 21 | Post::class, self::FACTORY_POSTS_TO_CREATE)->create(); 22 | } 23 | 24 | public function testPostsControllerExtendsController() 25 | { 26 | $this->assertTrue(is_subclass_of(PostsController::class, Controller::class)); 27 | } 28 | 29 | public function testPostsIndexReturnsAListOfPosts() 30 | { 31 | $this->get('/api/posts'); 32 | 33 | $this->assertResponseOk(); 34 | $this->seeJsonStructure([ 35 | '*' => [ 36 | 'id', 'title', 'slug', 'content', 'excerpt', 'status', 37 | 'user' 38 | ] 39 | ]); 40 | } 41 | 42 | public function testPostsShowReturnsASinglePost() 43 | { 44 | $this->get('/api/posts/1'); 45 | 46 | $this->assertResponseOk(); 47 | $this->seeJsonStructure([ 48 | 'id', 'title', 'slug', 'content', 'excerpt', 'status', 49 | 'user' 50 | ]); 51 | } 52 | 53 | public function testPostsShowReturns404IfRecordDoesntExist() 54 | { 55 | $this->get('/api/posts/99999'); 56 | 57 | $this->assertResponseStatus(404); 58 | $this->seeJson([ 59 | 'message' => 'Record not found' 60 | ]); 61 | } 62 | 63 | public function testPostsDestroyRemovesPostWithId() 64 | { 65 | $post = Post::find('1'); 66 | 67 | // Assert that post exists before api call 68 | $this->assertTrue($post instanceof Post); 69 | 70 | // Call delete on the existing Post 71 | $this->delete('/api/posts/1'); 72 | 73 | $post = Post::find('1'); 74 | 75 | $this->assertResponseOk(); 76 | $this->assertEquals($post, null); 77 | } 78 | 79 | public function testPostsDestroyReturns404IfRecordDoesntExist() 80 | { 81 | $this->delete('/api/posts/99999'); 82 | 83 | $this->assertResponseStatus(404); 84 | $this->seeJson([ 85 | 'message' => 'Record not found' 86 | ]); 87 | } 88 | 89 | public function testPostsStoreRequiresFields() 90 | { 91 | $this->actingAs($this->user)->post('/api/posts', []); 92 | 93 | $this->assertSessionHasErrors([ 94 | 'title', 'content', 'status', 'excerpt' 95 | ]); 96 | } 97 | 98 | public function testPostsStoreAddsNewPost() 99 | { 100 | $this->actingAs($this->user)->post('/api/posts', [ 101 | 'title' => 'Test Post', 102 | 'content' => 'Lorem ipsum sit dolor...', 103 | 'status' => 'published', 104 | 'excerpt' => 'Lorem...' 105 | ]); 106 | 107 | $this->assertResponseOk(); 108 | $this->seeJsonStructure(['id']); 109 | 110 | $nextId = self::FACTORY_POSTS_TO_CREATE + 1; 111 | $post = Post::find($nextId); 112 | 113 | $this->assertTrue($post instanceof Post); 114 | } 115 | 116 | public function testPostsUpdateReturns404IfResourceDoesntExist() 117 | { 118 | $this->actingAs($this->user)->put('/api/posts/99999', [ 119 | 'title' => 'Test Post', 120 | 'content' => 'Lorem ipsum sit dolor...', 121 | 'status' => 'published', 122 | 'excerpt' => 'Lorem...' 123 | ]); 124 | 125 | $this->assertResponseStatus(404); 126 | $this->seeJson([ 127 | 'message' => 'Record not found' 128 | ]); 129 | } 130 | 131 | public function testPostsUpdateAllowsUpdatesToAllFields() 132 | { 133 | $newTitle = 'This is an entirely new name.'; 134 | $newContent = 'Lorem ipsum...'; 135 | $newStatus = 'draft'; 136 | $newExcerpt = 'L...'; 137 | 138 | $this->actingAs($this->user)->put('/api/posts/1', [ 139 | 'title' => $newTitle, 140 | 'content' => $newContent, 141 | 'status' => $newStatus, 142 | 'excerpt' => $newExcerpt 143 | ]); 144 | 145 | $post = Post::find(1); 146 | 147 | $this->assertTrue($post->title === $newTitle); 148 | $this->assertTrue($post->status === $newStatus); 149 | $this->assertTrue($post->excerpt === $newExcerpt); 150 | $this->assertTrue($post->content === $newContent); 151 | } 152 | 153 | public function testPostsUpdateRequiresFields() 154 | { 155 | $this->actingAs($this->user)->put('/api/posts/1', []); 156 | 157 | $this->assertSessionHasErrors([ 158 | 'title', 'content', 'status', 'excerpt' 159 | ]); 160 | } 161 | 162 | } -------------------------------------------------------------------------------- /tests/integration/Api/TeamsControllerTest.php: -------------------------------------------------------------------------------- 1 | teams = factory( 20 | Team::class, self::FACTORY_TEAMS_TO_CREATE)->create(); 21 | } 22 | 23 | public function testTeamsControllerExtendsController() 24 | { 25 | $this->assertTrue(is_subclass_of(TeamsController::class, Controller::class)); 26 | } 27 | 28 | public function testTeamsIndexReturnsAListOfTeams() 29 | { 30 | $this->get('/api/teams'); 31 | 32 | $this->assertResponseOk(); 33 | $this->seeJsonStructure([ 34 | '*' => [ 35 | 'id', 'name', 'slug', 'description' 36 | ] 37 | ]); 38 | } 39 | 40 | public function testTeamsShowReturnsASingleTeam() 41 | { 42 | $this->get('/api/teams/1'); 43 | 44 | $this->assertResponseOk(); 45 | $this->seeJsonStructure([ 46 | 'id', 'name', 'slug', 'description' 47 | ]); 48 | } 49 | 50 | public function testTeamsShowReturns404IfResourceDoesntExist() 51 | { 52 | $this->get('/api/teams/999999'); 53 | 54 | $this->assertResponseStatus(404); 55 | $this->seeJson([ 56 | 'message' => 'Record not found' 57 | ]); 58 | } 59 | 60 | public function testTeamsDestroyRemovesTeamWithId() 61 | { 62 | $team = Team::find('1'); 63 | 64 | // Assert that the team exists before our destroy api call 65 | $this->assertTrue($team instanceof Team); 66 | 67 | // Call delete on the existing Team 68 | $this->delete('/api/teams/1'); 69 | 70 | $team = Team::find('1'); 71 | 72 | $this->assertResponseOk(); 73 | $this->assertEquals($team, null); 74 | } 75 | 76 | public function testTeamsDestroyReturns404IfRecordDoesntExist() 77 | { 78 | $this->delete('/api/teams/99999'); 79 | 80 | $this->assertResponseStatus(404); 81 | $this->seeJson([ 82 | 'message' => 'Record not found' 83 | ]); 84 | } 85 | 86 | public function testTeamsStoreRequiresNameAndSlug() 87 | { 88 | $this->actingAs($this->user)->post('/api/teams', [ 89 | 'name' => '' 90 | ]); 91 | 92 | $this->assertSessionHasErrors(['name', 'description']); 93 | } 94 | 95 | public function testTeamsStoreAddsNewTeam() 96 | { 97 | $this->actingAs($this->user)->post('/api/teams', [ 98 | 'name' => 'Bracket Dev Team', 99 | 'description' => 'Team Description' 100 | ]); 101 | 102 | $this->assertResponseOk(); 103 | $this->seeJsonStructure(['id']); 104 | 105 | $nextId = self::FACTORY_TEAMS_TO_CREATE + 1; 106 | $team = Team::find($nextId); 107 | 108 | $this->assertTrue($team instanceof Team); 109 | } 110 | 111 | public function testTeamsUpdateReturns404IfResourceDoesntExist() 112 | { 113 | $this->actingAs($this->user)->put('/api/teams/999999', [ 114 | 'name' => 'Bracket Dev Team', 115 | 'description' => 'Team Description' 116 | ]); 117 | 118 | $this->assertResponseStatus(404); 119 | $this->seeJson([ 120 | 'message' => 'Record not found' 121 | ]); 122 | } 123 | 124 | public function testTeamsUpdateAllowsUpdatesToAllFields() 125 | { 126 | $newName = 'Rocket League Team'; 127 | $newDescription = 'This is my rocket league team\'s description.'; 128 | 129 | $this->actingAs($this->user)->put('/api/teams/1', [ 130 | 'name' => $newName, 131 | 'description' => $newDescription 132 | ]); 133 | 134 | $team = Team::find(1); 135 | 136 | $this->assertTrue($team->name === $newName); 137 | $this->assertTrue($team->description === $newDescription); 138 | } 139 | 140 | public function testTeamsUpdateMethodValidatesInput() 141 | { 142 | $this->actingAs($this->user)->put('/api/teams/1', [ 143 | 'name' => '' 144 | ]); 145 | 146 | $this->assertSessionHasErrors(['name', 'description']); 147 | } 148 | } -------------------------------------------------------------------------------- /tests/integration/Api/UsersControllerTest.php: -------------------------------------------------------------------------------- 1 | users = factory( 21 | User::class, UsersControllerTest::FACTORY_USERS_TO_CREATE)->create(); 22 | } 23 | 24 | public function testUsersControllerExtendsController() 25 | { 26 | $this->assertTrue(is_subclass_of(UsersController::class, Controller::class)); 27 | } 28 | 29 | public function testUsersIndexReturnsAListOfUsers() 30 | { 31 | $this->get('/api/users'); 32 | 33 | $this->assertResponseOk(); 34 | $this->seeJsonStructure([ 35 | '*' => [ 36 | 'id', 'username', 'created_at', 'updated_at' 37 | ] 38 | ]); 39 | } 40 | 41 | public function testUsersShowReturnsASingleUser() 42 | { 43 | $this->get('/api/users/1'); 44 | 45 | $this->assertResponseOk(); 46 | $this->seeJsonStructure([ 47 | 'id', 'username', 'created_at', 'updated_at' 48 | ]); 49 | } 50 | 51 | public function testUsersShowReturns404IfResourceDoesntExist() 52 | { 53 | $this->get('/api/users/99999'); 54 | 55 | // TODO: Replace all checks for the json and error for resource 56 | // doesn't exist errors to just spy on the method... Once I figure out 57 | // how Laravel wants to handle that. 58 | $this->assertResponseStatus(404); 59 | $this->seeJson([ 60 | 'message' => 'Record not found' 61 | ]); 62 | } 63 | 64 | public function testUsersDestroyRemovesUserWithId() 65 | { 66 | $user = User::find('1'); 67 | 68 | // Assert that user exists before api call 69 | $this->assertTrue($user instanceof User); 70 | 71 | // Call delete on the existing User 72 | $this->delete('/api/users/1'); 73 | 74 | $user = User::find('1'); 75 | 76 | $this->assertResponseOk(); 77 | $this->assertEquals($user, null); 78 | } 79 | 80 | public function testUsersDestroyReturns404IfRecordDoesntExist() 81 | { 82 | $this->delete('/api/users/99999'); 83 | 84 | $this->assertResponseStatus(404); 85 | $this->seeJson([ 86 | 'message' => 'Record not found' 87 | ]); 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /tests/unit/ControllerTest.php: -------------------------------------------------------------------------------- 1 | controller = new Controller(); 14 | } 15 | 16 | public function testRecordNotFoundMethodExists() 17 | { 18 | $this->assertTrue(method_exists($this->controller, 'recordNotFound')); 19 | } 20 | 21 | public function testRecordNotFoundReturnsA404JsonResponseObject() 22 | { 23 | $resp = $this->controller->recordNotFound(); 24 | 25 | $this->assertTrue($resp instanceof JsonResponse); 26 | $this->assertEquals($resp->status(), 404); 27 | } 28 | 29 | public function testRecordNotFoundReturnsAMessageKeyInJsonResponse() 30 | { 31 | $resp = $this->controller->recordNotFound(); 32 | $respCont = json_decode($resp->content()); 33 | 34 | $this->assertTrue($respCont->message !== null); 35 | $this->assertEquals($respCont->message, 'Record not found'); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); 2 | var path = require('path'); 3 | 4 | module.exports = { 5 | 6 | resolve: { 7 | modules: [ 8 | path.resolve('./resources/assets/js'), 9 | 'node_modules' 10 | ] 11 | }, 12 | 13 | plugins: [ 14 | new webpack.ProvidePlugin({ 15 | 'jQuery': 'jquery', 16 | '$': 'jquery', 17 | '_': 'lodash' 18 | }) 19 | ] 20 | 21 | }; --------------------------------------------------------------------------------