Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
GimmyHchs committed May 27, 2018
2 parents e3316ee + e189b5c commit e7fe403
Show file tree
Hide file tree
Showing 36 changed files with 1,110 additions and 106 deletions.
21 changes: 20 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ clone:

pipeline:
backend:
image: laradock/workspace:2.2-7.1
image: hchstera/laravel-workspace
commands:
- php -v
- composer -V
- phpcs --version
- cp .env.example .env
- composer install --prefer-dist
- php artisan key:generate
- phpcs --standard=PSR2 -p app/ tests/ config/ routes/
- ./vendor/bin/phpunit -d memory_limit=512M

pre-build:
image: docker:git
Expand All @@ -30,6 +33,20 @@ pipeline:
when:
branch: [ master ]

pre-production:
image: hchstera/laravel-workspace
pull: true
secrets: [ ssh_key ]
commands:
- mkdir -p ~/.ssh
- ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
- echo -n "$SSH_KEY" > ~/.ssh/id_rsa && chmod 0600 ~/.ssh/id_rsa
- cd $DRONE_WORKSPACE/src
- standard-version
- git push --follow-tags origin ${DRONE_COMMIT_BRANCH}
when:
branch: [ master ]

publish_dockerhub:
image: plugins/docker
repo: hchstera/cococharge
Expand All @@ -43,6 +60,7 @@ pipeline:
event: [ push ]
branch: [ master ]


deploy:
image: appleboy/drone-ssh
host: 209.97.168.149
Expand Down Expand Up @@ -71,6 +89,7 @@ pipeline:
secrets: [ plugin_channel_secret, plugin_channel_token, plugin_to_group ]
when:
status: [ success, failure ]
branch: [ master ]
event: [ push ]
message: |
{{#success build.status}}
Expand Down
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_DRIVER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
Expand Down
43 changes: 43 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('somedir')
->notPath('src/Symfony/Component/Translation/Tests/fixtures/resources.php')
->in(__DIR__);

return PhpCsFixer\Config::create()
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'class_definition' => [
'singleLine' => true,
],
'method_argument_space' => [
'ensure_fully_multiline' => true,
],
'increment_style' => [
'style' => 'post',
],
'cast_spaces' => [
'space' => 'none',
],
'concat_space' => [
'spacing' => 'one',
],
'phpdoc_align' => [
'tags' => ['method', 'property', 'return', 'throws', 'type', 'var'],
],
'phpdoc_order' => true,
'phpdoc_to_comment' => false,
'ternary_to_null_coalescing' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_class_elements' => true,
'ordered_imports' => true,
'yoda_style' => false,
'array_syntax' => [
'syntax' => 'short',
],
])
->setFinder($finder)
;
25 changes: 25 additions & 0 deletions app/Eloquents/Account/LineUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

namespace App\Eloquents\Account;

use Illuminate\Foundation\Auth\User as Authenticatable;

class LineUser extends Authenticatable
{
protected $table = 'line_users';

protected $fillable = [
'user_id', // for key
'line_id', // line的唯一識別碼
];

public function user()
{
return $this->belongsTo(User::class);
}

public function assignToUser($user)
{
return $this->user()->associate($user)->save();
}
}
14 changes: 11 additions & 3 deletions app/User.php → app/Eloquents/Account/User.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace App;
namespace App\Eloquents\Account;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
{
Expand All @@ -24,6 +24,14 @@ class User extends Authenticatable
* @var array
*/
protected $hidden = [
'password', 'remember_token',
'password',
'remember_token',
'created_at',
'updated_at',
];

public function lineUser()
{
return $this->hasOne(LineUser::class);
}
}
12 changes: 12 additions & 0 deletions app/Eloquents/Eloquent.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace App\Eloquents;

use Illuminate\Database\Eloquent\Model;

/**
* Base eloquent class.
*/
abstract class Eloquent extends Model
{
}
10 changes: 4 additions & 6 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@

namespace App\Providers;

use Barryvdh\Debugbar\ServiceProvider as DebugBarServiceProvider;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}

/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
if ($this->app->environment() !== 'production') {
$this->app->register(DebugBarServiceProvider::class);
}
}
}
16 changes: 6 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"type": "project",
"require": {
"php": "^7.1.3",
"guzzlehttp/guzzle": "^6.2",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0"
Expand All @@ -15,13 +16,11 @@
"fzaninotto/faker": "^1.4",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^2.0",
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^7.0",
"barryvdh/laravel-debugbar": "^3.1"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"classmap": ["database/seeds", "database/factories"],
"psr-4": {
"App\\": "app/"
}
Expand All @@ -33,17 +32,14 @@
},
"extra": {
"laravel": {
"dont-discover": [
]
"dont-discover": []
}
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-create-project-cmd": ["@php artisan key:generate"],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
Expand Down
Loading

0 comments on commit e7fe403

Please sign in to comment.