├── database ├── .gitignore ├── factories │ └── .gitignore ├── seeds │ └── DatabaseSeeder.php └── migrations │ └── Version20190111125641.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore └── framework │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── cache │ ├── data │ │ └── .gitignore │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── .gitattributes ├── app ├── Exceptions │ ├── EntityNotFoundException.php │ ├── WriteOperationIsNotAllowedForReadModel.php │ ├── Job │ │ └── SameFreelancerProposalException.php │ ├── BusinessException.php │ ├── ServiceException.php │ └── Handler.php ├── Infrastructure │ ├── MultiDispatcher.php │ ├── StrictObjectManager.php │ ├── LaravelMultiDispatcher.php │ └── DoctrineStrictObjectManager.php ├── Domain │ ├── Events │ │ ├── Job │ │ │ └── JobPosted.php │ │ ├── Client │ │ │ └── ClientRegistered.php │ │ ├── Freelancer │ │ │ ├── FreelancerRegistered.php │ │ │ └── FreelancerAppliedForJob.php │ │ └── EventWithId.php │ ├── ValueObjects │ │ ├── Email.php │ │ ├── Money.php │ │ └── JobDescription.php │ └── Entities │ │ ├── Client.php │ │ ├── EntityWithEvents.php │ │ ├── Proposal.php │ │ ├── Freelancer.php │ │ └── Job.php ├── Http │ ├── Controllers │ │ ├── Read │ │ │ ├── ClientsController.php │ │ │ ├── FreelancersController.php │ │ │ └── JobsController.php │ │ ├── Controller.php │ │ └── Write │ │ │ ├── JobsController.php │ │ │ ├── ClientsController.php │ │ │ └── FreelancersController.php │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── CheckForMaintenanceMode.php │ │ ├── TrimStrings.php │ │ ├── TrustProxies.php │ │ ├── Authenticate.php │ │ ├── VerifyCsrfToken.php │ │ └── RedirectIfAuthenticated.php │ ├── Requests │ │ ├── ClientRegisterRequest.php │ │ ├── JsonRequest.php │ │ ├── FreelancerRegisterRequest.php │ │ ├── JobApplyRequest.php │ │ └── JobPostRequest.php │ └── Kernel.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ ├── AppServiceProvider.php │ └── RouteServiceProvider.php ├── ReadModels │ ├── Client.php │ ├── ReadModel.php │ ├── Freelancer.php │ ├── Proposal.php │ └── Job.php ├── Services │ ├── Dto │ │ └── JobApplyDto.php │ ├── ClientsService.php │ ├── JobsService.php │ └── FreelancersService.php └── Console │ └── Kernel.php ├── .gitignore ├── .editorconfig ├── tests ├── UnitTestCase.php ├── CreatesApplication.php ├── Unit │ ├── ClientTest.php │ ├── FreelancerTest.php │ ├── JobPostTest.php │ ├── Traits │ │ └── CreationTrait.php │ └── JobApplyTest.php ├── TestCase.php ├── Feature │ ├── Traits │ │ └── CreateEntitiesTrait.php │ ├── ClientsTest.php │ ├── FreelancersTest.php │ └── Jobs │ │ ├── JobPostTest.php │ │ └── JobApplyTest.php └── Constraints │ └── EventsHas.php ├── routes ├── web.php ├── channels.php ├── console.php └── api.php ├── server.php ├── public ├── .htaccess └── index.php ├── readme.md ├── .env.example ├── config ├── view.php ├── services.php ├── hashing.php ├── broadcasting.php ├── filesystems.php ├── queue.php ├── logging.php ├── cache.php ├── auth.php ├── database.php ├── mail.php ├── session.php ├── doctrine.php └── app.php ├── package.json ├── phpunit.xml ├── artisan └── composer.json /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite 2 | -------------------------------------------------------------------------------- /database/factories/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/Exceptions/EntityNotFoundException.php: -------------------------------------------------------------------------------- 1 | call(UsersTableSeeder::class); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/UnitTestCase.php: -------------------------------------------------------------------------------- 1 | id = $id; 15 | } 16 | 17 | public function getId(): UuidInterface 18 | { 19 | return $this->id; 20 | } 21 | } -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 'required|email', 13 | ]; 14 | } 15 | 16 | public function getEmail(): Email 17 | { 18 | return Email::create($this['email']); 19 | } 20 | } -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Exceptions/BusinessException.php: -------------------------------------------------------------------------------- 1 | userMessage = $userMessage; 15 | parent::__construct('Business exception'); 16 | } 17 | 18 | public function getUserMessage(): string 19 | { 20 | return $this->userMessage; 21 | } 22 | } -------------------------------------------------------------------------------- /app/Exceptions/ServiceException.php: -------------------------------------------------------------------------------- 1 | userMessage = $userMessage; 15 | parent::__construct('Service exception'); 16 | } 17 | 18 | public function getUserMessage(): string 19 | { 20 | return $this->userMessage; 21 | } 22 | } -------------------------------------------------------------------------------- /app/Http/Controllers/Read/JobsController.php: -------------------------------------------------------------------------------- 1 | findOrFail($id); 19 | } 20 | } -------------------------------------------------------------------------------- /tests/Unit/ClientTest.php: -------------------------------------------------------------------------------- 1 | createUuid(), $this->createEmail()); 17 | 18 | $this->assertEventsHas(ClientRegistered::class, $client->releaseEvents()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | json()->all(); 23 | } 24 | } -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 16 | }); 17 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | dispatcher = $dispatcher; 15 | } 16 | 17 | public function multiDispatch(array $events) 18 | { 19 | foreach ($events as $event) 20 | { 21 | $this->dispatcher->dispatch($event); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 20 | return redirect('/home'); 21 | } 22 | 23 | return $next($request); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 18 | })->describe('Display an inspiring quote'); 19 | -------------------------------------------------------------------------------- /tests/Unit/FreelancerTest.php: -------------------------------------------------------------------------------- 1 | createUuid(), $this->createEmail(), Money::dollars(42)); 18 | 19 | $this->assertEventsHas(FreelancerRegistered::class, $freelancer->releaseEvents()); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/Unit/JobPostTest.php: -------------------------------------------------------------------------------- 1 | createClient(); 18 | $job = Job::post($this->createUuid(), $client, JobDescription::create('Simple job', 'Do nothing')); 19 | 20 | $this->assertEventsHas(JobPosted::class, $job->releaseEvents()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /server.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 | -------------------------------------------------------------------------------- /app/Http/Requests/FreelancerRegisterRequest.php: -------------------------------------------------------------------------------- 1 | 'required|email', 14 | 'hourRate' => 'required|numeric', 15 | ]; 16 | } 17 | 18 | public function getEmail(): Email 19 | { 20 | return Email::create($this['email']); 21 | } 22 | 23 | public function getHourRate(): Money 24 | { 25 | return Money::dollars($this['hourRate']); 26 | } 27 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/Http/Controllers/Write/JobsController.php: -------------------------------------------------------------------------------- 1 | service = $service; 17 | } 18 | 19 | public function post(JobPostRequest $request) 20 | { 21 | return [ 22 | 'id' => $this->service->post($request->getClientId(), $request->getJobDescription()), 23 | ]; 24 | } 25 | } -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 'App\Policies\ModelPolicy', 16 | ]; 17 | 18 | /** 19 | * Register any authentication / authorization services. 20 | * 21 | * @return void 22 | */ 23 | public function boot() 24 | { 25 | $this->registerPolicies(); 26 | 27 | // 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/Http/Controllers/Write/ClientsController.php: -------------------------------------------------------------------------------- 1 | service = $service; 17 | } 18 | 19 | public function register(ClientRegisterRequest $request) 20 | { 21 | return [ 22 | 'id' => $this->service->register($request->getEmail()), 23 | ]; 24 | } 25 | } -------------------------------------------------------------------------------- /app/Http/Requests/JobApplyRequest.php: -------------------------------------------------------------------------------- 1 | 'required|uuid', 14 | 'freelancerId' => 'required|uuid', 15 | //'coverLetter' => optional 16 | ]; 17 | } 18 | 19 | public function getDto(): JobApplyDto 20 | { 21 | return new JobApplyDto( 22 | Uuid::fromString($this['jobId']), 23 | Uuid::fromString($this['freelancerId']), 24 | $this->get('coverLetter', '') 25 | ); 26 | } 27 | } -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | 'Write'], function(){ 4 | Route::post('clients/register', 'ClientsController@register'); 5 | 6 | Route::post('freelancers/register', 'FreelancersController@register'); 7 | Route::post('freelancers/apply-to-job', 'FreelancersController@apply'); 8 | 9 | Route::post('jobs/post', 'JobsController@post'); 10 | }); 11 | 12 | Route::group(['namespace' => 'Read'], function(){ 13 | Route::get('clients/{uuid}', 'ClientsController@get'); 14 | Route::get('jobs/{uuid}', 'JobsController@get'); 15 | Route::get('freelancers/{uuid}', 'FreelancersController@get'); 16 | 17 | Route::get('jobs-with-proposals/{uuid}', 'JobsController@getWithProposals'); 18 | }); -------------------------------------------------------------------------------- /app/ReadModels/Client.php: -------------------------------------------------------------------------------- 1 | wrapped->find($entityName, $id); 18 | 19 | if ($entity === null) 20 | { 21 | throw new ServiceException(basename(str_replace('\\', '/', $entityName)) . ' not found'); 22 | } 23 | 24 | return $entity; 25 | } 26 | } -------------------------------------------------------------------------------- /app/Http/Requests/JobPostRequest.php: -------------------------------------------------------------------------------- 1 | 'required|uuid', 15 | 'title' => 'required', 16 | 'description' => 'required', 17 | ]; 18 | } 19 | 20 | public function getClientId(): UuidInterface 21 | { 22 | return Uuid::fromString($this['clientId']); 23 | } 24 | 25 | public function getJobDescription(): JobDescription 26 | { 27 | return JobDescription::create($this['title'], $this['description']); 28 | } 29 | } -------------------------------------------------------------------------------- /app/Domain/Events/Freelancer/FreelancerAppliedForJob.php: -------------------------------------------------------------------------------- 1 | freelancerId = $freelancerId; 18 | $this->jobId = $jobId; 19 | } 20 | 21 | public function getFreelancerId(): UuidInterface 22 | { 23 | return $this->freelancerId; 24 | } 25 | 26 | public function getJobId(): UuidInterface 27 | { 28 | return $this->jobId; 29 | } 30 | } -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.php: -------------------------------------------------------------------------------- 1 | [ 18 | SendEmailVerificationNotification::class, 19 | ], 20 | ]; 21 | 22 | /** 23 | * Register any events for your application. 24 | * 25 | * @return void 26 | */ 27 | public function boot() 28 | { 29 | parent::boot(); 30 | 31 | // 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | DOCTRINE_PROXY_AUTOGENERATE=true 8 | 9 | DB_CONNECTION=mysql 10 | DB_HOST=127.0.0.1 11 | DB_PORT=3306 12 | DB_DATABASE=homestead 13 | DB_USERNAME=homestead 14 | DB_PASSWORD=secret 15 | 16 | BROADCAST_DRIVER=log 17 | CACHE_DRIVER=file 18 | QUEUE_CONNECTION=sync 19 | SESSION_DRIVER=file 20 | SESSION_LIFETIME=120 21 | 22 | REDIS_HOST=127.0.0.1 23 | REDIS_PASSWORD=null 24 | REDIS_PORT=6379 25 | 26 | MAIL_DRIVER=smtp 27 | MAIL_HOST=smtp.mailtrap.io 28 | MAIL_PORT=2525 29 | MAIL_USERNAME=null 30 | MAIL_PASSWORD=null 31 | MAIL_ENCRYPTION=null 32 | 33 | PUSHER_APP_ID= 34 | PUSHER_APP_KEY= 35 | PUSHER_APP_SECRET= 36 | PUSHER_APP_CLUSTER=mt1 37 | 38 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 39 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 40 | 41 | LOG_CHANNEL=stack -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->bind(StrictObjectManager::class, DoctrineStrictObjectManager::class); 16 | $this->app->bind(MultiDispatcher::class, LaravelMultiDispatcher::class); 17 | } 18 | 19 | public function register() 20 | { 21 | if (!\Doctrine\DBAL\Types\Type::hasType('uuid')) 22 | { 23 | \Doctrine\DBAL\Types\Type::addType('uuid', \Ramsey\Uuid\Doctrine\UuidType::class); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/ReadModels/ReadModel.php: -------------------------------------------------------------------------------- 1 | email = $email; 23 | } 24 | 25 | public static function create(string $email) 26 | { 27 | return new static($email); 28 | } 29 | 30 | public function email(): string 31 | { 32 | return $this->email; 33 | } 34 | 35 | public function equals(Email $other): bool 36 | { 37 | return $this->email === $other->email; 38 | } 39 | } -------------------------------------------------------------------------------- /app/Domain/Entities/Client.php: -------------------------------------------------------------------------------- 1 | email = $email; 26 | } 27 | 28 | public static function register(UuidInterface $id, Email $email): Client 29 | { 30 | $client = new Client($id, $email); 31 | $client->record(new ClientRegistered($client->getId())); 32 | 33 | return $client; 34 | } 35 | } -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | artisan('doctrine:migrations:reset'); 23 | $this->artisan('doctrine:migrations:migrate'); 24 | 25 | $this->app[Kernel::class]->setArtisan(null); 26 | 27 | RefreshDatabaseState::$migrated = true; 28 | } 29 | 30 | $this->beginDatabaseTransaction(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Domain/Entities/EntityWithEvents.php: -------------------------------------------------------------------------------- 1 | id = $id; 23 | } 24 | 25 | public function releaseEvents(): array 26 | { 27 | $events = $this->events; 28 | $this->events = []; 29 | 30 | return $events; 31 | } 32 | 33 | protected function record($event) 34 | { 35 | $this->events[] = $event; 36 | } 37 | 38 | public function getId(): UuidInterface 39 | { 40 | return $this->id; 41 | } 42 | } -------------------------------------------------------------------------------- /app/Domain/ValueObjects/Money.php: -------------------------------------------------------------------------------- 1 | amount = $amount; 23 | } 24 | 25 | public static function dollars(float $amount): Money 26 | { 27 | return new Money((int) round($amount * 100)); 28 | } 29 | 30 | public static function cents(int $amount): Money 31 | { 32 | return new Money($amount); 33 | } 34 | 35 | public function equals(Money $other): bool 36 | { 37 | return $this->amount === $other->amount; 38 | } 39 | } -------------------------------------------------------------------------------- /tests/Unit/Traits/CreationTrait.php: -------------------------------------------------------------------------------- 1 | createUuid(), $this->createEmail()); 29 | } 30 | 31 | private function createFreelancer(): Freelancer 32 | { 33 | return Freelancer::register($this->createUuid(), $this->createEmail(), Money::dollars(42)); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Services/Dto/JobApplyDto.php: -------------------------------------------------------------------------------- 1 | jobId = $jobId; 21 | $this->freelancerId = $freelancerId; 22 | $this->coverLetter = $coverLetter; 23 | } 24 | 25 | public function getJobId(): UuidInterface 26 | { 27 | return $this->jobId; 28 | } 29 | 30 | public function getFreelancerId(): UuidInterface 31 | { 32 | return $this->freelancerId; 33 | } 34 | 35 | public function getCoverLetter(): string 36 | { 37 | return $this->coverLetter; 38 | } 39 | } -------------------------------------------------------------------------------- /app/Domain/ValueObjects/JobDescription.php: -------------------------------------------------------------------------------- 1 | title = $title; 25 | $this->description = $description; 26 | } 27 | 28 | public static function create(string $title, string $description): JobDescription 29 | { 30 | return new JobDescription($title, $description); 31 | } 32 | 33 | public function equals(JobDescription $other): bool 34 | { 35 | return $this->title === $other->title 36 | && $this->description == $other->description; 37 | } 38 | } -------------------------------------------------------------------------------- /tests/Feature/Traits/CreateEntitiesTrait.php: -------------------------------------------------------------------------------- 1 | postJson('/api/clients/register', [ 10 | 'email' => $email, 11 | ]); 12 | 13 | return $response->getData()->id; 14 | } 15 | 16 | protected function createFreelancer($email): string 17 | { 18 | $response = $this->postJson('/api/freelancers/register', [ 19 | 'email' => $email, 20 | 'hourRate' => 50, 21 | ]); 22 | 23 | return $response->getData()->id; 24 | } 25 | 26 | protected function createJob($clientsEmail): string 27 | { 28 | $response = $this->postJson('/api/jobs/post', [ 29 | 'clientId' => $this->createClient($clientsEmail), 30 | 'title' => 'job title', 31 | 'description' => 'job description', 32 | ]); 33 | 34 | return $response->getData()->id; 35 | } 36 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/Constraints/EventsHas.php: -------------------------------------------------------------------------------- 1 | eventClass = $eventClass; 22 | } 23 | 24 | /** 25 | * Returns a string representation of the object. 26 | */ 27 | public function toString(): string 28 | { 29 | return \sprintf( 30 | 'contains event "%s"', 31 | $this->eventClass 32 | ); 33 | } 34 | 35 | protected function matches($events): bool 36 | { 37 | return count(array_filter($events, function($event){ 38 | return $event instanceof $this->eventClass; 39 | })) > 0; 40 | } 41 | 42 | protected function failureDescription($other): string 43 | { 44 | return 'events ' . $this->toString(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/Feature/ClientsTest.php: -------------------------------------------------------------------------------- 1 | postJson('/api/clients/register', [ 12 | 'email' => 'create@client.test', 13 | ]); 14 | 15 | $response->assertOk(); 16 | 17 | $response->assertJsonStructure([ 18 | 'id', 19 | ]); 20 | 21 | $checkResponse = $this->get('/api/clients/' . $response->getData()->id); 22 | 23 | $checkResponse->assertOk(); 24 | 25 | $checkResponse->assertJsonStructure([ 26 | 'email' 27 | ]); 28 | 29 | $this->assertEquals('create@client.test', $checkResponse->getData()->email); 30 | } 31 | 32 | public function testValidation() 33 | { 34 | $response = $this->postJson('/api/clients/register', [ 35 | 'email' => 'wrong@email', 36 | ]); 37 | 38 | $response->assertStatus(422); 39 | 40 | $response->assertJsonStructure([ 41 | 'message', 42 | 'errors' => ['email'] 43 | ]); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/ReadModels/Proposal.php: -------------------------------------------------------------------------------- 1 | hasMany(Proposal::class, 'job_id', 'id'); 27 | } 28 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.0.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 | -------------------------------------------------------------------------------- /app/Services/ClientsService.php: -------------------------------------------------------------------------------- 1 | entityManager = $entityManager; 23 | $this->dispatcher = $dispatcher; 24 | } 25 | 26 | /** 27 | * Return client's id. 28 | * 29 | * @param \App\Domain\ValueObjects\Email $email 30 | * @return UuidInterface 31 | */ 32 | public function register(Email $email): UuidInterface 33 | { 34 | $client = Client::register(Uuid::uuid4(), $email); 35 | 36 | $this->entityManager->persist($client); 37 | $this->entityManager->flush(); 38 | 39 | $this->dispatcher->multiDispatch($client->releaseEvents()); 40 | 41 | return $client->getId(); 42 | } 43 | } -------------------------------------------------------------------------------- /tests/Feature/FreelancersTest.php: -------------------------------------------------------------------------------- 1 | postJson('/api/freelancers/register', [ 12 | 'email' => 'create@freelancer.test', 13 | 'hourRate' => '50', 14 | ]); 15 | 16 | $response->assertOk(); 17 | 18 | $response->assertJsonStructure([ 19 | 'id', 20 | ]); 21 | 22 | $checkResponse = $this->get('/api/freelancers/' . $response->getData()->id); 23 | 24 | $checkResponse->assertOk(); 25 | 26 | $checkResponse->assertJsonStructure([ 27 | 'email' 28 | ]); 29 | 30 | $this->assertEquals('create@freelancer.test', $checkResponse->getData()->email); 31 | } 32 | 33 | public function testValidation() 34 | { 35 | $response = $this->postJson('/api/freelancers/register', [ 36 | 'email' => 'wrong@email', 37 | ]); 38 | 39 | $response->assertStatus(422); 40 | 41 | $response->assertJsonStructure([ 42 | 'message', 43 | 'errors' => ['email', 'hourRate'] 44 | ]); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/Http/Controllers/Write/FreelancersController.php: -------------------------------------------------------------------------------- 1 | service = $service; 20 | } 21 | 22 | public function register(FreelancerRegisterRequest $request) 23 | { 24 | return [ 25 | 'id' => $this->service->register( 26 | Email::create($request['email']), 27 | Money::dollars($request['hourRate'])), 28 | ]; 29 | } 30 | 31 | /** 32 | * @param JobApplyRequest $request 33 | * @return array 34 | * @throws \App\Exceptions\Job\SameFreelancerProposalException 35 | */ 36 | public function apply(JobApplyRequest $request) 37 | { 38 | $this->service->apply($request->getDto()); 39 | 40 | return ['ok' => 1]; 41 | } 42 | } -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | ./tests/Unit 14 | 15 | 16 | 17 | ./tests/Feature 18 | 19 | 20 | 21 | 22 | ./app/Domain/Entities 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/Unit/JobApplyTest.php: -------------------------------------------------------------------------------- 1 | createJob(); 19 | $freelancer = $this->createFreelancer(); 20 | 21 | $freelancer->apply($job, 'cover letter'); 22 | 23 | $this->assertEventsHas(FreelancerAppliedForJob::class, $freelancer->releaseEvents()); 24 | } 25 | 26 | public function testApplySameFreelancer() 27 | { 28 | $job = $this->createJob(); 29 | $freelancer = $this->createFreelancer(); 30 | 31 | $freelancer->apply($job, 'cover letter'); 32 | 33 | $this->expectException(SameFreelancerProposalException::class); 34 | 35 | $freelancer->apply($job, 'another cover letter'); 36 | } 37 | 38 | private function createJob(): Job 39 | { 40 | return Job::post( 41 | $this->createUuid(), 42 | $this->createClient(), 43 | JobDescription::create('Simple job', 'Do nothing')); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /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 | 'ses' => [ 24 | 'key' => env('SES_KEY'), 25 | 'secret' => env('SES_SECRET'), 26 | 'region' => env('SES_REGION', 'us-east-1'), 27 | ], 28 | 29 | 'sparkpost' => [ 30 | 'secret' => env('SPARKPOST_SECRET'), 31 | ], 32 | 33 | 'stripe' => [ 34 | 'model' => App\User::class, 35 | 'key' => env('STRIPE_KEY'), 36 | 'secret' => env('STRIPE_SECRET'), 37 | 'webhook' => [ 38 | 'secret' => env('STRIPE_WEBHOOK_SECRET'), 39 | 'tolerance' => env('STRIPE_WEBHOOK_TOLERANCE', 300), 40 | ], 41 | ], 42 | 43 | ]; 44 | -------------------------------------------------------------------------------- /app/Services/JobsService.php: -------------------------------------------------------------------------------- 1 | entityManager = $entityManager; 24 | $this->dispatcher = $dispatcher; 25 | } 26 | 27 | /** 28 | * Return job's id. 29 | * 30 | * @param UuidInterface $clientId 31 | * @param \App\Domain\ValueObjects\JobDescription $description 32 | * @return UuidInterface 33 | */ 34 | public function post(UuidInterface $clientId, JobDescription $description): UuidInterface 35 | { 36 | /** @var Client $client */ 37 | $client = $this->entityManager->findOrFail(Client::class, $clientId); 38 | 39 | $job = Job::post(Uuid::uuid4(), $client, $description); 40 | 41 | $this->entityManager->persist($job); 42 | $this->entityManager->flush(); 43 | 44 | $this->dispatcher->multiDispatch($job->releaseEvents()); 45 | 46 | return $job->getId(); 47 | } 48 | } -------------------------------------------------------------------------------- /tests/Feature/Jobs/JobPostTest.php: -------------------------------------------------------------------------------- 1 | createClient('job@client.test'); 15 | $response = $this->postJson('/api/jobs/post', [ 16 | 'clientId' => $clientId, 17 | 'title' => 'job title', 18 | 'description' => 'job description', 19 | ]); 20 | 21 | $response->assertOk(); 22 | 23 | $response->assertJsonStructure([ 24 | 'id', 25 | ]); 26 | 27 | $checkResponse = $this->get('/api/jobs/' . $response->getData()->id); 28 | 29 | $checkResponse->assertOk(); 30 | 31 | $checkResponse->assertJsonStructure([ 32 | 'client_id', 'title', 'description' 33 | ]); 34 | 35 | $this->assertEquals($clientId, $checkResponse->getData()->client_id); 36 | $this->assertEquals('job title', $checkResponse->getData()->title); 37 | $this->assertEquals('job description', $checkResponse->getData()->description); 38 | } 39 | 40 | public function testValidation() 41 | { 42 | $response = $this->postJson('/api/jobs/post', [ 43 | 'clientId' => 'not a number', 44 | 'title' => '', 45 | 'description' => '', 46 | ]); 47 | 48 | $response->assertStatus(422); 49 | 50 | $response->assertJsonStructure([ 51 | 'message', 52 | 'errors' => ['clientId', 'title', 'description'] 53 | ]); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/Domain/Entities/Proposal.php: -------------------------------------------------------------------------------- 1 | job = $job; 50 | $this->freelancer = $freelancer; 51 | $this->hourRate = $hourRate; 52 | $this->coverLetter = $coverLetter; 53 | } 54 | 55 | /** 56 | * @param \App\Domain\Entities\Proposal $other 57 | * @throws SameFreelancerProposalException 58 | */ 59 | public function checkCompatibility(Proposal $other) 60 | { 61 | if ($this->freelancer->equals($other->freelancer)) { 62 | throw new SameFreelancerProposalException(); 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | json([ 48 | 'error' => $exception->getUserMessage(), 49 | ], 422); 50 | } 51 | 52 | if ($exception instanceof BusinessException) 53 | { 54 | return response()->json([ 55 | 'error' => $exception->getUserMessage(), 56 | ], 422); 57 | } 58 | 59 | if ($exception instanceof EntityNotFoundException) 60 | { 61 | return response('', 404); 62 | } 63 | 64 | return parent::render($request, $exception); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/Domain/Entities/Freelancer.php: -------------------------------------------------------------------------------- 1 | email = $email; 34 | $this->hourRate = $hourRate; 35 | } 36 | 37 | public static function register(UuidInterface $id, Email $email, Money $hourRate): Freelancer 38 | { 39 | $freelancer = new Freelancer($id, $email, $hourRate); 40 | $freelancer->record(new FreelancerRegistered($freelancer->getId())); 41 | 42 | return $freelancer; 43 | } 44 | 45 | /** 46 | * @param Job $job 47 | * @param string $coverLetter 48 | * @throws \App\Exceptions\Job\SameFreelancerProposalException 49 | */ 50 | public function apply(Job $job, string $coverLetter) 51 | { 52 | $job->addProposal($this, $this->hourRate, $coverLetter); 53 | 54 | $this->record(new FreelancerAppliedForJob($this->getId(), $job->getId())); 55 | } 56 | 57 | public function equals(Freelancer $other): bool 58 | { 59 | return $this->id->equals($other->id); 60 | } 61 | } -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": [ 6 | "framework", 7 | "laravel" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^7.1.3", 12 | "barryvdh/laravel-ide-helper": "^2.5", 13 | "fideloper/proxy": "^4.0", 14 | "laravel-doctrine/migrations": "^1.2", 15 | "laravel-doctrine/orm": "^1.4", 16 | "laravel/framework": "5.7.*", 17 | "laravel/tinker": "^1.0", 18 | "ramsey/uuid-doctrine": "^1.5" 19 | }, 20 | "require-dev": { 21 | "beyondcode/laravel-dump-server": "^1.0", 22 | "filp/whoops": "^2.0", 23 | "fzaninotto/faker": "^1.4", 24 | "mockery/mockery": "^1.0", 25 | "nunomaduro/collision": "^2.0", 26 | "phpunit/phpunit": "^7.0" 27 | }, 28 | "config": { 29 | "optimize-autoloader": true, 30 | "preferred-install": "dist", 31 | "sort-packages": true 32 | }, 33 | "extra": { 34 | "laravel": { 35 | "dont-discover": [] 36 | } 37 | }, 38 | "autoload": { 39 | "psr-4": { 40 | "App\\": "app/" 41 | }, 42 | "classmap": [ 43 | "database/seeds", 44 | "database/factories" 45 | ] 46 | }, 47 | "autoload-dev": { 48 | "psr-4": { 49 | "Tests\\": "tests/" 50 | } 51 | }, 52 | "minimum-stability": "dev", 53 | "prefer-stable": true, 54 | "scripts": { 55 | "post-autoload-dump": [ 56 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 57 | "@php artisan package:discover --ansi" 58 | ], 59 | "post-root-package-install": [ 60 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 61 | ], 62 | "post-create-project-cmd": [ 63 | "@php artisan key:generate --ansi" 64 | ] 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | mapApiRoutes(); 43 | 44 | $this->mapWebRoutes(); 45 | 46 | // 47 | } 48 | 49 | /** 50 | * Define the "web" routes for the application. 51 | * 52 | * These routes all receive session state, CSRF protection, etc. 53 | * 54 | * @return void 55 | */ 56 | protected function mapWebRoutes() 57 | { 58 | \Route::middleware('web') 59 | ->namespace($this->namespace) 60 | ->group(base_path('routes/web.php')); 61 | } 62 | 63 | /** 64 | * Define the "api" routes for the application. 65 | * 66 | * These routes are typically stateless. 67 | * 68 | * @return void 69 | */ 70 | protected function mapApiRoutes() 71 | { 72 | \Route::prefix('api') 73 | ->middleware('api') 74 | ->namespace($this->namespace) 75 | ->group(base_path('routes/api.php')); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /database/migrations/Version20190111125641.php: -------------------------------------------------------------------------------- 1 | abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'Migration can only be executed safely on \'sqlite\'.'); 16 | 17 | $this->addSql('CREATE TABLE clients (id CHAR(36) NOT NULL --(DC2Type:uuid) 18 | , email VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); 19 | $this->addSql('CREATE TABLE freelancers (id CHAR(36) NOT NULL --(DC2Type:uuid) 20 | , email VARCHAR(255) NOT NULL, hourRate_amount INTEGER NOT NULL, PRIMARY KEY(id))'); 21 | $this->addSql('CREATE TABLE jobs (id CHAR(36) NOT NULL --(DC2Type:uuid) 22 | , client_id CHAR(36) NOT NULL --(DC2Type:uuid) 23 | , title VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); 24 | $this->addSql('CREATE INDEX IDX_A8936DC519EB6921 ON jobs (client_id)'); 25 | $this->addSql('CREATE TABLE proposals (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, job_id CHAR(36) DEFAULT NULL --(DC2Type:uuid) 26 | , freelancer_id CHAR(36) NOT NULL --(DC2Type:uuid) 27 | , cover_letter VARCHAR(255) NOT NULL, hourRate_amount INTEGER NOT NULL)'); 28 | $this->addSql('CREATE INDEX IDX_A5BA3A8FBE04EA9 ON proposals (job_id)'); 29 | $this->addSql('CREATE INDEX IDX_A5BA3A8F8545BDF5 ON proposals (freelancer_id)'); 30 | } 31 | 32 | /** 33 | * @param Schema $schema 34 | */ 35 | public function down(Schema $schema) 36 | { 37 | $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'sqlite', 'Migration can only be executed safely on \'sqlite\'.'); 38 | 39 | $this->addSql('DROP TABLE clients'); 40 | $this->addSql('DROP TABLE freelancers'); 41 | $this->addSql('DROP TABLE jobs'); 42 | $this->addSql('DROP TABLE proposals'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/Services/FreelancersService.php: -------------------------------------------------------------------------------- 1 | entityManager = $entityManager; 26 | $this->dispatcher = $dispatcher; 27 | } 28 | 29 | /** 30 | * Return freelancers's id. 31 | * 32 | * @param \App\Domain\ValueObjects\Email $email 33 | * @param \App\Domain\ValueObjects\Money $hourRate 34 | * @return UuidInterface 35 | */ 36 | public function register(Email $email, Money $hourRate): UuidInterface 37 | { 38 | $freelancer = Freelancer::register(Uuid::uuid4(), $email, $hourRate); 39 | 40 | $this->entityManager->persist($freelancer); 41 | $this->entityManager->flush(); 42 | 43 | $this->dispatcher->multiDispatch($freelancer->releaseEvents()); 44 | 45 | return $freelancer->getId(); 46 | } 47 | 48 | /** 49 | * @param \App\Services\Dto\JobApplyDto $dto 50 | * @throws \App\Exceptions\Job\SameFreelancerProposalException 51 | */ 52 | public function apply(JobApplyDto $dto) 53 | { 54 | /** @var Freelancer $freelancer */ 55 | $freelancer = $this->entityManager->findOrFail(Freelancer::class, $dto->getFreelancerId()); 56 | 57 | /** @var Job $job */ 58 | $job = $this->entityManager->findOrFail(Job::class, $dto->getJobId()); 59 | 60 | $freelancer->apply($job, $dto->getCoverLetter()); 61 | 62 | $this->dispatcher->multiDispatch($freelancer->releaseEvents()); 63 | 64 | $this->entityManager->flush(); 65 | } 66 | } -------------------------------------------------------------------------------- /app/Domain/Entities/Job.php: -------------------------------------------------------------------------------- 1 | client = $client; 40 | $this->description = $description; 41 | $this->proposals = new \Doctrine\Common\Collections\ArrayCollection(); 42 | } 43 | 44 | public static function post(UuidInterface $id, Client $client, JobDescription $description): Job 45 | { 46 | $job = new Job($id, $client, $description); 47 | $job->record(new JobPosted($job->getId())); 48 | 49 | return $job; 50 | } 51 | 52 | /** 53 | * @param Freelancer $freelancer 54 | * @param Money $hourRate 55 | * @param string $coverLetter 56 | * @throws \App\Exceptions\Job\SameFreelancerProposalException 57 | */ 58 | public function addProposal(Freelancer $freelancer, Money $hourRate, string $coverLetter) 59 | { 60 | $newProposal = new Proposal($this, $freelancer, $hourRate, $coverLetter); 61 | 62 | foreach ($this->proposals as $proposal) 63 | { 64 | $proposal->checkCompatibility($newProposal); 65 | } 66 | 67 | $this->proposals->add($newProposal); 68 | } 69 | } -------------------------------------------------------------------------------- /tests/Feature/Jobs/JobApplyTest.php: -------------------------------------------------------------------------------- 1 | createJob('apply.job@client.test'); 15 | $response = $this->postJson('/api/freelancers/apply-to-job', [ 16 | 'jobId' => $jobId, 17 | 'freelancerId' => $this->createFreelancer('apply.job@freelancer.test'), 18 | 'coverLetter' => 'cover letter', 19 | ]); 20 | 21 | $response->assertOk(); 22 | 23 | $checkResponse = $this->get('/api/jobs-with-proposals/' . $jobId); 24 | 25 | $checkResponse->assertOk(); 26 | 27 | $checkResponse->assertJsonStructure([ 28 | 'proposals' 29 | ]); 30 | 31 | $this->assertEquals(1, count($checkResponse->getData()->proposals)); 32 | } 33 | 34 | public function testValidation() 35 | { 36 | $response = $this->postJson('/api/freelancers/apply-to-job', [ 37 | 'jobId' => 'not a number', 38 | 'freelancerId' => 'not a number', 39 | ]); 40 | 41 | $response->assertStatus(422); 42 | 43 | $response->assertJsonStructure([ 44 | 'message', 45 | 'errors' => ['jobId', 'freelancerId'], 46 | ]); 47 | } 48 | 49 | public function testSameFreelancer() 50 | { 51 | $job = $this->createJob('apply.job.same@client.test'); 52 | $freelancer = $this->createFreelancer('apply.job.same@freelancer.test'); 53 | 54 | $response = $this->postJson('/api/freelancers/apply-to-job', [ 55 | 'jobId' => $job, 56 | 'freelancerId' => $freelancer, 57 | 'coverLetter' => 'cover letter', 58 | ]); 59 | 60 | $response->assertOk(); 61 | 62 | $response = $this->postJson('/api/freelancers/apply-to-job', [ 63 | 'jobId' => $job, 64 | 'freelancerId' => $freelancer, 65 | 'coverLetter' => 'another cover letter', 66 | ]); 67 | 68 | $response->assertStatus(422); 69 | 70 | $response->assertJsonStructure(['error']); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | ], 50 | 51 | 'sqs' => [ 52 | 'driver' => 'sqs', 53 | 'key' => env('SQS_KEY', 'your-public-key'), 54 | 'secret' => env('SQS_SECRET', 'your-secret-key'), 55 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 56 | 'queue' => env('SQS_QUEUE', 'your-queue-name'), 57 | 'region' => env('SQS_REGION', 'us-east-1'), 58 | ], 59 | 60 | 'redis' => [ 61 | 'driver' => 'redis', 62 | 'connection' => 'default', 63 | 'queue' => env('REDIS_QUEUE', 'default'), 64 | 'retry_after' => 90, 65 | 'block_for' => null, 66 | ], 67 | 68 | ], 69 | 70 | /* 71 | |-------------------------------------------------------------------------- 72 | | Failed Queue Jobs 73 | |-------------------------------------------------------------------------- 74 | | 75 | | These options configure the behavior of failed queue job logging so you 76 | | can control which database and table are used to store the jobs that 77 | | have failed. You may change them to any database / table you wish. 78 | | 79 | */ 80 | 81 | 'failed' => [ 82 | 'database' => env('DB_CONNECTION', 'mysql'), 83 | 'table' => 'failed_jobs', 84 | ], 85 | 86 | ]; 87 | -------------------------------------------------------------------------------- /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 | ], 41 | 42 | 'single' => [ 43 | 'driver' => 'single', 44 | 'path' => storage_path('logs/laravel.log'), 45 | 'level' => 'debug', 46 | ], 47 | 48 | 'daily' => [ 49 | 'driver' => 'daily', 50 | 'path' => storage_path('logs/laravel.log'), 51 | 'level' => 'debug', 52 | 'days' => 14, 53 | ], 54 | 55 | 'slack' => [ 56 | 'driver' => 'slack', 57 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 58 | 'username' => 'Laravel Log', 59 | 'emoji' => ':boom:', 60 | 'level' => 'critical', 61 | ], 62 | 63 | 'papertrail' => [ 64 | 'driver' => 'monolog', 65 | 'level' => 'debug', 66 | 'handler' => SyslogUdpHandler::class, 67 | 'handler_with' => [ 68 | 'host' => env('PAPERTRAIL_URL'), 69 | 'port' => env('PAPERTRAIL_PORT'), 70 | ], 71 | ], 72 | 73 | 'stderr' => [ 74 | 'driver' => 'monolog', 75 | 'handler' => StreamHandler::class, 76 | 'formatter' => env('LOG_STDERR_FORMATTER'), 77 | 'with' => [ 78 | 'stream' => 'php://stderr', 79 | ], 80 | ], 81 | 82 | 'syslog' => [ 83 | 'driver' => 'syslog', 84 | 'level' => 'debug', 85 | ], 86 | 87 | 'errorlog' => [ 88 | 'driver' => 'errorlog', 89 | 'level' => 'debug', 90 | ], 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Cache Stores 25 | |-------------------------------------------------------------------------- 26 | | 27 | | Here you may define all of the cache "stores" for your application as 28 | | well as their drivers. You may even define multiple stores for the 29 | | same cache driver to group types of items stored in your caches. 30 | | 31 | */ 32 | 33 | 'stores' => [ 34 | 35 | 'apc' => [ 36 | 'driver' => 'apc', 37 | ], 38 | 39 | 'array' => [ 40 | 'driver' => 'array', 41 | ], 42 | 43 | 'database' => [ 44 | 'driver' => 'database', 45 | 'table' => 'cache', 46 | 'connection' => null, 47 | ], 48 | 49 | 'file' => [ 50 | 'driver' => 'file', 51 | 'path' => storage_path('framework/cache/data'), 52 | ], 53 | 54 | 'memcached' => [ 55 | 'driver' => 'memcached', 56 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 57 | 'sasl' => [ 58 | env('MEMCACHED_USERNAME'), 59 | env('MEMCACHED_PASSWORD'), 60 | ], 61 | 'options' => [ 62 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 63 | ], 64 | 'servers' => [ 65 | [ 66 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 67 | 'port' => env('MEMCACHED_PORT', 11211), 68 | 'weight' => 100, 69 | ], 70 | ], 71 | ], 72 | 73 | 'redis' => [ 74 | 'driver' => 'redis', 75 | 'connection' => 'cache', 76 | ], 77 | 78 | ], 79 | 80 | /* 81 | |-------------------------------------------------------------------------- 82 | | Cache Key Prefix 83 | |-------------------------------------------------------------------------- 84 | | 85 | | When utilizing a RAM based store such as APC or Memcached, there might 86 | | be other applications utilizing the same cache. So, we'll specify a 87 | | value to get prefixed to all our keys so we can avoid collisions. 88 | | 89 | */ 90 | 91 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | [ 31 | \App\Http\Middleware\EncryptCookies::class, 32 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 33 | \Illuminate\Session\Middleware\StartSession::class, 34 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 35 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 36 | \App\Http\Middleware\VerifyCsrfToken::class, 37 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 38 | ], 39 | 40 | 'api' => [ 41 | 'throttle:60,1', 42 | 'bindings', 43 | ], 44 | ]; 45 | 46 | /** 47 | * The application's route middleware. 48 | * 49 | * These middleware may be assigned to groups or used individually. 50 | * 51 | * @var array 52 | */ 53 | protected $routeMiddleware = [ 54 | 'auth' => \App\Http\Middleware\Authenticate::class, 55 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 56 | 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, 57 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 58 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 59 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 60 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 61 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 62 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 63 | ]; 64 | 65 | /** 66 | * The priority-sorted list of middleware. 67 | * 68 | * This forces non-global middleware to always be in the given order. 69 | * 70 | * @var array 71 | */ 72 | protected $middlewarePriority = [ 73 | \Illuminate\Session\Middleware\StartSession::class, 74 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 75 | \App\Http\Middleware\Authenticate::class, 76 | \Illuminate\Session\Middleware\AuthenticateSession::class, 77 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 78 | \Illuminate\Auth\Middleware\Authorize::class, 79 | ]; 80 | } 81 | -------------------------------------------------------------------------------- /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 | ], 48 | ], 49 | 50 | /* 51 | |-------------------------------------------------------------------------- 52 | | User Providers 53 | |-------------------------------------------------------------------------- 54 | | 55 | | All authentication drivers have a user provider. This defines how the 56 | | users are actually retrieved out of your database or other storage 57 | | mechanisms used by this application to persist your user's data. 58 | | 59 | | If you have multiple user tables or models you may configure multiple 60 | | sources which represent each model / table. These sources may then 61 | | be assigned to any extra authentication guards you have defined. 62 | | 63 | | Supported: "database", "eloquent" 64 | | 65 | */ 66 | 67 | 'providers' => [ 68 | 'users' => [ 69 | 'driver' => 'eloquent', 70 | 'model' => App\User::class, 71 | ], 72 | 73 | // 'users' => [ 74 | // 'driver' => 'database', 75 | // 'table' => 'users', 76 | // ], 77 | ], 78 | 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Resetting Passwords 82 | |-------------------------------------------------------------------------- 83 | | 84 | | You may specify multiple password reset configurations if you have more 85 | | than one user table or model in the application and you want to have 86 | | separate password reset settings based on the specific user types. 87 | | 88 | | The expire time is the number of minutes that the reset token should be 89 | | considered valid. This security feature keeps tokens short-lived so 90 | | they have less time to be guessed. You may change this as needed. 91 | | 92 | */ 93 | 94 | 'passwords' => [ 95 | 'users' => [ 96 | 'provider' => 'users', 97 | 'table' => 'password_resets', 98 | 'expire' => 60, 99 | ], 100 | ], 101 | 102 | ]; 103 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Database Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here are each of the database connections setup for your application. 24 | | Of course, examples of configuring each database platform that is 25 | | supported by Laravel is shown below to make development simple. 26 | | 27 | | 28 | | All database work in Laravel is done through the PHP PDO facilities 29 | | so make sure you have the driver for your particular database of 30 | | choice installed on your machine before you begin development. 31 | | 32 | */ 33 | 34 | 'connections' => [ 35 | 36 | 'sqlite' => [ 37 | 'driver' => 'sqlite', 38 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 39 | 'prefix' => '', 40 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 41 | ], 42 | 43 | 'mysql' => [ 44 | 'driver' => 'mysql', 45 | 'host' => env('DB_HOST', '127.0.0.1'), 46 | 'port' => env('DB_PORT', '3306'), 47 | 'database' => env('DB_DATABASE', 'forge'), 48 | 'username' => env('DB_USERNAME', 'forge'), 49 | 'password' => env('DB_PASSWORD', ''), 50 | 'unix_socket' => env('DB_SOCKET', ''), 51 | 'charset' => 'utf8mb4', 52 | 'collation' => 'utf8mb4_unicode_ci', 53 | 'prefix' => '', 54 | 'prefix_indexes' => true, 55 | 'strict' => true, 56 | 'engine' => null, 57 | ], 58 | 59 | 'pgsql' => [ 60 | 'driver' => 'pgsql', 61 | 'host' => env('DB_HOST', '127.0.0.1'), 62 | 'port' => env('DB_PORT', '5432'), 63 | 'database' => env('DB_DATABASE', 'forge'), 64 | 'username' => env('DB_USERNAME', 'forge'), 65 | 'password' => env('DB_PASSWORD', ''), 66 | 'charset' => 'utf8', 67 | 'prefix' => '', 68 | 'prefix_indexes' => true, 69 | 'schema' => 'public', 70 | 'sslmode' => 'prefer', 71 | ], 72 | 73 | 'sqlsrv' => [ 74 | 'driver' => 'sqlsrv', 75 | 'host' => env('DB_HOST', 'localhost'), 76 | 'port' => env('DB_PORT', '1433'), 77 | 'database' => env('DB_DATABASE', 'forge'), 78 | 'username' => env('DB_USERNAME', 'forge'), 79 | 'password' => env('DB_PASSWORD', ''), 80 | 'charset' => 'utf8', 81 | 'prefix' => '', 82 | 'prefix_indexes' => true, 83 | ], 84 | 85 | ], 86 | 87 | /* 88 | |-------------------------------------------------------------------------- 89 | | Migration Repository Table 90 | |-------------------------------------------------------------------------- 91 | | 92 | | This table keeps track of all the migrations that have already run for 93 | | your application. Using this information, we can determine which of 94 | | the migrations on disk haven't actually been run in the database. 95 | | 96 | */ 97 | 98 | 'migrations' => 'migrations', 99 | 100 | /* 101 | |-------------------------------------------------------------------------- 102 | | Redis Databases 103 | |-------------------------------------------------------------------------- 104 | | 105 | | Redis is an open source, fast, and advanced key-value store that also 106 | | provides a richer body of commands than a typical key-value system 107 | | such as APC or Memcached. Laravel makes it easy to dig right in. 108 | | 109 | */ 110 | 111 | 'redis' => [ 112 | 113 | 'client' => 'predis', 114 | 115 | 'default' => [ 116 | 'host' => env('REDIS_HOST', '127.0.0.1'), 117 | 'password' => env('REDIS_PASSWORD', null), 118 | 'port' => env('REDIS_PORT', 6379), 119 | 'database' => env('REDIS_DB', 0), 120 | ], 121 | 122 | 'cache' => [ 123 | 'host' => env('REDIS_HOST', '127.0.0.1'), 124 | 'password' => env('REDIS_PASSWORD', null), 125 | 'port' => env('REDIS_PORT', 6379), 126 | 'database' => env('REDIS_CACHE_DB', 1), 127 | ], 128 | 129 | ], 130 | 131 | ]; 132 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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" or "memcached" session drivers, you may specify a 96 | | cache store that should be used for these sessions. This value must 97 | | correspond 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 | -------------------------------------------------------------------------------- /config/doctrine.php: -------------------------------------------------------------------------------- 1 | Warning: Proxy auto generation should only be enabled in dev! 21 | | 22 | */ 23 | 'managers' => [ 24 | 'default' => [ 25 | 'dev' => env('APP_DEBUG', false), 26 | 'meta' => env('DOCTRINE_METADATA', 'annotations'), 27 | 'connection' => env('DB_CONNECTION', 'mysql'), 28 | 'namespaces' => [], 29 | 'paths' => [ 30 | base_path('app/Domain') 31 | ], 32 | 'repository' => Doctrine\ORM\EntityRepository::class, 33 | 'proxies' => [ 34 | 'namespace' => false, 35 | 'path' => storage_path('proxies'), 36 | 'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false) 37 | ], 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Doctrine events 41 | |-------------------------------------------------------------------------- 42 | | 43 | | The listener array expects the key to be a Doctrine event 44 | | e.g. Doctrine\ORM\Events::onFlush 45 | | 46 | */ 47 | 'events' => [ 48 | 'listeners' => [], 49 | 'subscribers' => [] 50 | ], 51 | 'filters' => [], 52 | /* 53 | |-------------------------------------------------------------------------- 54 | | Doctrine mapping types 55 | |-------------------------------------------------------------------------- 56 | | 57 | | Link a Database Type to a Local Doctrine Type 58 | | 59 | | Using 'enum' => 'string' is the same of: 60 | | $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration, 61 | | \Doctrine\DBAL\Connection $connection, 62 | | \Doctrine\Common\EventManager $eventManager) { 63 | | $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); 64 | | }); 65 | | 66 | | References: 67 | | http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html 68 | | http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types 69 | | http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html 70 | | http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types 71 | | http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool 72 | |-------------------------------------------------------------------------- 73 | */ 74 | 'mapping_types' => [ 75 | //'enum' => 'string' 76 | ] 77 | ] 78 | ], 79 | /* 80 | |-------------------------------------------------------------------------- 81 | | Doctrine Extensions 82 | |-------------------------------------------------------------------------- 83 | | 84 | | Enable/disable Doctrine Extensions by adding or removing them from the list 85 | | 86 | | If you want to require custom extensions you will have to require 87 | | laravel-doctrine/extensions in your composer.json 88 | | 89 | */ 90 | 'extensions' => [ 91 | //LaravelDoctrine\ORM\Extensions\TablePrefix\TablePrefixExtension::class, 92 | //LaravelDoctrine\Extensions\Timestamps\TimestampableExtension::class, 93 | //LaravelDoctrine\Extensions\SoftDeletes\SoftDeleteableExtension::class, 94 | //LaravelDoctrine\Extensions\Sluggable\SluggableExtension::class, 95 | //LaravelDoctrine\Extensions\Sortable\SortableExtension::class, 96 | //LaravelDoctrine\Extensions\Tree\TreeExtension::class, 97 | //LaravelDoctrine\Extensions\Loggable\LoggableExtension::class, 98 | //LaravelDoctrine\Extensions\Blameable\BlameableExtension::class, 99 | //LaravelDoctrine\Extensions\IpTraceable\IpTraceableExtension::class, 100 | //LaravelDoctrine\Extensions\Translatable\TranslatableExtension::class 101 | ], 102 | /* 103 | |-------------------------------------------------------------------------- 104 | | Doctrine custom types 105 | |-------------------------------------------------------------------------- 106 | | 107 | | Create a custom or override a Doctrine Type 108 | |-------------------------------------------------------------------------- 109 | */ 110 | 'custom_types' => [ 111 | 'json' => LaravelDoctrine\ORM\Types\Json::class 112 | ], 113 | /* 114 | |-------------------------------------------------------------------------- 115 | | DQL custom datetime functions 116 | |-------------------------------------------------------------------------- 117 | */ 118 | 'custom_datetime_functions' => [], 119 | /* 120 | |-------------------------------------------------------------------------- 121 | | DQL custom numeric functions 122 | |-------------------------------------------------------------------------- 123 | */ 124 | 'custom_numeric_functions' => [], 125 | /* 126 | |-------------------------------------------------------------------------- 127 | | DQL custom string functions 128 | |-------------------------------------------------------------------------- 129 | */ 130 | 'custom_string_functions' => [], 131 | /* 132 | |-------------------------------------------------------------------------- 133 | | Register custom hydrators 134 | |-------------------------------------------------------------------------- 135 | */ 136 | 'custom_hydration_modes' => [ 137 | // e.g. 'hydrationModeName' => MyHydrator::class, 138 | ], 139 | /* 140 | |-------------------------------------------------------------------------- 141 | | Enable query logging with laravel file logging, 142 | | debugbar, clockwork or an own implementation. 143 | | Setting it to false, will disable logging 144 | | 145 | | Available: 146 | | - LaravelDoctrine\ORM\Loggers\LaravelDebugbarLogger 147 | | - LaravelDoctrine\ORM\Loggers\ClockworkLogger 148 | | - LaravelDoctrine\ORM\Loggers\FileLogger 149 | |-------------------------------------------------------------------------- 150 | */ 151 | 'logger' => env('DOCTRINE_LOGGER', false), 152 | /* 153 | |-------------------------------------------------------------------------- 154 | | Cache 155 | |-------------------------------------------------------------------------- 156 | | 157 | | Configure meta-data, query and result caching here. 158 | | Optionally you can enable second level caching. 159 | | 160 | | Available: apc|array|file|memcached|redis|void 161 | | 162 | */ 163 | 'cache' => [ 164 | 'second_level' => false, 165 | 'default' => env('DOCTRINE_CACHE', 'array'), 166 | 'namespace' => null, 167 | 'metadata' => [ 168 | 'driver' => env('DOCTRINE_METADATA_CACHE', env('DOCTRINE_CACHE', 'array')), 169 | 'namespace' => null, 170 | ], 171 | 'query' => [ 172 | 'driver' => env('DOCTRINE_QUERY_CACHE', env('DOCTRINE_CACHE', 'array')), 173 | 'namespace' => null, 174 | ], 175 | 'result' => [ 176 | 'driver' => env('DOCTRINE_RESULT_CACHE', env('DOCTRINE_CACHE', 'array')), 177 | 'namespace' => null, 178 | ], 179 | ], 180 | /* 181 | |-------------------------------------------------------------------------- 182 | | Gedmo extensions 183 | |-------------------------------------------------------------------------- 184 | | 185 | | Settings for Gedmo extensions 186 | | If you want to use this you will have to require 187 | | laravel-doctrine/extensions in your composer.json 188 | | 189 | */ 190 | 'gedmo' => [ 191 | 'all_mappings' => false 192 | ], 193 | /* 194 | |-------------------------------------------------------------------------- 195 | | Validation 196 | |-------------------------------------------------------------------------- 197 | | 198 | | Enables the Doctrine Presence Verifier for Validation 199 | | 200 | */ 201 | 'doctrine_presence_verifier' => true, 202 | 203 | /* 204 | |-------------------------------------------------------------------------- 205 | | Notifications 206 | |-------------------------------------------------------------------------- 207 | | 208 | | Doctrine notifications channel 209 | | 210 | */ 211 | 'notifications' => [ 212 | 'channel' => 'database' 213 | ] 214 | ]; 215 | -------------------------------------------------------------------------------- /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 | 'Artisan' => Illuminate\Support\Facades\Artisan::class, 195 | 'Auth' => Illuminate\Support\Facades\Auth::class, 196 | 'Blade' => Illuminate\Support\Facades\Blade::class, 197 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, 198 | 'Bus' => Illuminate\Support\Facades\Bus::class, 199 | 'Cache' => Illuminate\Support\Facades\Cache::class, 200 | 'Config' => Illuminate\Support\Facades\Config::class, 201 | 'Cookie' => Illuminate\Support\Facades\Cookie::class, 202 | 'Crypt' => Illuminate\Support\Facades\Crypt::class, 203 | 'DB' => Illuminate\Support\Facades\DB::class, 204 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 205 | 'Event' => Illuminate\Support\Facades\Event::class, 206 | 'File' => Illuminate\Support\Facades\File::class, 207 | 'Gate' => Illuminate\Support\Facades\Gate::class, 208 | 'Hash' => Illuminate\Support\Facades\Hash::class, 209 | 'Lang' => Illuminate\Support\Facades\Lang::class, 210 | 'Log' => Illuminate\Support\Facades\Log::class, 211 | 'Mail' => Illuminate\Support\Facades\Mail::class, 212 | 'Notification' => Illuminate\Support\Facades\Notification::class, 213 | 'Password' => Illuminate\Support\Facades\Password::class, 214 | 'Queue' => Illuminate\Support\Facades\Queue::class, 215 | 'Redirect' => Illuminate\Support\Facades\Redirect::class, 216 | 'Redis' => Illuminate\Support\Facades\Redis::class, 217 | 'Request' => Illuminate\Support\Facades\Request::class, 218 | 'Response' => Illuminate\Support\Facades\Response::class, 219 | 'Route' => Illuminate\Support\Facades\Route::class, 220 | 'Schema' => Illuminate\Support\Facades\Schema::class, 221 | 'Session' => Illuminate\Support\Facades\Session::class, 222 | 'Storage' => Illuminate\Support\Facades\Storage::class, 223 | 'URL' => Illuminate\Support\Facades\URL::class, 224 | 'Validator' => Illuminate\Support\Facades\Validator::class, 225 | 'View' => Illuminate\Support\Facades\View::class, 226 | 227 | ], 228 | 229 | ]; 230 | --------------------------------------------------------------------------------