├── .env.example
├── .gitignore
├── Makefile
├── docker-compose.yml
├── readme.md
├── services
├── mysql
│ ├── Dockerfile
│ └── my.cnf
└── php
│ ├── Dockerfile
│ └── myapp.conf
└── src
├── .editorconfig
├── .env.example
├── .gitattributes
├── .gitignore
├── .styleci.yml
├── Makefile
├── app
├── Console
│ └── Kernel.php
├── Exceptions
│ └── Handler.php
├── Http
│ ├── Controllers
│ │ ├── Auth
│ │ │ ├── ForgotPasswordController.php
│ │ │ ├── LoginController.php
│ │ │ ├── RegisterController.php
│ │ │ ├── ResetPasswordController.php
│ │ │ └── VerificationController.php
│ │ └── Controller.php
│ ├── Kernel.php
│ └── Middleware
│ │ ├── Authenticate.php
│ │ ├── CheckForMaintenanceMode.php
│ │ ├── EncryptCookies.php
│ │ ├── RedirectIfAuthenticated.php
│ │ ├── TrimStrings.php
│ │ ├── TrustProxies.php
│ │ └── VerifyCsrfToken.php
├── Providers
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── BroadcastServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
└── User.php
├── artisan
├── bootstrap
├── app.php
└── cache
│ └── .gitignore
├── composer.json
├── composer.lock
├── config
├── app.php
├── auth.php
├── broadcasting.php
├── cache.php
├── database.php
├── filesystems.php
├── hashing.php
├── logging.php
├── mail.php
├── queue.php
├── services.php
├── session.php
└── view.php
├── database
├── .gitignore
├── factories
│ └── UserFactory.php
├── migrations
│ ├── 2014_10_12_000000_create_users_table.php
│ └── 2014_10_12_100000_create_password_resets_table.php
└── seeds
│ └── DatabaseSeeder.php
├── package.json
├── packages
├── Components
│ └── CreateInbox
│ │ ├── .gitignore
│ │ ├── composer.json
│ │ ├── phpunit.xml
│ │ ├── src
│ │ ├── DataAccess
│ │ │ └── Database
│ │ │ │ ├── Eloquents
│ │ │ │ ├── CompletedTask.php
│ │ │ │ ├── EstimatedTime.php
│ │ │ │ ├── Task.php
│ │ │ │ └── TaskStartDate.php
│ │ │ │ ├── EntityUnidentifiedException.php
│ │ │ │ ├── Exception.php
│ │ │ │ ├── InvalidArgumentException.php
│ │ │ │ ├── Repositories
│ │ │ │ ├── AutoIncrementTaskId.php
│ │ │ │ ├── AutoIncrementTaskIdProvider.php
│ │ │ │ └── TaskRepository.php
│ │ │ │ └── migrations
│ │ │ │ ├── 2019_06_24_000000_create_tasks_table.php
│ │ │ │ ├── 2019_06_24_000001_create_estimated_times_table.php
│ │ │ │ ├── 2019_06_24_000002_create_task_start_dates_table.php
│ │ │ │ └── 2019_06_24_000003_create_completed_tasks_table.php
│ │ ├── ServiceProvider.php
│ │ ├── UseCase
│ │ │ ├── Exception.php
│ │ │ ├── IdProvider.php
│ │ │ ├── InputBoundary.php
│ │ │ ├── InputData.php
│ │ │ ├── Interactor.php
│ │ │ ├── NormalOutputBoundary.php
│ │ │ ├── NormalOutputData.php
│ │ │ ├── NotFoundException.php
│ │ │ └── TaskRepository.php
│ │ └── UserInterface
│ │ │ └── Web
│ │ │ ├── Controller.php
│ │ │ ├── NormalPresenter.php
│ │ │ ├── ViewModel.php
│ │ │ ├── routes
│ │ │ └── web.php
│ │ │ └── views
│ │ │ └── tasks
│ │ │ └── create.blade.php
│ │ └── tests
│ │ ├── DataAccess
│ │ └── Database
│ │ │ └── Repositories
│ │ │ ├── AutopIncrementTaskIdProviderTest.php
│ │ │ └── AutopIncrementTaskIdTest.php
│ │ └── UseCases
│ │ ├── InMemoryId.php
│ │ ├── InMemoryIdProvider.php
│ │ ├── InMemoryTaskRepository.php
│ │ ├── InputDataTest.php
│ │ └── InteractorTest.php
└── Entities
│ ├── Task
│ ├── .gitignore
│ ├── composer.json
│ ├── phpunit.xml
│ ├── readme.md
│ ├── src
│ │ ├── Completed.php
│ │ ├── EstimatedTime.php
│ │ ├── EstimatedTimeNotSet.php
│ │ ├── Exception.php
│ │ ├── Id.php
│ │ ├── Inbox.php
│ │ ├── InvalidArgumentException.php
│ │ ├── Name.php
│ │ ├── Note.php
│ │ ├── Scheduled.php
│ │ ├── StartDate.php
│ │ └── Task.php
│ └── tests
│ │ ├── InboxTest.php
│ │ ├── ScheduledTest.php
│ │ └── TaskTest.php
│ └── Waiting
│ ├── .gitignore
│ ├── composer.json
│ ├── phpunit.xml
│ ├── readme.md
│ ├── src
│ ├── Completed.php
│ ├── Exception.php
│ ├── Id.php
│ ├── InvalidArgumentException.php
│ ├── Name.php
│ ├── Note.php
│ └── Waiting.php
│ └── tests
│ └── Entities
│ └── WaitingTest.php
├── phpunit.xml
├── public
├── .htaccess
├── css
│ └── app.css
├── favicon.ico
├── index.php
├── js
│ └── app.js
├── robots.txt
└── web.config
├── readme.md
├── resources
├── js
│ ├── app.js
│ ├── bootstrap.js
│ └── components
│ │ └── ExampleComponent.vue
├── lang
│ └── en
│ │ ├── auth.php
│ │ ├── pagination.php
│ │ ├── passwords.php
│ │ └── validation.php
├── sass
│ ├── _variables.scss
│ └── app.scss
└── views
│ └── welcome.blade.php
├── routes
├── api.php
├── channels.php
├── console.php
└── web.php
├── server.php
├── storage
├── app
│ ├── .gitignore
│ └── public
│ │ └── .gitignore
├── framework
│ ├── .gitignore
│ ├── cache
│ │ ├── .gitignore
│ │ └── data
│ │ │ └── .gitignore
│ ├── sessions
│ │ └── .gitignore
│ ├── testing
│ │ └── .gitignore
│ └── views
│ │ └── .gitignore
└── logs
│ └── .gitignore
├── tests
├── CreatesApplication.php
├── Feature
│ └── ExampleTest.php
├── TestCase.php
└── Unit
│ └── ExampleTest.php
└── webpack.mix.js
/.env.example:
--------------------------------------------------------------------------------
1 | COMPOSE_PROJECT_NAME=laravel-clean-architecture
2 |
3 | TZ=Asia/Tokyo
4 |
5 | # 自身の開発環境で `id -u` `id -g` した結果を設定
6 | USER_ID=
7 | GROUP_ID=
8 |
9 | # 必要に応じて変更
10 | HTTP_PORT=80
11 | DATABASE_PORT=3306
12 |
13 | # 必要に応じて変更
14 | DATABASE_ROOT_PASSWORD=root
15 | DATABASE_NAME=homestead
16 | DATABASE_USER=homestead
17 | DATABASE_PASSWORD=secret
18 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .env
2 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | PHP = docker-compose run --rm php-cli
2 |
3 | .PHONY: default up down setup artisan composer test
4 |
5 | default: up
6 |
7 | up: .env
8 | docker-compose up -d --build
9 |
10 | down:
11 | docker-compose down
12 |
13 | setup: up
14 | $(PHP) make setup
15 |
16 | .env:
17 | echo ".env.example をコピーして .env を作成し、値を設定してください"
18 | exit 1
19 |
20 | src/.env:
21 | $(PHP) make .env
22 |
23 | artisan: .env src/.env
24 | $(PHP) php artisan $(CMD)
25 |
26 | composer: .env
27 | $(PHP) composer $(CMD)
28 |
29 | test: .env src/.env
30 | $(PHP) make test
31 |
--------------------------------------------------------------------------------
/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3"
2 |
3 | services:
4 |
5 | web:
6 | build:
7 | context: ./services/php
8 | args:
9 | USER_ID: "${USER_ID}"
10 | GROUP_ID: "${GROUP_ID}"
11 | volumes:
12 | - ./src:/var/www/app
13 | depends_on:
14 | - database
15 | ports:
16 | - "${HTTP_PORT}:80"
17 | env_file:
18 | - ./.env
19 | environment:
20 | APP_NAME: "${COMPOSE_PROJECT_NAME}"
21 | DB_DATABASE: "${DATABASE_NAME}"
22 | DB_USERNAME: "${DATABASE_USER}"
23 | DB_PASSWORD: "${DATABASE_PASSWORD}"
24 |
25 | php-cli:
26 | build:
27 | context: ./services/php
28 | args:
29 | USER_ID: "${USER_ID}"
30 | GROUP_ID: "${GROUP_ID}"
31 | user: "${USER_ID}:${GROUP_ID}"
32 | volumes:
33 | - ./src:/var/www/app
34 | depends_on:
35 | - database
36 | env_file:
37 | - ./.env
38 | environment:
39 | APP_NAME: "${COMPOSE_PROJECT_NAME}"
40 | DB_DATABASE: "${DATABASE_NAME}"
41 | DB_USERNAME: "${DATABASE_USER}"
42 | DB_PASSWORD: "${DATABASE_PASSWORD}"
43 |
44 | database:
45 | build:
46 | context: ./services/mysql
47 | volumes:
48 | - mysql:/var/lib/mysql
49 | ports:
50 | - "${DATABASE_PORT}:3306"
51 | environment:
52 | TZ: "${TZ}"
53 | MYSQL_ALLOW_EMPTY_PASSWORD: "no"
54 | MYSQL_ROOT_PASSWORD: "${DATABASE_ROOT_PASSWORD}"
55 | MYSQL_DATABASE: "${DATABASE_NAME}"
56 | MYSQL_USER: "${DATABASE_USER}"
57 | MYSQL_PASSWORD: "${DATABASE_PASSWORD}"
58 |
59 | volumes:
60 | mysql:
61 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ## Laravel を用いたクリーンアーキテクチャに基づく実装のサンプルアプリケーション
2 |
3 | ## 動作環境
4 |
5 | * Docker
6 | * Docker Compose
7 |
8 | ## ディレクトリ構造
9 |
10 | ```text
11 | ./
12 | |-- services/ # Docker イメージビルド用のファイル等が入っている
13 | |-- src/ # ソースコード
14 | : :
15 | | |-- packages/ # 各パッケージ
16 | | | |-- api/ # Web API 用パッケージ
17 | | | |-- components/ # 各種ビジネスルール(Application Business Rules, Enterprise Business Rules)
18 | | | |-- console/ # コンソール用パッケージ
19 | | | |-- database/ # データベース用パッケージ
20 | | | `-- database/ # Web アプリケーション用パッケージ
21 | : :
22 | ```
23 |
24 | 詳細は各パッケージの readme を参照のこと
25 |
26 |
27 | ## 参考スライド
28 |
29 | * [Laravel でやってみるクリーンアーキテクチャ #phpconfuk](https://www.slideshare.net/ShoheiOkada/laravel-phpconfuk-152500600)
30 | * 2018/06/29 開催の [PHP カンファレンス福岡 2019](https://phpcon.fukuoka.jp/2019/) の発表資料
31 |
--------------------------------------------------------------------------------
/services/mysql/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mysql:8.0.16
2 |
3 | RUN apt-get update &&\
4 | apt-get install -y locales curl &&\
5 | rm -rf /var/lib/apt/lists/* &&\
6 | echo "ja_JP.UTF-8 UTF-8" > /etc/locale.gen &&\
7 | locale-gen ja_JP.UTF-8
8 |
9 | ENV LANG ja_JP.UTF-8
10 |
11 | COPY ./my.cnf /etc/mysql/conf.d/my.cnf
12 |
--------------------------------------------------------------------------------
/services/mysql/my.cnf:
--------------------------------------------------------------------------------
1 | [mysqld]
2 | character-set-server=utf8mb4
3 | collation-server=utf8mb4_bin
4 | default_authentication_plugin=mysql_native_password
5 | [client]
6 | default-character-set=utf8mb4
7 |
--------------------------------------------------------------------------------
/services/php/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM php:7.3.6-apache
2 |
3 | ARG USER_ID
4 | ARG GROUP_ID
5 |
6 | ENV APACHE_RUN_USER="developer" \
7 | APACHE_RUN_GROUP="developer"
8 |
9 | RUN apt-get update &&\
10 | apt-get install -y \
11 | git \
12 | mysql-client \
13 | libicu-dev \
14 | zlib1g-dev \
15 | libzip-dev &&\
16 | docker-php-ext-install \
17 | mbstring \
18 | intl \
19 | pdo_mysql \
20 | zip &&\
21 | apt-get clean &&\
22 | rm -rf /var/lib/apt/lists/*
23 |
24 | RUN curl -sS https://getcomposer.org/installer | php &&\
25 | mv composer.phar /usr/local/bin/composer
26 |
27 | RUN groupadd -g $GROUP_ID -o developer &&\
28 | useradd -m developer -u $USER_ID -g $GROUP_ID
29 |
30 | COPY ./myapp.conf /etc/apache2/sites-available/myapp.conf
31 | RUN a2ensite myapp.conf &&\
32 | a2dissite 000-default.conf
33 |
34 | WORKDIR /var/www/app
35 |
--------------------------------------------------------------------------------
/services/php/myapp.conf:
--------------------------------------------------------------------------------
1 | LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
2 |
3 |
4 | DocumentRoot /var/www/app/public
5 |
6 | Options +FollowSymLinks
7 | AllowOverride All
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | insert_final_newline = true
7 | indent_style = space
8 | indent_size = 4
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | trim_trailing_whitespace = false
13 |
14 | [*.yml]
15 | indent_size = 2
16 |
17 | [composer.json]
18 | indent_size = 2
19 |
20 | [composer.lock]
21 | indent_size = 2
22 |
--------------------------------------------------------------------------------
/src/.env.example:
--------------------------------------------------------------------------------
1 | APP_ENV=local
2 |
3 | APP_DEBUG=true
4 | APP_URL=http://localhost
5 |
6 | LOG_CHANNEL=stack
7 |
8 | BROADCAST_DRIVER=log
9 | CACHE_DRIVER=file
10 | QUEUE_CONNECTION=sync
11 | SESSION_DRIVER=file
12 | SESSION_LIFETIME=120
13 |
14 | REDIS_HOST=127.0.0.1
15 | REDIS_PASSWORD=null
16 | REDIS_PORT=6379
17 |
18 | MAIL_DRIVER=smtp
19 | MAIL_HOST=smtp.mailtrap.io
20 | MAIL_PORT=2525
21 | MAIL_USERNAME=null
22 | MAIL_PASSWORD=null
23 | MAIL_ENCRYPTION=null
24 |
25 | AWS_ACCESS_KEY_ID=
26 | AWS_SECRET_ACCESS_KEY=
27 | AWS_DEFAULT_REGION=us-east-1
28 | AWS_BUCKET=
29 |
30 | PUSHER_APP_ID=
31 | PUSHER_APP_KEY=
32 | PUSHER_APP_SECRET=
33 | PUSHER_APP_CLUSTER=mt1
34 |
35 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
36 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
37 |
38 | ############################
39 | # 以下は手動で変更しないこと!
40 | ############################
41 |
42 | APP_KEY=
43 |
44 | DB_CONNECTION=mysql
45 | DB_HOST=database
46 | DB_PORT=3306
47 |
--------------------------------------------------------------------------------
/src/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.scss linguist-vendored
4 | *.js linguist-vendored
5 | CHANGELOG.md export-ignore
6 |
--------------------------------------------------------------------------------
/src/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /public/hot
3 | /public/storage
4 | /storage/*.key
5 | /vendor
6 | .env
7 | .phpunit.result.cache
8 | Homestead.json
9 | Homestead.yaml
10 | npm-debug.log
11 | yarn-error.log
12 |
--------------------------------------------------------------------------------
/src/.styleci.yml:
--------------------------------------------------------------------------------
1 | php:
2 | preset: laravel
3 | disabled:
4 | - unused_use
5 | finder:
6 | not-name:
7 | - index.php
8 | - server.php
9 | js:
10 | finder:
11 | not-name:
12 | - webpack.mix.js
13 | css: true
14 |
--------------------------------------------------------------------------------
/src/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: setup test
2 |
3 | setup: .env vendor/autoload.php
4 | php artisan key:generate
5 | php artisan migrate
6 | chmod -R 777 storage bootstrap/cache
7 |
8 | .env:
9 | echo ".env.example をコピーして .env を作成し、値を設定してください"
10 | exit 1
11 |
12 | vendor/autoload.php:
13 | composer install
14 |
15 | test: vendor/bin/phpunit
16 | ./vendor/bin/phpunit
17 |
18 | vendor/bin/phpunit:
19 | composer install
20 |
--------------------------------------------------------------------------------
/src/app/Console/Kernel.php:
--------------------------------------------------------------------------------
1 | command('inspire')
28 | // ->hourly();
29 | }
30 |
31 | /**
32 | * Register the commands for the application.
33 | *
34 | * @return void
35 | */
36 | protected function commands()
37 | {
38 | $this->load(__DIR__ . '/Commands');
39 |
40 | require base_path('routes/console.php');
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/app/Http/Controllers/Auth/LoginController.php:
--------------------------------------------------------------------------------
1 | middleware('guest')->except('logout');
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/app/Http/Controllers/Auth/RegisterController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
41 | }
42 |
43 | /**
44 | * Get a validator for an incoming registration request.
45 | *
46 | * @param array $data
47 | * @return \Illuminate\Contracts\Validation\Validator
48 | */
49 | protected function validator(array $data)
50 | {
51 | return Validator::make($data, [
52 | 'name' => ['required', 'string', 'max:255'],
53 | 'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
54 | 'password' => ['required', 'string', 'min:8', 'confirmed'],
55 | ]);
56 | }
57 |
58 | /**
59 | * Create a new user instance after a valid registration.
60 | *
61 | * @param array $data
62 | * @return \App\User
63 | */
64 | protected function create(array $data)
65 | {
66 | return User::create([
67 | 'name' => $data['name'],
68 | 'email' => $data['email'],
69 | 'password' => Hash::make($data['password']),
70 | ]);
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/src/app/Http/Controllers/Auth/ResetPasswordController.php:
--------------------------------------------------------------------------------
1 | middleware('guest');
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/app/Http/Controllers/Auth/VerificationController.php:
--------------------------------------------------------------------------------
1 | middleware('auth');
38 | $this->middleware('signed')->only('verify');
39 | $this->middleware('throttle:6,1')->only('verify', 'resend');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/src/app/Http/Controllers/Controller.php:
--------------------------------------------------------------------------------
1 | [
36 | \App\Http\Middleware\EncryptCookies::class,
37 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
38 | \Illuminate\Session\Middleware\StartSession::class,
39 | // \Illuminate\Session\Middleware\AuthenticateSession::class,
40 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
41 | \App\Http\Middleware\VerifyCsrfToken::class,
42 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
43 | ],
44 |
45 | 'api' => [
46 | 'throttle:60,1',
47 | 'bindings',
48 | ],
49 | ];
50 |
51 | /**
52 | * The application's route middleware.
53 | *
54 | * These middleware may be assigned to groups or used individually.
55 | *
56 | * @var array
57 | */
58 | protected $routeMiddleware = [
59 | 'auth' => \App\Http\Middleware\Authenticate::class,
60 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
61 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
62 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
63 | 'can' => \Illuminate\Auth\Middleware\Authorize::class,
64 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
65 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
66 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
67 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
68 | ];
69 |
70 | /**
71 | * The priority-sorted list of middleware.
72 | *
73 | * This forces non-global middleware to always be in the given order.
74 | *
75 | * @var array
76 | */
77 | protected $middlewarePriority = [
78 | \Illuminate\Session\Middleware\StartSession::class,
79 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
80 | \App\Http\Middleware\Authenticate::class,
81 | \Illuminate\Session\Middleware\AuthenticateSession::class,
82 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
83 | \Illuminate\Auth\Middleware\Authorize::class,
84 | ];
85 |
86 | /**
87 | * Handle an incoming HTTP request.
88 | *
89 | * @param \Illuminate\Http\Request $request
90 | * @return \Illuminate\Http\Response
91 | */
92 | public function handle($request)
93 | {
94 | try {
95 | $request->enableHttpMethodParameterOverride();
96 |
97 | $response = $this->sendRequestThroughRouter($request);
98 |
99 | // TODO: Middleware のレスポンスを加工する側の処理が反映されていないので直す
100 |
101 | if ($response->getContent() == '') {
102 | $response = $this->app['response'];
103 | }
104 | } catch (Exception $e) {
105 | $this->reportException($e);
106 |
107 | $response = $this->renderException($request, $e);
108 | } catch (Throwable $e) {
109 | $this->reportException($e = new FatalThrowableError($e));
110 |
111 | $response = $this->renderException($request, $e);
112 | }
113 |
114 | $this->app['events']->dispatch(
115 | new Events\RequestHandled($request, $response)
116 | );
117 |
118 | return $response;
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/src/app/Http/Middleware/Authenticate.php:
--------------------------------------------------------------------------------
1 | expectsJson()) {
18 | return route('login');
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/app/Http/Middleware/CheckForMaintenanceMode.php:
--------------------------------------------------------------------------------
1 | check()) {
21 | return redirect('/home');
22 | }
23 |
24 | return $next($request);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/app/Http/Middleware/TrimStrings.php:
--------------------------------------------------------------------------------
1 | app->bind(IdProvider::class, AutoIncrementTaskIdProvider::class);
21 |
22 | $this->app->bind(TaskRepositoryInterface::class, TaskRepository::class);
23 | }
24 |
25 | /**
26 | * Bootstrap any application services.
27 | *
28 | * @return void
29 | */
30 | public function boot()
31 | {
32 | //
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/app/Providers/AuthServiceProvider.php:
--------------------------------------------------------------------------------
1 | 'App\Policies\ModelPolicy',
17 | ];
18 |
19 | /**
20 | * Register any authentication / authorization services.
21 | *
22 | * @return void
23 | */
24 | public function boot()
25 | {
26 | $this->registerPolicies();
27 |
28 | //
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/app/Providers/BroadcastServiceProvider.php:
--------------------------------------------------------------------------------
1 | [
19 | SendEmailVerificationNotification::class,
20 | ],
21 | ];
22 |
23 | /**
24 | * Register any events for your application.
25 | *
26 | * @return void
27 | */
28 | public function boot()
29 | {
30 | parent::boot();
31 |
32 | //
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | mapApiRoutes();
39 |
40 | $this->mapWebRoutes();
41 |
42 | //
43 | }
44 |
45 | /**
46 | * Define the "api" routes for the application.
47 | *
48 | * These routes are typically stateless.
49 | *
50 | * @return void
51 | */
52 | protected function mapApiRoutes()
53 | {
54 | Route::prefix('api')
55 | ->middleware('api')
56 | ->namespace($this->namespace)
57 | ->group(base_path('routes/api.php'));
58 | }
59 |
60 | /**
61 | * Define the "web" routes for the application.
62 | *
63 | * These routes all receive session state, CSRF protection, etc.
64 | *
65 | * @return void
66 | */
67 | protected function mapWebRoutes()
68 | {
69 | Route::middleware('web')
70 | ->namespace($this->namespace)
71 | ->group(base_path('routes/web.php'));
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/app/User.php:
--------------------------------------------------------------------------------
1 | 'datetime',
38 | ];
39 | }
40 |
--------------------------------------------------------------------------------
/src/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | make(Illuminate\Contracts\Console\Kernel::class);
34 |
35 | $status = $kernel->handle(
36 | $input = new Symfony\Component\Console\Input\ArgvInput,
37 | new Symfony\Component\Console\Output\ConsoleOutput
38 | );
39 |
40 | /*
41 | |--------------------------------------------------------------------------
42 | | Shutdown The Application
43 | |--------------------------------------------------------------------------
44 | |
45 | | Once Artisan has finished running, we will fire off the shutdown events
46 | | so that any final work may be done by the application before we shut
47 | | down the process. This is the last thing to happen to the request.
48 | |
49 | */
50 |
51 | $kernel->terminate($input, $status);
52 |
53 | exit($status);
54 |
--------------------------------------------------------------------------------
/src/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 |
--------------------------------------------------------------------------------
/src/bootstrap/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/src/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "okashoi/laravel-clean-architecture",
3 | "type": "project",
4 | "description": "Example application for introducing clean architecture",
5 | "authors": [
6 | {
7 | "name": "Okada Shohei",
8 | "email": "okashoicircus0@gmail.com"
9 | }
10 | ],
11 | "keywords": [
12 | "framework",
13 | "laravel",
14 | "clean architecture"
15 | ],
16 | "license": "MIT",
17 | "require": {
18 | "php": "^7.3",
19 | "fideloper/proxy": "^4.0",
20 | "laravel/framework": "^6.0",
21 | "laravel/tinker": "^1.0",
22 | "okashoi/myapp-create-inbox": "*@dev",
23 | "okashoi/myapp-task": "*@dev",
24 | "okashoi/myapp-waiting": "*@dev"
25 | },
26 | "require-dev": {
27 | "beyondcode/laravel-dump-server": "^1.0",
28 | "filp/whoops": "^2.0",
29 | "fzaninotto/faker": "^1.4",
30 | "mockery/mockery": "^1.0",
31 | "nunomaduro/collision": "^3.0",
32 | "phpunit/phpunit": "^7.5"
33 | },
34 | "config": {
35 | "optimize-autoloader": true,
36 | "preferred-install": "dist",
37 | "sort-packages": true
38 | },
39 | "extra": {
40 | "laravel": {
41 | "dont-discover": []
42 | }
43 | },
44 | "autoload": {
45 | "psr-4": {
46 | "App\\": "app/"
47 | },
48 | "classmap": [
49 | "database/seeds",
50 | "database/factories"
51 | ]
52 | },
53 | "repositories": [
54 | {
55 | "type": "path",
56 | "url": "./packages/Components/CreateInbox"
57 | },
58 | {
59 | "type": "path",
60 | "url": "./packages/Entities/Task"
61 | },
62 | {
63 | "type": "path",
64 | "url": "./packages/Entities/Waiting"
65 | }
66 | ],
67 | "autoload-dev": {
68 | "psr-4": {
69 | "Tests\\": "tests/"
70 | }
71 | },
72 | "minimum-stability": "dev",
73 | "prefer-stable": true,
74 | "scripts": {
75 | "post-autoload-dump": [
76 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
77 | "@php artisan package:discover --ansi"
78 | ],
79 | "post-root-package-install": [
80 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
81 | ],
82 | "post-create-project-cmd": [
83 | "@php artisan key:generate --ansi"
84 | ]
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/config/app.php:
--------------------------------------------------------------------------------
1 | env('APP_NAME', 'Laravel'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Application Environment
21 | |--------------------------------------------------------------------------
22 | |
23 | | This value determines the "environment" your application is currently
24 | | running in. This may determine how you prefer to configure various
25 | | services the application utilizes. Set this in your ".env" file.
26 | |
27 | */
28 |
29 | 'env' => env('APP_ENV', 'production'),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Application Debug Mode
34 | |--------------------------------------------------------------------------
35 | |
36 | | When your application is in debug mode, detailed error messages with
37 | | stack traces will be shown on every error that occurs within your
38 | | application. If disabled, a simple generic error page is shown.
39 | |
40 | */
41 |
42 | 'debug' => env('APP_DEBUG', false),
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Application URL
47 | |--------------------------------------------------------------------------
48 | |
49 | | This URL is used by the console to properly generate URLs when using
50 | | the Artisan command line tool. You should set this to the root of
51 | | your application so that it is used when running Artisan tasks.
52 | |
53 | */
54 |
55 | 'url' => env('APP_URL', 'http://localhost'),
56 |
57 | 'asset_url' => env('ASSET_URL', null),
58 |
59 | /*
60 | |--------------------------------------------------------------------------
61 | | Application Timezone
62 | |--------------------------------------------------------------------------
63 | |
64 | | Here you may specify the default timezone for your application, which
65 | | will be used by the PHP date and date-time functions. We have gone
66 | | ahead and set this to a sensible default for you out of the box.
67 | |
68 | */
69 |
70 | 'timezone' => 'UTC',
71 |
72 | /*
73 | |--------------------------------------------------------------------------
74 | | Application Locale Configuration
75 | |--------------------------------------------------------------------------
76 | |
77 | | The application locale determines the default locale that will be used
78 | | by the translation service provider. You are free to set this value
79 | | to any of the locales which will be supported by the application.
80 | |
81 | */
82 |
83 | 'locale' => 'en',
84 |
85 | /*
86 | |--------------------------------------------------------------------------
87 | | Application Fallback Locale
88 | |--------------------------------------------------------------------------
89 | |
90 | | The fallback locale determines the locale to use when the current one
91 | | is not available. You may change the value to correspond to any of
92 | | the language folders that are provided through your application.
93 | |
94 | */
95 |
96 | 'fallback_locale' => 'en',
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Faker Locale
101 | |--------------------------------------------------------------------------
102 | |
103 | | This locale will be used by the Faker PHP library when generating fake
104 | | data for your database seeds. For example, this will be used to get
105 | | localized telephone numbers, street address information and more.
106 | |
107 | */
108 |
109 | 'faker_locale' => 'en_US',
110 |
111 | /*
112 | |--------------------------------------------------------------------------
113 | | Encryption Key
114 | |--------------------------------------------------------------------------
115 | |
116 | | This key is used by the Illuminate encrypter service and should be set
117 | | to a random, 32 character string, otherwise these encrypted strings
118 | | will not be safe. Please do this before deploying an application!
119 | |
120 | */
121 |
122 | 'key' => env('APP_KEY'),
123 |
124 | 'cipher' => 'AES-256-CBC',
125 |
126 | /*
127 | |--------------------------------------------------------------------------
128 | | Autoloaded Service Providers
129 | |--------------------------------------------------------------------------
130 | |
131 | | The service providers listed here will be automatically loaded on the
132 | | request to your application. Feel free to add your own services to
133 | | this array to grant expanded functionality to your applications.
134 | |
135 | */
136 |
137 | 'providers' => [
138 |
139 | /*
140 | * Laravel Framework Service Providers...
141 | */
142 | Illuminate\Auth\AuthServiceProvider::class,
143 | Illuminate\Broadcasting\BroadcastServiceProvider::class,
144 | Illuminate\Bus\BusServiceProvider::class,
145 | Illuminate\Cache\CacheServiceProvider::class,
146 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
147 | Illuminate\Cookie\CookieServiceProvider::class,
148 | Illuminate\Database\DatabaseServiceProvider::class,
149 | Illuminate\Encryption\EncryptionServiceProvider::class,
150 | Illuminate\Filesystem\FilesystemServiceProvider::class,
151 | Illuminate\Foundation\Providers\FoundationServiceProvider::class,
152 | Illuminate\Hashing\HashServiceProvider::class,
153 | Illuminate\Mail\MailServiceProvider::class,
154 | Illuminate\Notifications\NotificationServiceProvider::class,
155 | Illuminate\Pagination\PaginationServiceProvider::class,
156 | Illuminate\Pipeline\PipelineServiceProvider::class,
157 | Illuminate\Queue\QueueServiceProvider::class,
158 | Illuminate\Redis\RedisServiceProvider::class,
159 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
160 | Illuminate\Session\SessionServiceProvider::class,
161 | Illuminate\Translation\TranslationServiceProvider::class,
162 | Illuminate\Validation\ValidationServiceProvider::class,
163 | Illuminate\View\ViewServiceProvider::class,
164 |
165 | /*
166 | * Package Service Providers...
167 | */
168 |
169 | /*
170 | * Application Service Providers...
171 | */
172 | App\Providers\AppServiceProvider::class,
173 | App\Providers\AuthServiceProvider::class,
174 | // App\Providers\BroadcastServiceProvider::class,
175 | App\Providers\EventServiceProvider::class,
176 | App\Providers\RouteServiceProvider::class,
177 |
178 | ],
179 |
180 | /*
181 | |--------------------------------------------------------------------------
182 | | Class Aliases
183 | |--------------------------------------------------------------------------
184 | |
185 | | This array of class aliases will be registered when this application
186 | | is started. However, feel free to register as many as you wish as
187 | | the aliases are "lazy" loaded so they don't hinder performance.
188 | |
189 | */
190 |
191 | 'aliases' => [
192 |
193 | 'App' => Illuminate\Support\Facades\App::class,
194 | 'Arr' => Illuminate\Support\Arr::class,
195 | 'Artisan' => Illuminate\Support\Facades\Artisan::class,
196 | 'Auth' => Illuminate\Support\Facades\Auth::class,
197 | 'Blade' => Illuminate\Support\Facades\Blade::class,
198 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
199 | 'Bus' => Illuminate\Support\Facades\Bus::class,
200 | 'Cache' => Illuminate\Support\Facades\Cache::class,
201 | 'Config' => Illuminate\Support\Facades\Config::class,
202 | 'Cookie' => Illuminate\Support\Facades\Cookie::class,
203 | 'Crypt' => Illuminate\Support\Facades\Crypt::class,
204 | 'DB' => Illuminate\Support\Facades\DB::class,
205 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class,
206 | 'Event' => Illuminate\Support\Facades\Event::class,
207 | 'File' => Illuminate\Support\Facades\File::class,
208 | 'Gate' => Illuminate\Support\Facades\Gate::class,
209 | 'Hash' => Illuminate\Support\Facades\Hash::class,
210 | 'Lang' => Illuminate\Support\Facades\Lang::class,
211 | 'Log' => Illuminate\Support\Facades\Log::class,
212 | 'Mail' => Illuminate\Support\Facades\Mail::class,
213 | 'Notification' => Illuminate\Support\Facades\Notification::class,
214 | 'Password' => Illuminate\Support\Facades\Password::class,
215 | 'Queue' => Illuminate\Support\Facades\Queue::class,
216 | 'Redirect' => Illuminate\Support\Facades\Redirect::class,
217 | 'Redis' => Illuminate\Support\Facades\Redis::class,
218 | 'Request' => Illuminate\Support\Facades\Request::class,
219 | 'Response' => Illuminate\Support\Facades\Response::class,
220 | 'Route' => Illuminate\Support\Facades\Route::class,
221 | 'Schema' => Illuminate\Support\Facades\Schema::class,
222 | 'Session' => Illuminate\Support\Facades\Session::class,
223 | 'Storage' => Illuminate\Support\Facades\Storage::class,
224 | 'Str' => Illuminate\Support\Str::class,
225 | 'URL' => Illuminate\Support\Facades\URL::class,
226 | 'Validator' => Illuminate\Support\Facades\Validator::class,
227 | 'View' => Illuminate\Support\Facades\View::class,
228 |
229 | ],
230 |
231 | ];
232 |
--------------------------------------------------------------------------------
/src/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' => 'token',
46 | 'provider' => 'users',
47 | 'hash' => false,
48 | ],
49 | ],
50 |
51 | /*
52 | |--------------------------------------------------------------------------
53 | | User Providers
54 | |--------------------------------------------------------------------------
55 | |
56 | | All authentication drivers have a user provider. This defines how the
57 | | users are actually retrieved out of your database or other storage
58 | | mechanisms used by this application to persist your user's data.
59 | |
60 | | If you have multiple user tables or models you may configure multiple
61 | | sources which represent each model / table. These sources may then
62 | | be assigned to any extra authentication guards you have defined.
63 | |
64 | | Supported: "database", "eloquent"
65 | |
66 | */
67 |
68 | 'providers' => [
69 | 'users' => [
70 | 'driver' => 'eloquent',
71 | 'model' => App\User::class,
72 | ],
73 |
74 | // 'users' => [
75 | // 'driver' => 'database',
76 | // 'table' => 'users',
77 | // ],
78 | ],
79 |
80 | /*
81 | |--------------------------------------------------------------------------
82 | | Resetting Passwords
83 | |--------------------------------------------------------------------------
84 | |
85 | | You may specify multiple password reset configurations if you have more
86 | | than one user table or model in the application and you want to have
87 | | separate password reset settings based on the specific user types.
88 | |
89 | | The expire time is the number of minutes that the reset token should be
90 | | considered valid. This security feature keeps tokens short-lived so
91 | | they have less time to be guessed. You may change this as needed.
92 | |
93 | */
94 |
95 | 'passwords' => [
96 | 'users' => [
97 | 'provider' => 'users',
98 | 'table' => 'password_resets',
99 | 'expire' => 60,
100 | ],
101 | ],
102 |
103 | ];
104 |
--------------------------------------------------------------------------------
/src/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'null'),
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_APP_KEY'),
36 | 'secret' => env('PUSHER_APP_SECRET'),
37 | 'app_id' => env('PUSHER_APP_ID'),
38 | 'options' => [
39 | 'cluster' => env('PUSHER_APP_CLUSTER'),
40 | 'encrypted' => true,
41 | ],
42 | ],
43 |
44 | 'redis' => [
45 | 'driver' => 'redis',
46 | 'connection' => 'default',
47 | ],
48 |
49 | 'log' => [
50 | 'driver' => 'log',
51 | ],
52 |
53 | 'null' => [
54 | 'driver' => 'null',
55 | ],
56 |
57 | ],
58 |
59 | ];
60 |
--------------------------------------------------------------------------------
/src/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | Cache Stores
26 | |--------------------------------------------------------------------------
27 | |
28 | | Here you may define all of the cache "stores" for your application as
29 | | well as their drivers. You may even define multiple stores for the
30 | | same cache driver to group types of items stored in your caches.
31 | |
32 | */
33 |
34 | 'stores' => [
35 |
36 | 'apc' => [
37 | 'driver' => 'apc',
38 | ],
39 |
40 | 'array' => [
41 | 'driver' => 'array',
42 | ],
43 |
44 | 'database' => [
45 | 'driver' => 'database',
46 | 'table' => 'cache',
47 | 'connection' => null,
48 | ],
49 |
50 | 'file' => [
51 | 'driver' => 'file',
52 | 'path' => storage_path('framework/cache/data'),
53 | ],
54 |
55 | 'memcached' => [
56 | 'driver' => 'memcached',
57 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
58 | 'sasl' => [
59 | env('MEMCACHED_USERNAME'),
60 | env('MEMCACHED_PASSWORD'),
61 | ],
62 | 'options' => [
63 | // Memcached::OPT_CONNECT_TIMEOUT => 2000,
64 | ],
65 | 'servers' => [
66 | [
67 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
68 | 'port' => env('MEMCACHED_PORT', 11211),
69 | 'weight' => 100,
70 | ],
71 | ],
72 | ],
73 |
74 | 'redis' => [
75 | 'driver' => 'redis',
76 | 'connection' => 'cache',
77 | ],
78 |
79 | 'dynamodb' => [
80 | 'driver' => 'dynamodb',
81 | 'key' => env('AWS_ACCESS_KEY_ID'),
82 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
83 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
84 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
85 | ],
86 |
87 | ],
88 |
89 | /*
90 | |--------------------------------------------------------------------------
91 | | Cache Key Prefix
92 | |--------------------------------------------------------------------------
93 | |
94 | | When utilizing a RAM based store such as APC or Memcached, there might
95 | | be other applications utilizing the same cache. So, we'll specify a
96 | | value to get prefixed to all our keys so we can avoid collisions.
97 | |
98 | */
99 |
100 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'),
101 |
102 | ];
103 |
--------------------------------------------------------------------------------
/src/config/database.php:
--------------------------------------------------------------------------------
1 | env('DB_CONNECTION', 'mysql'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Database Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here are each of the database connections setup for your application.
26 | | Of course, examples of configuring each database platform that is
27 | | supported by Laravel is shown below to make development simple.
28 | |
29 | |
30 | | All database work in Laravel is done through the PHP PDO facilities
31 | | so make sure you have the driver for your particular database of
32 | | choice installed on your machine before you begin development.
33 | |
34 | */
35 |
36 | 'connections' => [
37 |
38 | 'sqlite' => [
39 | 'driver' => 'sqlite',
40 | 'url' => env('DATABASE_URL'),
41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
42 | 'prefix' => '',
43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
44 | ],
45 |
46 | 'mysql' => [
47 | 'driver' => 'mysql',
48 | 'url' => env('DATABASE_URL'),
49 | 'host' => env('DB_HOST', '127.0.0.1'),
50 | 'port' => env('DB_PORT', '3306'),
51 | 'database' => env('DB_DATABASE', 'forge'),
52 | 'username' => env('DB_USERNAME', 'forge'),
53 | 'password' => env('DB_PASSWORD', ''),
54 | 'unix_socket' => env('DB_SOCKET', ''),
55 | 'charset' => 'utf8mb4',
56 | 'collation' => 'utf8mb4_unicode_ci',
57 | 'prefix' => '',
58 | 'prefix_indexes' => true,
59 | 'strict' => true,
60 | 'engine' => null,
61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([
62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
63 | ]) : [],
64 | ],
65 |
66 | 'pgsql' => [
67 | 'driver' => 'pgsql',
68 | 'url' => env('DATABASE_URL'),
69 | 'host' => env('DB_HOST', '127.0.0.1'),
70 | 'port' => env('DB_PORT', '5432'),
71 | 'database' => env('DB_DATABASE', 'forge'),
72 | 'username' => env('DB_USERNAME', 'forge'),
73 | 'password' => env('DB_PASSWORD', ''),
74 | 'charset' => 'utf8',
75 | 'prefix' => '',
76 | 'prefix_indexes' => true,
77 | 'schema' => 'public',
78 | 'sslmode' => 'prefer',
79 | ],
80 |
81 | 'sqlsrv' => [
82 | 'driver' => 'sqlsrv',
83 | 'url' => env('DATABASE_URL'),
84 | 'host' => env('DB_HOST', 'localhost'),
85 | 'port' => env('DB_PORT', '1433'),
86 | 'database' => env('DB_DATABASE', 'forge'),
87 | 'username' => env('DB_USERNAME', 'forge'),
88 | 'password' => env('DB_PASSWORD', ''),
89 | 'charset' => 'utf8',
90 | 'prefix' => '',
91 | 'prefix_indexes' => true,
92 | ],
93 |
94 | ],
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Migration Repository Table
99 | |--------------------------------------------------------------------------
100 | |
101 | | This table keeps track of all the migrations that have already run for
102 | | your application. Using this information, we can determine which of
103 | | the migrations on disk haven't actually been run in the database.
104 | |
105 | */
106 |
107 | 'migrations' => 'migrations',
108 |
109 | /*
110 | |--------------------------------------------------------------------------
111 | | Redis Databases
112 | |--------------------------------------------------------------------------
113 | |
114 | | Redis is an open source, fast, and advanced key-value store that also
115 | | provides a richer body of commands than a typical key-value system
116 | | such as APC or Memcached. Laravel makes it easy to dig right in.
117 | |
118 | */
119 |
120 | 'redis' => [
121 |
122 | 'client' => env('REDIS_CLIENT', 'predis'),
123 |
124 | 'options' => [
125 | 'cluster' => env('REDIS_CLUSTER', 'predis'),
126 | 'prefix' => Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_',
127 | ],
128 |
129 | 'default' => [
130 | 'host' => env('REDIS_HOST', '127.0.0.1'),
131 | 'password' => env('REDIS_PASSWORD', null),
132 | 'port' => env('REDIS_PORT', 6379),
133 | 'database' => env('REDIS_DB', 0),
134 | ],
135 |
136 | 'cache' => [
137 | 'host' => env('REDIS_HOST', '127.0.0.1'),
138 | 'password' => env('REDIS_PASSWORD', null),
139 | 'port' => env('REDIS_PORT', 6379),
140 | 'database' => env('REDIS_CACHE_DB', 1),
141 | ],
142 |
143 | ],
144 |
145 | ];
146 |
--------------------------------------------------------------------------------
/src/config/filesystems.php:
--------------------------------------------------------------------------------
1 | env('FILESYSTEM_DRIVER', 'local'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Default Cloud Filesystem Disk
21 | |--------------------------------------------------------------------------
22 | |
23 | | Many applications store files both locally and in the cloud. For this
24 | | reason, you may specify a default "cloud" driver here. This driver
25 | | will be bound as the Cloud disk implementation in the container.
26 | |
27 | */
28 |
29 | 'cloud' => env('FILESYSTEM_CLOUD', 's3'),
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Filesystem Disks
34 | |--------------------------------------------------------------------------
35 | |
36 | | Here you may configure as many filesystem "disks" as you wish, and you
37 | | may even configure multiple disks of the same driver. Defaults have
38 | | been setup for each driver as an example of the required options.
39 | |
40 | | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
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 | 'url' => env('APP_URL') . '/storage',
55 | 'visibility' => 'public',
56 | ],
57 |
58 | 's3' => [
59 | 'driver' => 's3',
60 | 'key' => env('AWS_ACCESS_KEY_ID'),
61 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
62 | 'region' => env('AWS_DEFAULT_REGION'),
63 | 'bucket' => env('AWS_BUCKET'),
64 | 'url' => env('AWS_URL'),
65 | ],
66 |
67 | ],
68 |
69 | ];
70 |
--------------------------------------------------------------------------------
/src/config/hashing.php:
--------------------------------------------------------------------------------
1 | 'bcrypt',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Bcrypt Options
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may specify the configuration options that should be used when
26 | | passwords are hashed using the Bcrypt algorithm. This will allow you
27 | | to control the amount of time it takes to hash the given password.
28 | |
29 | */
30 |
31 | 'bcrypt' => [
32 | 'rounds' => env('BCRYPT_ROUNDS', 10),
33 | ],
34 |
35 | /*
36 | |--------------------------------------------------------------------------
37 | | Argon Options
38 | |--------------------------------------------------------------------------
39 | |
40 | | Here you may specify the configuration options that should be used when
41 | | passwords are hashed using the Argon algorithm. These will allow you
42 | | to control the amount of time it takes to hash the given password.
43 | |
44 | */
45 |
46 | 'argon' => [
47 | 'memory' => 1024,
48 | 'threads' => 2,
49 | 'time' => 2,
50 | ],
51 |
52 | ];
53 |
--------------------------------------------------------------------------------
/src/config/logging.php:
--------------------------------------------------------------------------------
1 | env('LOG_CHANNEL', 'stack'),
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Log Channels
24 | |--------------------------------------------------------------------------
25 | |
26 | | Here you may configure the log channels for your application. Out of
27 | | the box, Laravel uses the Monolog PHP logging library. This gives
28 | | you a variety of powerful log handlers / formatters to utilize.
29 | |
30 | | Available Drivers: "single", "daily", "slack", "syslog",
31 | | "errorlog", "monolog",
32 | | "custom", "stack"
33 | |
34 | */
35 |
36 | 'channels' => [
37 | 'stack' => [
38 | 'driver' => 'stack',
39 | 'channels' => ['daily'],
40 | 'ignore_exceptions' => false,
41 | ],
42 |
43 | 'single' => [
44 | 'driver' => 'single',
45 | 'path' => storage_path('logs/laravel.log'),
46 | 'level' => 'debug',
47 | ],
48 |
49 | 'daily' => [
50 | 'driver' => 'daily',
51 | 'path' => storage_path('logs/laravel.log'),
52 | 'level' => 'debug',
53 | 'days' => 14,
54 | ],
55 |
56 | 'slack' => [
57 | 'driver' => 'slack',
58 | 'url' => env('LOG_SLACK_WEBHOOK_URL'),
59 | 'username' => 'Laravel Log',
60 | 'emoji' => ':boom:',
61 | 'level' => 'critical',
62 | ],
63 |
64 | 'papertrail' => [
65 | 'driver' => 'monolog',
66 | 'level' => 'debug',
67 | 'handler' => SyslogUdpHandler::class,
68 | 'handler_with' => [
69 | 'host' => env('PAPERTRAIL_URL'),
70 | 'port' => env('PAPERTRAIL_PORT'),
71 | ],
72 | ],
73 |
74 | 'stderr' => [
75 | 'driver' => 'monolog',
76 | 'handler' => StreamHandler::class,
77 | 'formatter' => env('LOG_STDERR_FORMATTER'),
78 | 'with' => [
79 | 'stream' => 'php://stderr',
80 | ],
81 | ],
82 |
83 | 'syslog' => [
84 | 'driver' => 'syslog',
85 | 'level' => 'debug',
86 | ],
87 |
88 | 'errorlog' => [
89 | 'driver' => 'errorlog',
90 | 'level' => 'debug',
91 | ],
92 | ],
93 |
94 | ];
95 |
--------------------------------------------------------------------------------
/src/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' => [
59 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
60 | 'name' => env('MAIL_FROM_NAME', 'Example'),
61 | ],
62 |
63 | /*
64 | |--------------------------------------------------------------------------
65 | | E-Mail Encryption Protocol
66 | |--------------------------------------------------------------------------
67 | |
68 | | Here you may specify the encryption protocol that should be used when
69 | | the application send e-mail messages. A sensible default using the
70 | | transport layer security protocol should provide great security.
71 | |
72 | */
73 |
74 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
75 |
76 | /*
77 | |--------------------------------------------------------------------------
78 | | SMTP Server Username
79 | |--------------------------------------------------------------------------
80 | |
81 | | If your SMTP server requires a username for authentication, you should
82 | | set it here. This will get used to authenticate with your server on
83 | | connection. You may also set the "password" value below this one.
84 | |
85 | */
86 |
87 | 'username' => env('MAIL_USERNAME'),
88 |
89 | 'password' => env('MAIL_PASSWORD'),
90 |
91 | /*
92 | |--------------------------------------------------------------------------
93 | | Sendmail System Path
94 | |--------------------------------------------------------------------------
95 | |
96 | | When using the "sendmail" driver to send e-mails, we will need to know
97 | | the path to where Sendmail lives on this server. A default path has
98 | | been provided here, which will work well on most of your systems.
99 | |
100 | */
101 |
102 | 'sendmail' => '/usr/sbin/sendmail -bs',
103 |
104 | /*
105 | |--------------------------------------------------------------------------
106 | | Markdown Mail Settings
107 | |--------------------------------------------------------------------------
108 | |
109 | | If you are using Markdown based email rendering, you may configure your
110 | | theme and component paths here, allowing you to customize the design
111 | | of the emails. Or, you may simply stick with the Laravel defaults!
112 | |
113 | */
114 |
115 | 'markdown' => [
116 | 'theme' => 'default',
117 |
118 | 'paths' => [
119 | resource_path('views/vendor/mail'),
120 | ],
121 | ],
122 |
123 | /*
124 | |--------------------------------------------------------------------------
125 | | Log Channel
126 | |--------------------------------------------------------------------------
127 | |
128 | | If you are using the "log" driver, you may specify the logging channel
129 | | if you prefer to keep mail messages separate from other log entries
130 | | for simpler reading. Otherwise, the default channel will be used.
131 | |
132 | */
133 |
134 | 'log_channel' => env('MAIL_LOG_CHANNEL'),
135 |
136 | ];
137 |
--------------------------------------------------------------------------------
/src/config/queue.php:
--------------------------------------------------------------------------------
1 | env('QUEUE_CONNECTION', 'sync'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Queue Connections
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure the connection information for each server that
24 | | is used by your application. A default configuration has been added
25 | | for each back-end shipped with Laravel. You are free to add more.
26 | |
27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
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 | 'block_for' => 0,
50 | ],
51 |
52 | 'sqs' => [
53 | 'driver' => 'sqs',
54 | 'key' => env('AWS_ACCESS_KEY_ID'),
55 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
56 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
57 | 'queue' => env('SQS_QUEUE', 'your-queue-name'),
58 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
59 | ],
60 |
61 | 'redis' => [
62 | 'driver' => 'redis',
63 | 'connection' => 'default',
64 | 'queue' => env('REDIS_QUEUE', 'default'),
65 | 'retry_after' => 90,
66 | 'block_for' => null,
67 | ],
68 |
69 | ],
70 |
71 | /*
72 | |--------------------------------------------------------------------------
73 | | Failed Queue Jobs
74 | |--------------------------------------------------------------------------
75 | |
76 | | These options configure the behavior of failed queue job logging so you
77 | | can control which database and table are used to store the jobs that
78 | | have failed. You may change them to any database / table you wish.
79 | |
80 | */
81 |
82 | 'failed' => [
83 | 'database' => env('DB_CONNECTION', 'mysql'),
84 | 'table' => 'failed_jobs',
85 | ],
86 |
87 | ];
88 |
--------------------------------------------------------------------------------
/src/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
21 | ],
22 |
23 | 'postmark' => [
24 | 'token' => env('POSTMARK_TOKEN'),
25 | ],
26 |
27 | 'ses' => [
28 | 'key' => env('AWS_ACCESS_KEY_ID'),
29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
31 | ],
32 |
33 | 'sparkpost' => [
34 | 'secret' => env('SPARKPOST_SECRET'),
35 | ],
36 |
37 | 'stripe' => [
38 | 'model' => App\User::class,
39 | 'key' => env('STRIPE_KEY'),
40 | 'secret' => env('STRIPE_SECRET'),
41 | 'webhook' => [
42 | 'secret' => env('STRIPE_WEBHOOK_SECRET'),
43 | 'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300),
44 | ],
45 | ],
46 |
47 | ];
48 |
--------------------------------------------------------------------------------
/src/config/session.php:
--------------------------------------------------------------------------------
1 | env('SESSION_DRIVER', 'file'),
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | Session Lifetime
26 | |--------------------------------------------------------------------------
27 | |
28 | | Here you may specify the number of minutes that you wish the session
29 | | to be allowed to remain idle before it expires. If you want them
30 | | to immediately expire on the browser closing, set that option.
31 | |
32 | */
33 |
34 | 'lifetime' => env('SESSION_LIFETIME', 120),
35 |
36 | 'expire_on_close' => false,
37 |
38 | /*
39 | |--------------------------------------------------------------------------
40 | | Session Encryption
41 | |--------------------------------------------------------------------------
42 | |
43 | | This option allows you to easily specify that all of your session data
44 | | should be encrypted before it is stored. All encryption will be run
45 | | automatically by Laravel and you can use the Session like normal.
46 | |
47 | */
48 |
49 | 'encrypt' => false,
50 |
51 | /*
52 | |--------------------------------------------------------------------------
53 | | Session File Location
54 | |--------------------------------------------------------------------------
55 | |
56 | | When using the native session driver, we need a location where session
57 | | files may be stored. A default has been set for you but a different
58 | | location may be specified. This is only needed for file sessions.
59 | |
60 | */
61 |
62 | 'files' => storage_path('framework/sessions'),
63 |
64 | /*
65 | |--------------------------------------------------------------------------
66 | | Session Database Connection
67 | |--------------------------------------------------------------------------
68 | |
69 | | When using the "database" or "redis" session drivers, you may specify a
70 | | connection that should be used to manage these sessions. This should
71 | | correspond to a connection in your database configuration options.
72 | |
73 | */
74 |
75 | 'connection' => env('SESSION_CONNECTION', null),
76 |
77 | /*
78 | |--------------------------------------------------------------------------
79 | | Session Database Table
80 | |--------------------------------------------------------------------------
81 | |
82 | | When using the "database" session driver, you may specify the table we
83 | | should use to manage the sessions. Of course, a sensible default is
84 | | provided for you; however, you are free to change this as needed.
85 | |
86 | */
87 |
88 | 'table' => 'sessions',
89 |
90 | /*
91 | |--------------------------------------------------------------------------
92 | | Session Cache Store
93 | |--------------------------------------------------------------------------
94 | |
95 | | When using the "apc", "memcached", or "dynamodb" session drivers you may
96 | | list a cache store that should be used for these sessions. This value
97 | | must match with one of the application's configured cache "stores".
98 | |
99 | */
100 |
101 | 'store' => env('SESSION_STORE', null),
102 |
103 | /*
104 | |--------------------------------------------------------------------------
105 | | Session Sweeping Lottery
106 | |--------------------------------------------------------------------------
107 | |
108 | | Some session drivers must manually sweep their storage location to get
109 | | rid of old sessions from storage. Here are the chances that it will
110 | | happen on a given request. By default, the odds are 2 out of 100.
111 | |
112 | */
113 |
114 | 'lottery' => [2, 100],
115 |
116 | /*
117 | |--------------------------------------------------------------------------
118 | | Session Cookie Name
119 | |--------------------------------------------------------------------------
120 | |
121 | | Here you may change the name of the cookie used to identify a session
122 | | instance by ID. The name specified here will get used every time a
123 | | new session cookie is created by the framework for every driver.
124 | |
125 | */
126 |
127 | 'cookie' => env(
128 | 'SESSION_COOKIE',
129 | Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
130 | ),
131 |
132 | /*
133 | |--------------------------------------------------------------------------
134 | | Session Cookie Path
135 | |--------------------------------------------------------------------------
136 | |
137 | | The session cookie path determines the path for which the cookie will
138 | | be regarded as available. Typically, this will be the root path of
139 | | your application but you are free to change this when necessary.
140 | |
141 | */
142 |
143 | 'path' => '/',
144 |
145 | /*
146 | |--------------------------------------------------------------------------
147 | | Session Cookie Domain
148 | |--------------------------------------------------------------------------
149 | |
150 | | Here you may change the domain of the cookie used to identify a session
151 | | in your application. This will determine which domains the cookie is
152 | | available to in your application. A sensible default has been set.
153 | |
154 | */
155 |
156 | 'domain' => env('SESSION_DOMAIN', null),
157 |
158 | /*
159 | |--------------------------------------------------------------------------
160 | | HTTPS Only Cookies
161 | |--------------------------------------------------------------------------
162 | |
163 | | By setting this option to true, session cookies will only be sent back
164 | | to the server if the browser has a HTTPS connection. This will keep
165 | | the cookie from being sent to you if it can not be done securely.
166 | |
167 | */
168 |
169 | 'secure' => env('SESSION_SECURE_COOKIE', false),
170 |
171 | /*
172 | |--------------------------------------------------------------------------
173 | | HTTP Access Only
174 | |--------------------------------------------------------------------------
175 | |
176 | | Setting this value to true will prevent JavaScript from accessing the
177 | | value of the cookie and the cookie will only be accessible through
178 | | the HTTP protocol. You are free to modify this option if needed.
179 | |
180 | */
181 |
182 | 'http_only' => true,
183 |
184 | /*
185 | |--------------------------------------------------------------------------
186 | | Same-Site Cookies
187 | |--------------------------------------------------------------------------
188 | |
189 | | This option determines how your cookies behave when cross-site requests
190 | | take place, and can be used to mitigate CSRF attacks. By default, we
191 | | do not enable this as other CSRF protection services are in place.
192 | |
193 | | Supported: "lax", "strict"
194 | |
195 | */
196 |
197 | 'same_site' => null,
198 |
199 | ];
200 |
--------------------------------------------------------------------------------
/src/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | resource_path('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' => env(
32 | 'VIEW_COMPILED_PATH',
33 | realpath(storage_path('framework/views'))
34 | ),
35 |
36 | ];
37 |
--------------------------------------------------------------------------------
/src/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite
2 | *.sqlite-journal
3 |
--------------------------------------------------------------------------------
/src/database/factories/UserFactory.php:
--------------------------------------------------------------------------------
1 | define(User::class, function (Faker $faker) {
21 | return [
22 | 'name' => $faker->name,
23 | 'email' => $faker->unique()->safeEmail,
24 | 'email_verified_at' => now(),
25 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
26 | 'remember_token' => Str::random(10),
27 | ];
28 | });
29 |
--------------------------------------------------------------------------------
/src/database/migrations/2014_10_12_000000_create_users_table.php:
--------------------------------------------------------------------------------
1 | bigIncrements('id');
18 | $table->string('name');
19 | $table->string('email')->unique();
20 | $table->timestamp('email_verified_at')->nullable();
21 | $table->string('password');
22 | $table->rememberToken();
23 | $table->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('users');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/database/migrations/2014_10_12_100000_create_password_resets_table.php:
--------------------------------------------------------------------------------
1 | string('email')->index();
18 | $table->string('token');
19 | $table->timestamp('created_at')->nullable();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('password_resets');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call(UsersTableSeeder::class);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "scripts": {
4 | "dev": "npm run development",
5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
6 | "watch": "npm run development -- --watch",
7 | "watch-poll": "npm run watch -- --watch-poll",
8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
9 | "prod": "npm run production",
10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
11 | },
12 | "devDependencies": {
13 | "axios": "^0.18",
14 | "bootstrap": "^4.1.0",
15 | "cross-env": "^5.1",
16 | "jquery": "^3.2",
17 | "laravel-mix": "^4.0.7",
18 | "lodash": "^4.17.5",
19 | "popper.js": "^1.12",
20 | "resolve-url-loader": "^2.3.1",
21 | "sass": "^1.15.2",
22 | "sass-loader": "^7.1.0",
23 | "vue": "^2.5.17"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/
2 | composer.lock
3 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "okashoi/myapp-create-inbox",
3 | "authors": [
4 | {
5 | "name": "Okada Shohei",
6 | "email": "okashoicircus0@gmail.com"
7 | }
8 | ],
9 | "require": {
10 | "php": "^7.3",
11 | "laravel/framework": "^6.0",
12 | "okashoi/myapp-task": "*@dev"
13 | },
14 | "require-dev": {
15 | "phpunit/phpunit": "^8.4"
16 | },
17 | "autoload": {
18 | "psr-4": {
19 | "MyApp\\Components\\CreateInbox\\": "./src"
20 | }
21 | },
22 | "autoload-dev": {
23 | "psr-4": {
24 | "MyApp\\Components\\CreateInbox\\Tests\\": "./tests"
25 | }
26 | },
27 | "extra": {
28 | "laravel": {
29 | "providers": [
30 | "MyApp\\Components\\CreateInbox\\ServiceProvider"
31 | ]
32 | }
33 | },
34 | "repositories": [
35 | {
36 | "type": "path",
37 | "url": "../../Entities/Task"
38 | }
39 | ]
40 | }
41 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests
14 |
15 |
16 |
17 |
18 | ./src
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/Eloquents/CompletedTask.php:
--------------------------------------------------------------------------------
1 | 'integer',
23 | ];
24 |
25 | /**
26 | * @return BelongsTo
27 | */
28 | public function task(): BelongsTo
29 | {
30 | return $this->belongsTo(Task::class);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/Eloquents/EstimatedTime.php:
--------------------------------------------------------------------------------
1 | 'integer',
33 | 'hours' => 'integer',
34 | 'minutes' => 'integer',
35 | ];
36 |
37 | /**
38 | * @return BelongsTo
39 | */
40 | public function task(): BelongsTo
41 | {
42 | return $this->belongsTo(Task::class);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/Eloquents/Task.php:
--------------------------------------------------------------------------------
1 | 'integer',
30 | 'name' => 'string',
31 | 'note' => 'string',
32 | ];
33 |
34 | /**
35 | * @return HasOne
36 | */
37 | public function estimatedTime(): HasOne
38 | {
39 | return $this->hasOne(EstimatedTime::class);
40 | }
41 |
42 | /**
43 | * @return HasOne
44 | */
45 | public function startDate(): HasOne
46 | {
47 | return $this->hasOne(TaskStartDate::class);
48 | }
49 |
50 | /**
51 | * @return HasOne
52 | */
53 | public function completed(): HasOne
54 | {
55 | return $this->hasOne(CompletedTask::class);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/Eloquents/TaskStartDate.php:
--------------------------------------------------------------------------------
1 | 'integer',
32 | 'start_date' => 'date',
33 | ];
34 |
35 | /**
36 | * The attributes that should be mutated to dates.
37 | *
38 | * @var array
39 | */
40 | protected $dates = [
41 | 'start_date',
42 | ];
43 |
44 | /**
45 | * @return BelongsTo
46 | */
47 | public function task(): BelongsTo
48 | {
49 | return $this->belongsTo(Task::class);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/EntityUnidentifiedException.php:
--------------------------------------------------------------------------------
1 | value = $value;
31 | }
32 |
33 | /**
34 | * @param Id $another
35 | * @return bool
36 | * @throws EntityUnidentifiedException ID が未確定のとき
37 | */
38 | public function equals(Id $another): bool
39 | {
40 | $this->ensureIdentified();
41 |
42 | if (!$another instanceof static) {
43 | return false;
44 | }
45 |
46 | return $this->value === $another->value();
47 | }
48 |
49 | /**
50 | * @throws EntityUnidentifiedException ID が未確定のとき
51 | */
52 | private function ensureIdentified(): void
53 | {
54 | if (is_null($this->value)) {
55 | throw new EntityUnidentifiedException();
56 | }
57 | }
58 |
59 | /**
60 | * @return int
61 | * @throws EntityUnidentifiedException ID が未確定のとき
62 | */
63 | public function value(): int
64 | {
65 | $this->ensureIdentified();
66 |
67 | return $this->value;
68 | }
69 |
70 | /**
71 | * @return string
72 | */
73 | public function __toString(): string
74 | {
75 | return (string)$this->value;
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/Repositories/AutoIncrementTaskIdProvider.php:
--------------------------------------------------------------------------------
1 | id();
32 | $idValue = $id->value();
33 | } catch (EntityUnidentifiedException $e) {
34 | $taskRecord = Eloquents\Task::create([
35 | 'name' => $task->name()->value(),
36 | 'note' => $task->note()->value(),
37 | ]);
38 |
39 | $task->resetId(new AutoIncrementTaskId($taskRecord->id));
40 |
41 | return;
42 | }
43 |
44 | /** @var Eloquents\Task|null $taskRecord */
45 | $taskRecord = Eloquents\Task::find($idValue);
46 | if (is_null($taskRecord)) {
47 | // TODO: 現象としては「Inbox から始まっていない」ことなので違う例外か
48 | throw new NotFoundException();
49 | }
50 |
51 | // TODO: 以下、 Open-Closed Principle に反しているので直したい
52 | if ((($task instanceof Inbox) && $task->hasEstimatedTime()) || $task instanceof Scheduled) {
53 | /** @var Inbox|Scheduled $task */
54 | $taskRecord->estimatedTime()->updateOrCreate([
55 | 'hours' => $task->estimatedTime()->hours(),
56 | 'minutes' => $task->estimatedTime()->minutes(),
57 | ]);
58 | }
59 |
60 | if ($task instanceof Scheduled) {
61 | /** @var Scheduled $task */
62 | $taskRecord->startDate()->updateOrCreate([
63 | 'start_date' => $task->startDate()->value(),
64 | ]);
65 | }
66 |
67 | if ($task instanceof Completed) {
68 | /** @var Completed $task */
69 | $taskRecord->completed()->updateOrCreate([]);
70 | }
71 | }
72 |
73 | /**
74 | * 与えられたタスク ID によって識別されるタスクを再構築する
75 | *
76 | * @param Id $id
77 | * @return Task
78 | * @throws InvalidArgumentException
79 | * @throws NotFoundException
80 | * @throws EntityUnidentifiedException
81 | */
82 | public function findById(Id $id): Task
83 | {
84 | if (!$id instanceof AutoIncrementTaskId) {
85 | throw new InvalidArgumentException('AutoIncrementTaskId を渡してください');
86 | }
87 | /** @var AutoIncrementTaskId $id */
88 | /** @var Eloquents\Task|null $taskRecord */
89 | $taskRecord = Eloquents\Task::find($id->value());
90 | if (is_null($taskRecord)) {
91 | throw new NotFoundException();
92 | }
93 |
94 | // TODO: 以下、 Open-Closed Principle に反しているので直したい
95 | if (is_null($taskRecord->startDate)) {
96 | $task = new Inbox($id, new Name($taskRecord->name));
97 |
98 | $task->updateNote(new Note($taskRecord->note ?? ''));
99 |
100 | if (!is_null($taskRecord->estimatedTime)) {
101 | $estimatedTime = new EstimatedTime($taskRecord->estimatedTime->hours, $taskRecord->estimatedTime->minutes);
102 | $task->setEstimatedTime($estimatedTime);
103 | }
104 |
105 | return $task;
106 | }
107 |
108 | if (is_null($taskRecord->completed)) {
109 | $name = new Name($taskRecord->name);
110 | $estimatedTime = new EstimatedTime($taskRecord->estimatedTime->hours, $taskRecord->estimatedTime->minutes);
111 | $startDate = new StartDate($taskRecord->startDate->start_date);
112 | $note = new Note($taskRecord->note ?? '');
113 |
114 | return new Scheduled($id, $name, $estimatedTime, $startDate, $note);
115 | }
116 |
117 | return new Completed($id, new Name($taskRecord->name), new Note($taskRecord->note ?? ''));
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/migrations/2019_06_24_000000_create_tasks_table.php:
--------------------------------------------------------------------------------
1 | bigIncrements('id')->unsigned();
18 | $table->string('name');
19 | $table->text('note');
20 | $table->timestamps();
21 | });
22 | }
23 |
24 | /**
25 | * Reverse the migrations.
26 | *
27 | * @return void
28 | */
29 | public function down()
30 | {
31 | Schema::dropIfExists('tasks');
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/migrations/2019_06_24_000001_create_estimated_times_table.php:
--------------------------------------------------------------------------------
1 | bigInteger('task_id')->primary()->unsigned();
18 | $table->tinyInteger('hours')->unsigned();
19 | $table->tinyInteger('minutes')->unsigned();
20 |
21 | $table->timestamps();
22 |
23 | $table->foreign('task_id')
24 | ->references('id')
25 | ->on('tasks')
26 | ->onUpdate('cascade')
27 | ->onDelete('cascade');
28 | });
29 | }
30 |
31 | /**
32 | * Reverse the migrations.
33 | *
34 | * @return void
35 | */
36 | public function down()
37 | {
38 | Schema::dropIfExists('estimated_times');
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/migrations/2019_06_24_000002_create_task_start_dates_table.php:
--------------------------------------------------------------------------------
1 | bigInteger('task_id')->primary()->unsigned();
18 | $table->date('start_date');
19 | $table->timestamps();
20 |
21 | $table->foreign('task_id')
22 | ->references('task_id')
23 | ->on('estimated_times')
24 | ->onUpdate('cascade')
25 | ->onDelete('cascade');
26 | });
27 | }
28 |
29 | /**
30 | * Reverse the migrations.
31 | *
32 | * @return void
33 | */
34 | public function down()
35 | {
36 | Schema::dropIfExists('task_start_dates');
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/DataAccess/Database/migrations/2019_06_24_000003_create_completed_tasks_table.php:
--------------------------------------------------------------------------------
1 | bigInteger('task_id')->primary()->unsigned();
18 | $table->timestamps();
19 |
20 | $table->foreign('task_id')
21 | ->references('task_id')
22 | ->on('task_start_dates')
23 | ->onUpdate('cascade')
24 | ->onDelete('cascade');
25 | });
26 | }
27 |
28 | /**
29 | * Reverse the migrations.
30 | *
31 | * @return void
32 | */
33 | public function down()
34 | {
35 | Schema::dropIfExists('completed_tasks');
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/ServiceProvider.php:
--------------------------------------------------------------------------------
1 | app->bind(InputBoundary::class, Interactor::class);
25 | $this->app->bind(NormalOutputBoundary::class, NormalPresenter::class);
26 | }
27 |
28 | /**
29 | * Bootstrap any application services.
30 | *
31 | * @return void
32 | */
33 | public function boot()
34 | {
35 | $this->loadMigrationsFrom(__DIR__ . '/DataAccess/Database/migrations');
36 | $this->loadRoutesFrom(__DIR__ . '/UserInterface/Web/routes/web.php');
37 | $this->loadViewsFrom(__DIR__ . '/UserInterface/Web/views', 'web');
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/UseCase/Exception.php:
--------------------------------------------------------------------------------
1 | name = trim($name);
29 | $this->note = trim($note);
30 | }
31 |
32 | /**
33 | * @return string
34 | */
35 | public function name(): string
36 | {
37 | return $this->name;
38 | }
39 |
40 | /**
41 | * @return string
42 | */
43 | public function note(): string
44 | {
45 | return $this->note;
46 | }
47 |
48 | /**
49 | * @return bool
50 | */
51 | public function hasNote(): bool
52 | {
53 | return $this->note !== '';
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/UseCase/Interactor.php:
--------------------------------------------------------------------------------
1 | idProvider = $idProvider;
37 | $this->taskRepository = $taskRepository;
38 | $this->normalOutputBoundary = $normalOutputBoundary;
39 | }
40 |
41 | /**
42 | * @param InputData $input
43 | */
44 | public function __invoke(InputData $input): void
45 | {
46 | $inbox = $this->produceEntity($input);
47 |
48 | $this->taskRepository->save($inbox);
49 |
50 | $normalOutput = $this->produceNormalOutputData($inbox);
51 |
52 | ($this->normalOutputBoundary)($normalOutput);
53 | }
54 |
55 | /**
56 | * @param InputData $input
57 | * @return Task
58 | */
59 | private function produceEntity(InputData $input): Task
60 | {
61 | $inbox = new Inbox(
62 | $this->idProvider->provide(),
63 | new Name($input->name())
64 | );
65 |
66 | if ($input->hasNote()) {
67 | $note = new Note($input->note());
68 | $inbox->updateNote($note);
69 | }
70 |
71 | return $inbox;
72 | }
73 |
74 | /**
75 | * @param Task $inbox
76 | * @return NormalOutputData
77 | */
78 | private function produceNormalOutputData(Task $inbox): NormalOutputData
79 | {
80 | return new NormalOutputData(
81 | (string)($inbox->id()),
82 | $inbox->name()->value(),
83 | $inbox->note()->value()
84 | );
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/UseCase/NormalOutputBoundary.php:
--------------------------------------------------------------------------------
1 | taskId = $taskId;
35 | $this->taskName = $taskName;
36 | $this->taskNote = $taskNote;
37 | }
38 |
39 | /**
40 | * @return string
41 | */
42 | public function taskId(): string
43 | {
44 | return $this->taskId;
45 | }
46 |
47 | /**
48 | * @return string
49 | */
50 | public function taskName(): string
51 | {
52 | return $this->taskName;
53 | }
54 |
55 | /**
56 | * @return string
57 | */
58 | public function taskNote(): string
59 | {
60 | return $this->taskNote;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/UseCase/NotFoundException.php:
--------------------------------------------------------------------------------
1 | validate($request, [
26 | 'name' => 'required|string|max:255',
27 | 'note' => 'string|nullable',
28 | ]);
29 |
30 | $input = new InputData($validated['name'], $validated['note'] ?? '');
31 |
32 | $interactor($input);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/UserInterface/Web/NormalPresenter.php:
--------------------------------------------------------------------------------
1 | view = $view;
30 | }
31 |
32 | /**
33 | * @param NormalOutputData $output
34 | */
35 | public function __invoke(NormalOutputData $output): void
36 | {
37 | $viewModel = new ViewModel(
38 | $output->taskId(),
39 | $output->taskName(),
40 | $output->taskNote(),
41 | );
42 |
43 | $this->respond($this->view->make('web::tasks.create', compact(['viewModel'])));
44 | }
45 |
46 | /**
47 | * @param mixed $response
48 | */
49 | public function respond($response): void
50 | {
51 | if (!$response instanceof Response && !$response instanceof JsonResponse) {
52 | $response = new Response($response);
53 | }
54 |
55 | app()->instance('response', $response);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/UserInterface/Web/ViewModel.php:
--------------------------------------------------------------------------------
1 | taskId = $taskId;
35 | $this->taskName = $taskName;
36 | $this->taskNote = $taskNote;
37 | }
38 |
39 | /**
40 | * @return string
41 | */
42 | public function taskId(): string
43 | {
44 | return $this->taskId;
45 | }
46 |
47 | /**
48 | * @return string
49 | */
50 | public function taskName(): string
51 | {
52 | return $this->taskName;
53 | }
54 |
55 | /**
56 | * @return string
57 | */
58 | public function taskNote(): string
59 | {
60 | return $this->taskNote;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/src/UserInterface/Web/routes/web.php:
--------------------------------------------------------------------------------
1 | 以下のタスクが作成されました。
2 |
3 | タスクID
4 | {{ $viewModel->taskId() }}
5 | タスク名
6 | {{ $viewModel->taskName() }}
7 | メモ
8 | {{ $viewModel->taskNote() }}
9 |
10 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/tests/DataAccess/Database/Repositories/AutopIncrementTaskIdProviderTest.php:
--------------------------------------------------------------------------------
1 | provide();
23 | $this->assertSame('', (string)$providedId);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/tests/DataAccess/Database/Repositories/AutopIncrementTaskIdTest.php:
--------------------------------------------------------------------------------
1 | expectException(InvalidArgumentException::class);
32 |
33 | new AutoIncrementTaskId(0);
34 | }
35 |
36 | /**
37 | * @test
38 | */
39 | public function コンスタラクタ引数に負の整数を渡すとInvalidArgumentExceptionを送出すること()
40 | {
41 | $this->expectException(InvalidArgumentException::class);
42 |
43 | new AutoIncrementTaskId(-1);
44 | }
45 |
46 | /**
47 | * @test
48 | */
49 | public function testEquals()
50 | {
51 | $one = new AutoIncrementTaskId(1);
52 | $another = new AutoIncrementTaskId(1);
53 |
54 | $this->assertTrue($one->equals($another));
55 |
56 | $one = new AutoIncrementTaskId(1);
57 | $another = new AutoIncrementTaskId(2);
58 |
59 | $this->assertFalse($one->equals($another));
60 | }
61 |
62 | public function ID未設定の状態で値にアクセスしようとするとEntityUnidentifiedExceptionを送出すること()
63 | {
64 | $this->expectException(EntityUnidentifiedException::class);
65 |
66 | $id = new AutoIncrementTaskId(null);
67 | $id->value();
68 | }
69 |
70 | /**
71 | * @test
72 | */
73 | public function ID未設定の状態で比較しようとするとEntityUnidentifiedExceptionを送出すること()
74 | {
75 | $this->expectException(EntityUnidentifiedException::class);
76 |
77 | $one = new AutoIncrementTaskId(null);
78 | $another = new AutoIncrementTaskId(1);
79 |
80 | $one->equals($another);
81 | }
82 |
83 | /**
84 | * @test
85 | */
86 | public function testToString()
87 | {
88 | $id = new AutoIncrementTaskId(1);
89 | $this->assertSame('1', (string)$id);
90 |
91 | $id = new AutoIncrementTaskId(null);
92 | $this->assertSame('', (string)$id);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/tests/UseCases/InMemoryId.php:
--------------------------------------------------------------------------------
1 | value = $value;
25 | }
26 |
27 | /**
28 | * @return int
29 | */
30 | public function value(): int
31 | {
32 | return $this->value;
33 | }
34 |
35 | /**
36 | * @param Id $another
37 | * @return bool
38 | */
39 | public function equals(Id $another): bool
40 | {
41 | if (!$another instanceof static) {
42 | return false;
43 | }
44 |
45 | return $this->value === $another->value();
46 | }
47 |
48 | /**
49 | * @return string
50 | */
51 | public function __toString(): string
52 | {
53 | return (string)$this->value;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/tests/UseCases/InMemoryIdProvider.php:
--------------------------------------------------------------------------------
1 | nextId = 1;
26 | }
27 |
28 | /**
29 | * タスク ID を提供する
30 | * @return Id
31 | */
32 | public function provide(): Id
33 | {
34 | return new InMemoryId($this->nextId++);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/tests/UseCases/InMemoryTaskRepository.php:
--------------------------------------------------------------------------------
1 | tasks = [];
25 | }
26 |
27 | /**
28 | * @param Task $task
29 | */
30 | public function save(Task $task): void
31 | {
32 | $this->tasks[(string)$task->id()] = $task;
33 | }
34 |
35 | /**
36 | * @param Id $id
37 | * @return Task
38 | * @throws NotFoundException
39 | */
40 | public function findById(Id $id): Task
41 | {
42 | if (!isset($this->tasks[(string)$id])) {
43 | throw new NotFoundException();
44 | }
45 |
46 | return $this->tasks[(string)$id];
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/tests/UseCases/InputDataTest.php:
--------------------------------------------------------------------------------
1 | assertSame('test', $input->name());
21 |
22 | $input = new InputData("\ttest", 'this is note');
23 | $this->assertSame('test', $input->name());
24 | }
25 |
26 | /**
27 | * @test
28 | */
29 | public function 「タスク名」の末尾の空白文字は取り除かれること()
30 | {
31 | $input = new InputData('test ', 'this is note');
32 | $this->assertSame('test', $input->name());
33 |
34 | $input = new InputData("test\t", 'this is note');
35 | $this->assertSame('test', $input->name());
36 | }
37 |
38 | /**
39 | * @test
40 | */
41 | public function 「メモ」の先頭の空白文字は取り除かれること()
42 | {
43 | $input = new InputData('test', ' this is note');
44 | $this->assertSame('this is note', $input->note());
45 |
46 | $input = new InputData('test', "\tthis is note");
47 | $this->assertSame('this is note', $input->note());
48 | }
49 |
50 | /**
51 | * @test
52 | */
53 | public function 「メモ」の末尾の空白文字は取り除かれること()
54 | {
55 | $input = new InputData('test', 'this is note ');
56 | $this->assertSame('this is note', $input->note());
57 |
58 | $input = new InputData('test', "this is note\t");
59 | $this->assertSame('this is note', $input->note());
60 | }
61 |
62 | /**
63 | * @test
64 | */
65 | public function testHasNote()
66 | {
67 | $inputWithNote = new InputData('test', 'this is note');
68 | $this->assertTrue($inputWithNote->hasNote());
69 |
70 | $inputWithoutNote = new InputData('test', '');
71 | $this->assertFalse($inputWithoutNote->hasNote());
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/packages/Components/CreateInbox/tests/UseCases/InteractorTest.php:
--------------------------------------------------------------------------------
1 | shouldReceive('__invoke');
25 |
26 | $input = new InputData('test', 'this is note');
27 |
28 | (new Interactor($idProvider, $taskRepository, $normalOutputBoundary))($input);
29 |
30 | $inbox = $taskRepository->findById(new InMemoryId(1));
31 |
32 | $this->assertSame('test', $inbox->name()->value());
33 | $this->assertSame('this is note', $inbox->note()->value());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/
2 | composer.lock
3 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "okashoi/myapp-task",
3 | "authors": [
4 | {
5 | "name": "Okada Shohei",
6 | "email": "okashoicircus0@gmail.com"
7 | }
8 | ],
9 | "require": {
10 | "php": "^7.3",
11 | "mockery/mockery": "^1.2"
12 | },
13 | "require-dev": {
14 | "phpunit/phpunit": "^8.4"
15 | },
16 | "autoload": {
17 | "psr-4": {
18 | "MyApp\\Entities\\Task\\": "./src"
19 | }
20 | },
21 | "autoload-dev": {
22 | "psr-4": {
23 | "MyApp\\Entities\\Task\\Tests\\": "./tests"
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests
14 |
15 |
16 |
17 |
18 | ./src
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/readme.md:
--------------------------------------------------------------------------------
1 | # タスク
2 |
3 | ## ビジネスロジック
4 |
5 | * 「タスク」は必ず「タスクID」「タスク名」を持つ
6 | * 「タスク」は任意で「メモ」を持てる
7 | * 「タスク」は作成されたとき「Inbox」から始まる
8 | * 「Inbox」は「見積もり時間」と「着手日」を設定すると「Scheduled」になる
9 | * 「Inbox」に対して「着手日」が未設定のままでも、「見積もり時間」を設定できる
10 | * 「Inbox」に対して「見積もり時間」が未設定のまま、「着手日」を設定できない
11 | * 「着手日」に過去の日付を **能動的に** 設定できない
12 | * 「Scheduled」は「Inbox」に戻らない
13 | * 「Scheduled」は「完了」できる
14 | * (「Inbox」や「Scheduled」を分割して複数の「Inbox」にできる)
15 | * 「Inbox」を「連絡待ち」にできる
16 | * (「Scheduled」を「完了」したとき、「連絡待ち」を作成できる)
17 |
18 | ## 用語集
19 |
20 | ### タスク (task)
21 |
22 | * ユーザが認識する「やらなければいけないこと」
23 |
24 | ### タスクID (task ID)
25 |
26 | * タスクを一意に認識するための識別子
27 | * 数値の連番
28 |
29 | ### タスク名 (task name)
30 |
31 | * ユーザがタスクを認識するためのラベル
32 |
33 | ### メモ (task note)
34 |
35 | * ユーザが書く、タスクについての付加情報
36 | * プレーンテキスト形式
37 |
38 | ### Inbox (inbox)
39 |
40 | * 「見積もり時間」や「着手日」が設定されていないタスク
41 | * ユーザが思いついた直後の状態
42 |
43 | ### 見積もり時間 (estimated time)
44 |
45 | * ユーザが見積もった、そのタスクを完了させるのに必要な時間
46 |
47 | ### 着手日 (start date)
48 |
49 | * そのタスクを行う予定の日付
50 |
51 | ### Scheduled (scheduled)
52 |
53 | * 「見積もり時間」や「着手日」が確定したタスク
54 |
55 | ### 完了する (complete)
56 |
57 | * タスクを行い、それについて考える必要がなくなったときにタスクは「完了される」
58 |
59 | ### 完了済み (completed)
60 |
61 | * 「完了され」たタスク
62 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/src/Completed.php:
--------------------------------------------------------------------------------
1 | updateNote($note);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/src/EstimatedTime.php:
--------------------------------------------------------------------------------
1 | hours = $hours;
43 | $this->minutes = $minutes;
44 | }
45 |
46 | /**
47 | * @return int
48 | */
49 | public function hours(): int
50 | {
51 | return $this->hours;
52 | }
53 |
54 | /**
55 | * @return int
56 | */
57 | public function minutes(): int
58 | {
59 | return $this->minutes;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/src/EstimatedTimeNotSet.php:
--------------------------------------------------------------------------------
1 | estimatedTime = $estimatedTime;
26 | }
27 |
28 | /**
29 | * 見積もり時間が設定されているかどうかを返す
30 | *
31 | * @return bool 見積もり時間が設定されている場合 true / そうでない場合は false
32 | */
33 | public function hasEstimatedTime(): bool
34 | {
35 | return !is_null($this->estimatedTime);
36 | }
37 |
38 | /**
39 | * @return EstimatedTime
40 | * @throws EstimatedTimeNotSet 見積もり時間が設定されていない場合
41 | */
42 | public function estimatedTime(): EstimatedTime
43 | {
44 | if (!$this->hasEstimatedTime()) {
45 | throw new EstimatedTimeNotSet();
46 | }
47 |
48 | return $this->estimatedTime;
49 | }
50 |
51 | /**
52 | * 着手日を設定して Scheduled に変換する
53 | *
54 | * @param StartDate $startDate
55 | * @return Scheduled
56 | * @throws EstimatedTimeNotSet 見積もり時間が設定されていない場合
57 | * @throws InvalidArgumentException
58 | */
59 | public function convertToScheduled(StartDate $startDate): Scheduled
60 | {
61 | if (!$this->hasEstimatedTime()) {
62 | throw new EstimatedTimeNotSet();
63 | }
64 |
65 | if ($startDate->value() < new DatetimeImmutable('today')) {
66 | throw new InvalidArgumentException('着手日は今日以降の日付を指定してください');
67 | }
68 |
69 | return new Scheduled($this->id, $this->name, $this->estimatedTime, $startDate, $this->note);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/src/InvalidArgumentException.php:
--------------------------------------------------------------------------------
1 | value = $value;
23 | }
24 |
25 | /**
26 | * @return string
27 | */
28 | public function value(): string
29 | {
30 | return $this->value;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/src/Note.php:
--------------------------------------------------------------------------------
1 | value = $value;
23 | }
24 |
25 | /**
26 | * @return string
27 | */
28 | public function value(): string
29 | {
30 | return $this->value;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/src/Scheduled.php:
--------------------------------------------------------------------------------
1 | estimatedTime = $estimatedTime;
31 | $this->startDate = $startDate;
32 | $this->note = $note;
33 | }
34 |
35 | /**
36 | * タスクを完了する
37 | *
38 | * @return Completed
39 | */
40 | public function convertToCompleted(): Completed
41 | {
42 | return new Completed($this->id, $this->name, $this->note);
43 | }
44 |
45 | /**
46 | * @return EstimatedTime
47 | */
48 | public function estimatedTime(): EstimatedTime
49 | {
50 | return $this->estimatedTime;
51 | }
52 |
53 | /**
54 | * @return StartDate
55 | */
56 | public function startDate(): StartDate
57 | {
58 | return $this->startDate;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/src/StartDate.php:
--------------------------------------------------------------------------------
1 | value = $value;
28 | }
29 |
30 | /**
31 | * @return DateTimeImmutable
32 | * @throws Exception
33 | */
34 | public function value(): DateTimeImmutable
35 | {
36 | if ($this->value instanceof DateTimeImmutable) {
37 | return $this->value;
38 | }
39 |
40 | if ($this->value instanceof DateTime) {
41 | return DateTimeImmutable::createFromMutable($this->value);
42 | }
43 |
44 | $dateTimeImmutable = new DateTimeImmutable(null, $this->value->getTimezone());
45 | return $dateTimeImmutable->setTimestamp($this->value->getTimestamp());
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/src/Task.php:
--------------------------------------------------------------------------------
1 | id = $id;
33 | $this->name = $name;
34 | $this->note = new Note('');
35 | }
36 |
37 | /**
38 | * タスクID を再設定する
39 | *
40 | * @param Id $id
41 | */
42 | final public function resetId(Id $id): void
43 | {
44 | $this->id = $id;
45 | }
46 |
47 | /**
48 | * タスク名を変更する
49 | *
50 | * @param Name $name
51 | */
52 | final public function changeName(Name $name): void
53 | {
54 | $this->name = $name;
55 | }
56 |
57 | /**
58 | * メモを更新する
59 | *
60 | * @param Note $note
61 | */
62 | final public function updateNote(Note $note): void
63 | {
64 | $this->note = $note;
65 | }
66 |
67 | /**
68 | * @return Id
69 | */
70 | final public function id(): Id
71 | {
72 | return $this->id;
73 | }
74 |
75 | /**
76 | * @return Name
77 | */
78 | final public function name(): Name
79 | {
80 | return $this->name;
81 | }
82 |
83 | /**
84 | * @return Note
85 | */
86 | final public function note(): Note
87 | {
88 | return $this->note;
89 | }
90 |
91 | /**
92 | * タスクエンティティの同一性を判定
93 | * @param self $another
94 | * @return bool
95 | */
96 | final public function isIdenticalTo(self $another): bool
97 | {
98 | return $this->id->equals($another->id());
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/tests/InboxTest.php:
--------------------------------------------------------------------------------
1 | setEstimatedTime($estimatedTime);
27 |
28 | $startDate = new StartDate(new DateTimeImmutable('tomorrow'));
29 |
30 | $scheduled = $inbox->convertToScheduled($startDate);
31 |
32 | $this->assertTrue($scheduled instanceof Scheduled);
33 | }
34 |
35 | /**
36 | * @test
37 | * @doesNotPerformAssertions
38 | */
39 | public function 「Inbox」に対して「着手日」が未設定のままでも「見積もり時間」を設定できること()
40 | {
41 | $id = Mockery::mock(Id::class);
42 | $name = new Name('test');
43 | $inbox = new Inbox($id, $name);
44 |
45 | $estimatedTime = new EstimatedTime(1, 0);
46 | $inbox->setEstimatedTime($estimatedTime);
47 | }
48 |
49 | /**
50 | * @test
51 | * @expectedException \MyApp\Components\Tasks\Entities\EstimatedTimeNotSet
52 | */
53 | public function 「Inbox」に対して「見積もり時間」が未設定のまま「着手日」を設定できないこと()
54 | {
55 | $id = Mockery::mock(Id::class);
56 | $name = new Name('test');
57 | $inbox = new Inbox($id, $name);
58 |
59 | $startDate = new StartDate(new DateTimeImmutable('tomorrow'));
60 |
61 | $inbox->convertToScheduled($startDate);
62 | }
63 |
64 | /**
65 | * @test
66 | * @expectedException \MyApp\Components\Tasks\Entities\InvalidArgumentException
67 | */
68 | public function 「着手日」に過去の日付を能動的に設定できないこと()
69 | {
70 | $id = Mockery::mock(Id::class);
71 | $name = new Name('test');
72 | $inbox = new Inbox($id, $name);
73 |
74 | $estimatedTime = new EstimatedTime(1, 0);
75 | $inbox->setEstimatedTime($estimatedTime);
76 |
77 | $startDate = new StartDate(new DateTimeImmutable('yesterday'));
78 |
79 | $inbox->convertToScheduled($startDate);
80 | }
81 |
82 | /**
83 | * @test
84 | */
85 | public function testHasEstimatedTime()
86 | {
87 | $id = Mockery::mock(Id::class);
88 | $name = new Name('test');
89 | $inbox = new Inbox($id, $name);
90 |
91 | $this->assertFalse($inbox->hasEstimatedTime());
92 |
93 | $estimatedTime = new EstimatedTime(1, 0);
94 | $inbox->setEstimatedTime($estimatedTime);
95 |
96 | $this->assertTrue($inbox->hasEstimatedTime());
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/tests/ScheduledTest.php:
--------------------------------------------------------------------------------
1 | convertToCompleted();
29 | $this->assertTrue($completed instanceof Completed);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/packages/Entities/Task/tests/TaskTest.php:
--------------------------------------------------------------------------------
1 | updateNote($note);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/
2 | composer.lock
3 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "okashoi/myapp-waiting",
3 | "authors": [
4 | {
5 | "name": "Okada Shohei",
6 | "email": "okashoicircus0@gmail.com"
7 | }
8 | ],
9 | "require": {
10 | "php": "^7.3"
11 | },
12 | "require-dev": {
13 | "phpunit/phpunit": "^8.4"
14 | },
15 | "autoload": {
16 | "psr-4": {
17 | "MyApp\\Entities\\Waiting\\": "./src"
18 | }
19 | },
20 | "autoload-dev": {
21 | "psr-4": {
22 | "MyApp\\Entities\\Waiting\\Tests\\": "./tests"
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests
14 |
15 |
16 |
17 |
18 | ./src
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/readme.md:
--------------------------------------------------------------------------------
1 | # 連絡待ち
2 |
3 | ## ビジネスロジック
4 |
5 | * 「連絡待ち」は必ず「連絡待ちID」「連絡ち待ち名」を持つ
6 | * 「連絡待ち」は任意で「メモ」を持てる
7 | * 「連絡待ち」は「完了」できる
8 |
9 | ## 用語集
10 |
11 | ### 連絡待ち (waiting)
12 |
13 | * ユーザが認識する「他者からの連絡を待っている状態のもの」
14 |
15 | ### 連絡待ちID (waiting ID)
16 |
17 | * 連絡待ちを一意に認識するための識別子
18 |
19 | ### 連絡ち待ち名 (waiting name)
20 |
21 | * ユーザが連絡待ちを認識するためのラベル
22 |
23 | ### メモ (waiting note)
24 |
25 | * ユーザが書く、連絡待ちについての付加情報
26 | * プレーンテキスト形式
27 |
28 | ### 完了 (complete)
29 |
30 | * タスクを行い、それについて考える必要がなくなった状態
31 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/src/Completed.php:
--------------------------------------------------------------------------------
1 | id = $id;
35 | $this->name = $name;
36 | $this->note = $note;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/src/Exception.php:
--------------------------------------------------------------------------------
1 | value = $value;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/src/InvalidArgumentException.php:
--------------------------------------------------------------------------------
1 | value = $value;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/src/Note.php:
--------------------------------------------------------------------------------
1 | value = $value;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/src/Waiting.php:
--------------------------------------------------------------------------------
1 | id = $id;
33 | $this->name = $name;
34 | $this->note = new Note('');
35 | }
36 |
37 | /**
38 | * メモを更新する
39 | *
40 | * @param Note $note
41 | */
42 | final public function updateNote(Note $note): void
43 | {
44 | $this->note = $note;
45 | }
46 |
47 | /**
48 | * 連絡待ちを完了する
49 | * @return Completed
50 | */
51 | public function convertToCompleted(): Completed
52 | {
53 | return new Completed($this->id, $this->name, $this->note);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/packages/Entities/Waiting/tests/Entities/WaitingTest.php:
--------------------------------------------------------------------------------
1 | updateNote($note);
42 | }
43 |
44 | /**
45 | * @test
46 | */
47 | public function 「連絡待ち」は「完了」できる()
48 | {
49 | $id = new Id(1);
50 | $name = new Name('test');
51 | $waiting = new Waiting($id, $name);
52 |
53 | $completed = $waiting->convertToCompleted();
54 | $this->assertTrue($completed instanceof Completed);
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests/Unit
14 |
15 |
16 |
17 | ./tests/Feature
18 |
19 |
20 |
21 | ./packages/Entities/tests
22 |
23 |
24 |
25 | ./packages/Components
26 |
27 |
28 |
29 |
30 | ./app
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 |
3 | Options -MultiViews -Indexes
4 |
5 |
6 | RewriteEngine On
7 |
8 | # Handle Authorization Header
9 | RewriteCond %{HTTP:Authorization} .
10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
11 |
12 | # Redirect Trailing Slashes If Not A Folder...
13 | RewriteCond %{REQUEST_FILENAME} !-d
14 | RewriteCond %{REQUEST_URI} (.+)/$
15 | RewriteRule ^ %1 [L,R=301]
16 |
17 | # Handle Front Controller...
18 | RewriteCond %{REQUEST_FILENAME} !-d
19 | RewriteCond %{REQUEST_FILENAME} !-f
20 | RewriteRule ^ index.php [L]
21 |
22 |
--------------------------------------------------------------------------------
/src/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/okashoi/laravel-clean-architecture/b7e98870a66c54c9624ca584f0eac8785caa2cba/src/public/favicon.ico
--------------------------------------------------------------------------------
/src/public/index.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | define('LARAVEL_START', microtime(true));
11 |
12 | /*
13 | |--------------------------------------------------------------------------
14 | | Register The Auto Loader
15 | |--------------------------------------------------------------------------
16 | |
17 | | Composer provides a convenient, automatically generated class loader for
18 | | our application. We just need to utilize it! We'll simply require it
19 | | into the script here so that we don't have to worry about manual
20 | | loading any of our classes later on. It feels great to relax.
21 | |
22 | */
23 |
24 | require __DIR__ . '/../vendor/autoload.php';
25 |
26 | /*
27 | |--------------------------------------------------------------------------
28 | | Turn On The Lights
29 | |--------------------------------------------------------------------------
30 | |
31 | | We need to illuminate PHP development, so let us turn on the lights.
32 | | This bootstraps the framework and gets it ready for use, then it
33 | | will load up this application so that we can run it and send
34 | | the responses back to the browser and delight our users.
35 | |
36 | */
37 |
38 | $app = require_once __DIR__ . '/../bootstrap/app.php';
39 |
40 | /*
41 | |--------------------------------------------------------------------------
42 | | Run The Application
43 | |--------------------------------------------------------------------------
44 | |
45 | | Once we have the application, we can handle the incoming request
46 | | through the kernel, and send the associated response back to
47 | | the client's browser allowing them to enjoy the creative
48 | | and wonderful application we have prepared for them.
49 | |
50 | */
51 |
52 | $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);
53 |
54 | $response = $kernel->handle(
55 | $request = Illuminate\Http\Request::capture()
56 | );
57 |
58 | $response->send();
59 |
60 | $kernel->terminate($request, $response);
61 |
--------------------------------------------------------------------------------
/src/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/src/public/web.config:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 | ## About Laravel
11 |
12 | Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
13 |
14 | - [Simple, fast routing engine](https://laravel.com/docs/routing).
15 | - [Powerful dependency injection container](https://laravel.com/docs/container).
16 | - Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
17 | - Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
18 | - Database agnostic [schema migrations](https://laravel.com/docs/migrations).
19 | - [Robust background job processing](https://laravel.com/docs/queues).
20 | - [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
21 |
22 | Laravel is accessible, powerful, and provides tools required for large, robust applications.
23 |
24 | ## Learning Laravel
25 |
26 | Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
27 |
28 | If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 1400 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
29 |
30 | ## Laravel Sponsors
31 |
32 | We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
33 |
34 | - **[Vehikl](https://vehikl.com/)**
35 | - **[Tighten Co.](https://tighten.co)**
36 | - **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
37 | - **[64 Robots](https://64robots.com)**
38 | - **[Cubet Techno Labs](https://cubettech.com)**
39 | - **[Cyber-Duck](https://cyber-duck.co.uk)**
40 | - **[British Software Development](https://www.britishsoftware.co)**
41 | - **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
42 | - **[DevSquad](https://devsquad.com)**
43 | - [UserInsights](https://userinsights.com)
44 | - [Fragrantica](https://www.fragrantica.com)
45 | - [SOFTonSOFA](https://softonsofa.com/)
46 | - [User10](https://user10.com)
47 | - [Soumettre.fr](https://soumettre.fr/)
48 | - [CodeBrisk](https://codebrisk.com)
49 | - [1Forge](https://1forge.com)
50 | - [TECPRESSO](https://tecpresso.co.jp/)
51 | - [Runtime Converter](http://runtimeconverter.com/)
52 | - [WebL'Agence](https://weblagence.com/)
53 | - [Invoice Ninja](https://www.invoiceninja.com)
54 | - [iMi digital](https://www.imi-digital.de/)
55 | - [Earthlink](https://www.earthlink.ro/)
56 | - [Steadfast Collective](https://steadfastcollective.com/)
57 | - [We Are The Robots Inc.](https://watr.mx/)
58 | - [Understand.io](https://www.understand.io/)
59 | - [Abdel Elrafa](https://abdelelrafa.com)
60 | - [Hyper Host](https://hyper.host)
61 |
62 | ## Contributing
63 |
64 | Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
65 |
66 | ## Security Vulnerabilities
67 |
68 | If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
69 |
70 | ## License
71 |
72 | The Laravel framework is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).
73 |
--------------------------------------------------------------------------------
/src/resources/js/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * First we will load all of this project's JavaScript dependencies which
3 | * includes Vue and other libraries. It is a great starting point when
4 | * building robust, powerful web applications using Vue and Laravel.
5 | */
6 |
7 | require('./bootstrap');
8 |
9 | window.Vue = require('vue');
10 |
11 | /**
12 | * The following block of code may be used to automatically register your
13 | * Vue components. It will recursively scan this directory for the Vue
14 | * components and automatically register them with their "basename".
15 | *
16 | * Eg. ./components/ExampleComponent.vue ->
17 | */
18 |
19 | // const files = require.context('./', true, /\.vue$/i);
20 | // files.keys().map(key => Vue.component(key.split('/').pop().split('.')[0], files(key).default));
21 |
22 | Vue.component('example-component', require('./components/ExampleComponent.vue').default);
23 |
24 | /**
25 | * Next, we will create a fresh Vue application instance and attach it to
26 | * the page. Then, you may begin adding components to this application
27 | * or customize the JavaScript scaffolding to fit your unique needs.
28 | */
29 |
30 | const app = new Vue({
31 | el: '#app',
32 | });
33 |
--------------------------------------------------------------------------------
/src/resources/js/bootstrap.js:
--------------------------------------------------------------------------------
1 | window._ = require('lodash');
2 |
3 | /**
4 | * We'll load jQuery and the Bootstrap jQuery plugin which provides support
5 | * for JavaScript based Bootstrap features such as modals and tabs. This
6 | * code may be modified to fit the specific needs of your application.
7 | */
8 |
9 | try {
10 | window.Popper = require('popper.js').default;
11 | window.$ = window.jQuery = require('jquery');
12 |
13 | require('bootstrap');
14 | } catch (e) {
15 | }
16 |
17 | /**
18 | * We'll load the axios HTTP library which allows us to easily issue requests
19 | * to our Laravel back-end. This library automatically handles sending the
20 | * CSRF token as a header based on the value of the "XSRF" token cookie.
21 | */
22 |
23 | window.axios = require('axios');
24 |
25 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
26 |
27 | /**
28 | * Next we will register the CSRF Token as a common header with Axios so that
29 | * all outgoing HTTP requests automatically have it attached. This is just
30 | * a simple convenience so we don't have to attach every token manually.
31 | */
32 |
33 | let token = document.head.querySelector('meta[name="csrf-token"]');
34 |
35 | if (token) {
36 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
37 | } else {
38 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
39 | }
40 |
41 | /**
42 | * Echo exposes an expressive API for subscribing to channels and listening
43 | * for events that are broadcast by Laravel. Echo and event broadcasting
44 | * allows your team to easily build robust real-time web applications.
45 | */
46 |
47 | // import Echo from 'laravel-echo'
48 |
49 | // window.Pusher = require('pusher-js');
50 |
51 | // window.Echo = new Echo({
52 | // broadcaster: 'pusher',
53 | // key: process.env.MIX_PUSHER_APP_KEY,
54 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER,
55 | // encrypted: true
56 | // });
57 |
--------------------------------------------------------------------------------
/src/resources/js/components/ExampleComponent.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | I'm an example component.
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
24 |
--------------------------------------------------------------------------------
/src/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 |
--------------------------------------------------------------------------------
/src/resources/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/src/resources/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Passwords must be at least eight 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 |
--------------------------------------------------------------------------------
/src/resources/lang/en/validation.php:
--------------------------------------------------------------------------------
1 | 'The :attribute must be accepted.',
17 | 'active_url' => 'The :attribute is not a valid URL.',
18 | 'after' => 'The :attribute must be a date after :date.',
19 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
20 | 'alpha' => 'The :attribute may only contain letters.',
21 | 'alpha_dash' => 'The :attribute may only contain letters, numbers, dashes and underscores.',
22 | 'alpha_num' => 'The :attribute may only contain letters and numbers.',
23 | 'array' => 'The :attribute must be an array.',
24 | 'before' => 'The :attribute must be a date before :date.',
25 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
26 | 'between' => [
27 | 'numeric' => 'The :attribute must be between :min and :max.',
28 | 'file' => 'The :attribute must be between :min and :max kilobytes.',
29 | 'string' => 'The :attribute must be between :min and :max characters.',
30 | 'array' => 'The :attribute must have between :min and :max items.',
31 | ],
32 | 'boolean' => 'The :attribute field must be true or false.',
33 | 'confirmed' => 'The :attribute confirmation does not match.',
34 | 'date' => 'The :attribute is not a valid date.',
35 | 'date_equals' => 'The :attribute must be a date equal to :date.',
36 | 'date_format' => 'The :attribute does not match the format :format.',
37 | 'different' => 'The :attribute and :other must be different.',
38 | 'digits' => 'The :attribute must be :digits digits.',
39 | 'digits_between' => 'The :attribute must be between :min and :max digits.',
40 | 'dimensions' => 'The :attribute has invalid image dimensions.',
41 | 'distinct' => 'The :attribute field has a duplicate value.',
42 | 'email' => 'The :attribute must be a valid email address.',
43 | 'ends_with' => 'The :attribute must end with one of the following: :values',
44 | 'exists' => 'The selected :attribute is invalid.',
45 | 'file' => 'The :attribute must be a file.',
46 | 'filled' => 'The :attribute field must have a value.',
47 | 'gt' => [
48 | 'numeric' => 'The :attribute must be greater than :value.',
49 | 'file' => 'The :attribute must be greater than :value kilobytes.',
50 | 'string' => 'The :attribute must be greater than :value characters.',
51 | 'array' => 'The :attribute must have more than :value items.',
52 | ],
53 | 'gte' => [
54 | 'numeric' => 'The :attribute must be greater than or equal :value.',
55 | 'file' => 'The :attribute must be greater than or equal :value kilobytes.',
56 | 'string' => 'The :attribute must be greater than or equal :value characters.',
57 | 'array' => 'The :attribute must have :value items or more.',
58 | ],
59 | 'image' => 'The :attribute must be an image.',
60 | 'in' => 'The selected :attribute is invalid.',
61 | 'in_array' => 'The :attribute field does not exist in :other.',
62 | 'integer' => 'The :attribute must be an integer.',
63 | 'ip' => 'The :attribute must be a valid IP address.',
64 | 'ipv4' => 'The :attribute must be a valid IPv4 address.',
65 | 'ipv6' => 'The :attribute must be a valid IPv6 address.',
66 | 'json' => 'The :attribute must be a valid JSON string.',
67 | 'lt' => [
68 | 'numeric' => 'The :attribute must be less than :value.',
69 | 'file' => 'The :attribute must be less than :value kilobytes.',
70 | 'string' => 'The :attribute must be less than :value characters.',
71 | 'array' => 'The :attribute must have less than :value items.',
72 | ],
73 | 'lte' => [
74 | 'numeric' => 'The :attribute must be less than or equal :value.',
75 | 'file' => 'The :attribute must be less than or equal :value kilobytes.',
76 | 'string' => 'The :attribute must be less than or equal :value characters.',
77 | 'array' => 'The :attribute must not have more than :value items.',
78 | ],
79 | 'max' => [
80 | 'numeric' => 'The :attribute may not be greater than :max.',
81 | 'file' => 'The :attribute may not be greater than :max kilobytes.',
82 | 'string' => 'The :attribute may not be greater than :max characters.',
83 | 'array' => 'The :attribute may not have more than :max items.',
84 | ],
85 | 'mimes' => 'The :attribute must be a file of type: :values.',
86 | 'mimetypes' => 'The :attribute must be a file of type: :values.',
87 | 'min' => [
88 | 'numeric' => 'The :attribute must be at least :min.',
89 | 'file' => 'The :attribute must be at least :min kilobytes.',
90 | 'string' => 'The :attribute must be at least :min characters.',
91 | 'array' => 'The :attribute must have at least :min items.',
92 | ],
93 | 'not_in' => 'The selected :attribute is invalid.',
94 | 'not_regex' => 'The :attribute format is invalid.',
95 | 'numeric' => 'The :attribute must be a number.',
96 | 'present' => 'The :attribute field must be present.',
97 | 'regex' => 'The :attribute format is invalid.',
98 | 'required' => 'The :attribute field is required.',
99 | 'required_if' => 'The :attribute field is required when :other is :value.',
100 | 'required_unless' => 'The :attribute field is required unless :other is in :values.',
101 | 'required_with' => 'The :attribute field is required when :values is present.',
102 | 'required_with_all' => 'The :attribute field is required when :values are present.',
103 | 'required_without' => 'The :attribute field is required when :values is not present.',
104 | 'required_without_all' => 'The :attribute field is required when none of :values are present.',
105 | 'same' => 'The :attribute and :other must match.',
106 | 'size' => [
107 | 'numeric' => 'The :attribute must be :size.',
108 | 'file' => 'The :attribute must be :size kilobytes.',
109 | 'string' => 'The :attribute must be :size characters.',
110 | 'array' => 'The :attribute must contain :size items.',
111 | ],
112 | 'starts_with' => 'The :attribute must start with one of the following: :values',
113 | 'string' => 'The :attribute must be a string.',
114 | 'timezone' => 'The :attribute must be a valid zone.',
115 | 'unique' => 'The :attribute has already been taken.',
116 | 'uploaded' => 'The :attribute failed to upload.',
117 | 'url' => 'The :attribute format is invalid.',
118 | 'uuid' => 'The :attribute must be a valid UUID.',
119 |
120 | /*
121 | |--------------------------------------------------------------------------
122 | | Custom Validation Language Lines
123 | |--------------------------------------------------------------------------
124 | |
125 | | Here you may specify custom validation messages for attributes using the
126 | | convention "attribute.rule" to name the lines. This makes it quick to
127 | | specify a specific custom language line for a given attribute rule.
128 | |
129 | */
130 |
131 | 'custom' => [
132 | 'attribute-name' => [
133 | 'rule-name' => 'custom-message',
134 | ],
135 | ],
136 |
137 | /*
138 | |--------------------------------------------------------------------------
139 | | Custom Validation Attributes
140 | |--------------------------------------------------------------------------
141 | |
142 | | The following language lines are used to swap our attribute placeholder
143 | | with something more reader friendly such as "E-Mail Address" instead
144 | | of "email". This simply helps us make our message more expressive.
145 | |
146 | */
147 |
148 | 'attributes' => [],
149 |
150 | ];
151 |
--------------------------------------------------------------------------------
/src/resources/sass/_variables.scss:
--------------------------------------------------------------------------------
1 | // Body
2 | $body-bg: #f8fafc;
3 |
4 | // Typography
5 | $font-family-sans-serif: 'Nunito', sans-serif;
6 | $font-size-base: 0.9rem;
7 | $line-height-base: 1.6;
8 |
9 | // Colors
10 | $blue: #3490dc;
11 | $indigo: #6574cd;
12 | $purple: #9561e2;
13 | $pink: #f66d9b;
14 | $red: #e3342f;
15 | $orange: #f6993f;
16 | $yellow: #ffed4a;
17 | $green: #38c172;
18 | $teal: #4dc0b5;
19 | $cyan: #6cb2eb;
20 |
--------------------------------------------------------------------------------
/src/resources/sass/app.scss:
--------------------------------------------------------------------------------
1 | // Fonts
2 | @import url('https://fonts.googleapis.com/css?family=Nunito');
3 | // Variables
4 | @import 'variables';
5 | // Bootstrap
6 | @import '~bootstrap/scss/bootstrap';
7 |
--------------------------------------------------------------------------------
/src/resources/views/welcome.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Laravel
8 |
9 |
10 |
11 |
12 |
13 |
65 |
66 |
67 |
68 | @if (Route::has('login'))
69 |
70 | @auth
71 |
Home
72 | @else
73 |
Login
74 |
75 | @if (Route::has('register'))
76 |
Register
77 | @endif
78 | @endauth
79 |
80 | @endif
81 |
82 |
83 |
84 | Laravel
85 |
86 |
87 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/src/routes/api.php:
--------------------------------------------------------------------------------
1 | get('/user', function (Request $request) {
17 | return $request->user();
18 | });
19 |
--------------------------------------------------------------------------------
/src/routes/channels.php:
--------------------------------------------------------------------------------
1 | id === (int)$id;
16 | });
17 |
--------------------------------------------------------------------------------
/src/routes/console.php:
--------------------------------------------------------------------------------
1 | comment(Inspiring::quote());
18 | })->describe('Display an inspiring quote');
19 |
--------------------------------------------------------------------------------
/src/routes/web.php:
--------------------------------------------------------------------------------
1 |
8 | */
9 |
10 | $uri = urldecode(
11 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
12 | );
13 |
14 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
15 | // built-in PHP web server. This provides a convenient way to test a Laravel
16 | // application without having installed a "real" web server software here.
17 | if ($uri !== '/' && file_exists(__DIR__ . '/public' . $uri)) {
18 | return false;
19 | }
20 |
21 | require_once __DIR__ . '/public/index.php';
22 |
--------------------------------------------------------------------------------
/src/storage/app/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !public/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/src/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/src/storage/framework/.gitignore:
--------------------------------------------------------------------------------
1 | config.php
2 | routes.php
3 | schedule-*
4 | compiled.php
5 | services.json
6 | events.scanned.php
7 | routes.scanned.php
8 | down
9 |
--------------------------------------------------------------------------------
/src/storage/framework/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !data/
3 | !.gitignore
4 |
--------------------------------------------------------------------------------
/src/storage/framework/cache/data/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/src/storage/framework/sessions/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/src/storage/framework/testing/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/src/storage/framework/views/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/src/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/src/tests/CreatesApplication.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class)->bootstrap();
19 |
20 | return $app;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/tests/Feature/ExampleTest.php:
--------------------------------------------------------------------------------
1 | get('/');
18 |
19 | $response->assertStatus(200);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/tests/TestCase.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/webpack.mix.js:
--------------------------------------------------------------------------------
1 | const mix = require('laravel-mix');
2 |
3 | /*
4 | |--------------------------------------------------------------------------
5 | | Mix Asset Management
6 | |--------------------------------------------------------------------------
7 | |
8 | | Mix provides a clean, fluent API for defining some Webpack build steps
9 | | for your Laravel application. By default, we are compiling the Sass
10 | | file for the application as well as bundling up all the JS files.
11 | |
12 | */
13 |
14 | mix.js('resources/js/app.js', 'public/js')
15 | .sass('resources/sass/app.scss', 'public/css');
16 |
--------------------------------------------------------------------------------