Skip to content

Commit

Permalink
Merge pull request #186 from pacoorozco/issue-183
Browse files Browse the repository at this point in the history
Upgrade gamify-laravel to Laravel 8.x
  • Loading branch information
pacoorozco authored Feb 22, 2021
2 parents e59dba2 + b092a35 commit fff3fa3
Show file tree
Hide file tree
Showing 344 changed files with 13,625 additions and 5,442 deletions.
5 changes: 3 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ BROADCAST_DRIVER=log
QUEUE_CONNECTION=sync

LOG_CHANNEL=stack
LOG_LEVEL=debug

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
Expand Down
72 changes: 64 additions & 8 deletions .env.travis
Original file line number Diff line number Diff line change
@@ -1,21 +1,77 @@
# .env.travis

APP_NAME=GAMIFY
# Configuration for Travis jobs
APP_NAME=Gamify
APP_ENV=testing
APP_KEY=base64:KYGGyNe20C0PeTfNQk7foGJz7vor/iXFXRkAOPgeYAM=
APP_KEY=
APP_DEBUG=true
APP_URL=http://localhost

# Database configuration.
DB_CONNECTION=mysql
DB_HOST=localhost
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=testing
DB_USERNAME=travis
DB_PASSWORD=

BCRYPT_ROUNDS=4
# Cache configuration.
#
# For Redis, use 'CACHE_DRIVER=redis' and set 'REDIS_*' variables below.
CACHE_DRIVER=array
QUEUE_CONNECTION=sync

# Session manager configuration.
#
# For Redis, use 'SESSION_DRIVER=redis' and set 'REDIS_*' variables below.
SESSION_DRIVER=array
MAIL_DRIVER=array

# Redis configuration.
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

# Multi-auth configuration.
# See 'config/services.php' to know how to enable OAuth providers.
#
# For okta OAuth, set these variables.
OKTA_KEY=
OKTA_SECRET=
OKTA_REDIRECT_URI=
OKTA_BASE_URL=

# External storage service configuration.
# Define which disk will be used for uploads (user, badge and level's images).
#
# Default value (commented) is 'public' disk (see 'config/filesystems.php').
#
# You can use any available disk at 'disks' (see 'config/filesystems.php').
#
# For AWS S3, uncomment it, set 'UPLOAD_DISK=s3' and set 'AWS_*' variables below.
# UPLOAD_DISK=public

# AWS S3 configuration.
# Set 'UPLOAD_DISK=s3' to upload images to AWS.
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET=

# Trusted proxies configuration
# @see 'config/trustedproxy.php' to know how to configure these trusted proxies.
TRUSTED_PROXIES=
TRUSTED_HEADERS=

# -----[ DO NOT TOUCH BELOW THIS POINT ]-----
#
BROADCAST_DRIVER=log
QUEUE_CONNECTION=sync

LOG_CHANNEL=stack
LOG_LEVEL=debug

MAIL_MAILER=array
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
1 change: 0 additions & 1 deletion .symfony.insight.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ before_script:
script:
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover

after_script:
after_success:
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/) and this project adheres to [Semantic Versioning](https://semver.org/).

## Unreleased
> **Note**: This application has been updated to use [Laravel 8.x](https://laravel.com/docs). It's backwards compatibility, so the database does not need to be updated.
### Changed
- **Important**: This application has been upgraded to [Laravel 8.x](https://laravel.com/docs). A lot of refactors has been done in order to adopt Laravel 8.x best practices.

### Fixed
- Bug when creating a question without choices. ([#177][i177])

Expand Down
18 changes: 5 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pacoorozco/gamify-laravel/badges/quality-score.png)](https://scrutinizer-ci.com/g/pacoorozco/gamify-laravel)
[![Code Coverage](https://scrutinizer-ci.com/g/pacoorozco/gamify-laravel/badges/coverage.png)](https://scrutinizer-ci.com/g/pacoorozco/gamify-laravel)
[![License](https://img.shields.io/github/license/pacoorozco/gamify-laravel.svg)](LICENSE)
[![Laravel Version](https://img.shields.io/badge/Laravel-6.x-orange.svg)](https://laravel.com/docs/6.x)
[![Laravel Version](https://img.shields.io/badge/Laravel-8.x-orange.svg)](https://laravel.com/docs/8.x)
[![GitHub release](https://img.shields.io/github/release/pacoorozco/gamify-laravel.svg?style=flat-square)](https://github.com/pacoorozco/gamify-laravel/releases)

## Presentation
Expand Down Expand Up @@ -40,28 +40,20 @@ Prior this installation, you **need to have installed** this software:
$ git clone https://github.com/pacoorozco/gamify-laravel.git gamify
$ cd gamify
```
1. Install PHP dependencies with:

> **NOTE**: You don't need to install neither _PHP_ nor _Composer_, we are going to use a [Composer image](https://hub.docker.com/_/composer/) instead.
```bash
$ docker run --rm --interactive --tty \
--volume $PWD:/app \
--user $(id -u):$(id -g) \
composer install
```
1. Copy [`.env.example`](.env.example) to `.env`.

> **NOTE**: You don't need to touch anything from this file. It works with default settings.
1. Start all containers with [Docker Compose](https://docs.docker.com/compose/)
> **NOTE**: You **must** export the `DOCKER_APP_UID` variable if your user ID is different from `1000`. This will allow the docker to get permissions over your files.
```bash
$ export DOCKER_APP_UID="$(id -u)"
$ docker-compose build
$ docker-compose up -d
```

1. Seed database in order to play with some data
```bash
Expand Down
12 changes: 12 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

namespace Gamify\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
Expand All @@ -38,6 +39,17 @@ class Kernel extends ConsoleKernel
//
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*
Expand Down
23 changes: 23 additions & 0 deletions app/Enums/BadgeActuators.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php
/**
* Gamify - Gamification platform to implement any serious game mechanic.
*
* Copyright (c) 2018 by Paco Orozco <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Some rights reserved. See LICENSE and AUTHORS files.
*
* @author Paco Orozco <[email protected]>
* @copyright 2018 Paco Orozco
* @license GPL-3.0 <http://spdx.org/licenses/GPL-3.0>
*
* @link https://github.com/pacoorozco/gamify-laravel
*/

namespace Gamify\Enums;

Expand Down
23 changes: 23 additions & 0 deletions app/Enums/QuestionActuators.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php
/**
* Gamify - Gamification platform to implement any serious game mechanic.
*
* Copyright (c) 2018 by Paco Orozco <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Some rights reserved. See LICENSE and AUTHORS files.
*
* @author Paco Orozco <[email protected]>
* @copyright 2018 Paco Orozco
* @license GPL-3.0 <http://spdx.org/licenses/GPL-3.0>
*
* @link https://github.com/pacoorozco/gamify-laravel
*/

namespace Gamify\Enums;

Expand Down
29 changes: 26 additions & 3 deletions app/Events/PointCreated.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,39 @@
<?php
/**
* Gamify - Gamification platform to implement any serious game mechanic.
*
* Copyright (c) 2018 by Paco Orozco <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Some rights reserved. See LICENSE and AUTHORS files.
*
* @author Paco Orozco <[email protected]>
* @copyright 2018 Paco Orozco
* @license GPL-3.0 <http://spdx.org/licenses/GPL-3.0>
*
* @link https://github.com/pacoorozco/gamify-laravel
*/

namespace Gamify\Events;

use Gamify\Point;
use Gamify\Models\Point;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class PointCreated
{
use Dispatchable, SerializesModels;

/** @var \Gamify\User */
/** @var \Gamify\Models\User */
public $user;

/** @var int */
Expand All @@ -19,7 +42,7 @@ class PointCreated
/**
* Create a new event instance.
*
* @param \Gamify\Point $point
* @param \Gamify\Models\Point $point
*
* @return void
*/
Expand Down
35 changes: 29 additions & 6 deletions app/Events/QuestionAnswered.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
<?php
/**
* Gamify - Gamification platform to implement any serious game mechanic.
*
* Copyright (c) 2018 by Paco Orozco <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Some rights reserved. See LICENSE and AUTHORS files.
*
* @author Paco Orozco <[email protected]>
* @copyright 2018 Paco Orozco
* @license GPL-3.0 <http://spdx.org/licenses/GPL-3.0>
*
* @link https://github.com/pacoorozco/gamify-laravel
*/

namespace Gamify\Events;

use Gamify\Question;
use Gamify\User;
use Gamify\Models\Question;
use Gamify\Models\User;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class QuestionAnswered
{
use Dispatchable, SerializesModels;

/** @var \Gamify\User */
/** @var \Gamify\Models\User */
public User $user;

/** @var \Gamify\Question */
/** @var \Gamify\Models\Question */
public Question $question;

/** @var int */
Expand All @@ -26,8 +49,8 @@ class QuestionAnswered
/**
* Create a new event instance.
*
* @param \Gamify\User $user
* @param \Gamify\Question $question
* @param \Gamify\Models\User $user
* @param \Gamify\Models\Question $question
* @param int $points
* @param bool $correctness
*
Expand Down
23 changes: 23 additions & 0 deletions app/Events/QuestionPendingReview.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
<?php
/**
* Gamify - Gamification platform to implement any serious game mechanic.
*
* Copyright (c) 2018 by Paco Orozco <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Some rights reserved. See LICENSE and AUTHORS files.
*
* @author Paco Orozco <[email protected]>
* @copyright 2018 Paco Orozco
* @license GPL-3.0 <http://spdx.org/licenses/GPL-3.0>
*
* @link https://github.com/pacoorozco/gamify-laravel
*/

namespace Gamify\Events;

Expand Down
Loading

0 comments on commit fff3fa3

Please sign in to comment.