├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── .styleci.yml ├── README.md ├── app ├── Actions │ └── Fortify │ │ ├── CreateNewUser.php │ │ ├── PasswordValidationRules.php │ │ ├── ResetUserPassword.php │ │ ├── UpdateUserPassword.php │ │ └── UpdateUserProfileInformation.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php ├── Http │ ├── Controllers │ │ ├── AuthController.php │ │ ├── Controller.php │ │ ├── ImageController.php │ │ ├── LandingPageController.php │ │ ├── LandingPageDraftController.php │ │ ├── PageBuilderController.php │ │ └── PublicLandingPageController.php │ ├── Kernel.php │ ├── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── SimulateNetworkDelay.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ └── VerifyCsrfToken.php │ ├── Requests │ │ ├── ImageUploadApiRequest.php │ │ └── LandingPageApiRequest.php │ └── Resources │ │ ├── AccountResource.php │ │ ├── ImageResource.php │ │ ├── LandingPageResource.php │ │ └── UserResource.php ├── Models │ ├── Account.php │ ├── Concerns │ │ └── HasUUID.php │ ├── Image.php │ ├── LandingPage.php │ └── User.php ├── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ ├── FortifyServiceProvider.php │ ├── RouteServiceProvider.php │ └── TelescopeServiceProvider.php └── helpers.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── filesystems.php ├── fortify.php ├── hashing.php ├── logging.php ├── mail.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php ├── telescope.php └── view.php ├── database ├── .gitignore ├── factories │ ├── AccountFactory.php │ ├── LandingPageFactory.php │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2022_01_22_061226_create_accounts_table.php │ ├── 2022_01_23_213543_create_landing_pages_table.php │ └── 2022_01_23_214153_create_images_table.php └── seeders │ └── DatabaseSeeder.php ├── docker-compose.yml ├── package-lock.json ├── package.json ├── phpstan.neon ├── phpunit.xml ├── public ├── .htaccess ├── css │ └── app.css ├── favicon.ico ├── index.php ├── js │ └── app.js ├── mix-manifest.json ├── robots.txt └── vendor │ └── telescope │ ├── app-dark.css │ ├── app.css │ ├── app.js │ ├── favicon.ico │ └── mix-manifest.json ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php └── views │ └── welcome.blade.php ├── routes ├── api │ ├── v1.php │ └── v2.php ├── channels.php └── console.php ├── server.php ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tests ├── CreatesApplication.php ├── Feature │ ├── ImageTest.php │ └── LandingPageTest.php ├── TestCase.php └── Unit │ └── ExampleTest.php └── webpack.mix.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=mysql 13 | DB_PORT=3306 14 | DB_DATABASE=pagebuilder 15 | DB_USERNAME=sail 16 | DB_PASSWORD=password 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DRIVER=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailhog 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS=null 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_APP_CLUSTER=mt1 50 | 51 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 52 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 53 | 54 | SANCTUM_STATEFUL_DOMAINS=localhost:3000 55 | SESSION_DOMAIN=localhost 56 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.css linguist-vendored 3 | *.scss linguist-vendored 4 | *.js linguist-vendored 5 | CHANGELOG.md export-ignore 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/hot 3 | /public/storage 4 | /storage/*.key 5 | /vendor 6 | .env 7 | .env.backup 8 | .phpunit.result.cache 9 | docker-compose.override.yml 10 | Homestead.json 11 | Homestead.yaml 12 | npm-debug.log 13 | yarn-error.log 14 | /.idea 15 | /.vscode 16 | _ide_helper_models.php 17 | _ide_helper.php -------------------------------------------------------------------------------- /.styleci.yml: -------------------------------------------------------------------------------- 1 | php: 2 | preset: laravel 3 | version: 8 4 | disabled: 5 | - no_unused_imports 6 | finder: 7 | not-name: 8 | - index.php 9 | - server.php 10 | js: 11 | finder: 12 | not-name: 13 | - webpack.mix.js 14 | css: true 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EZ Landing Page Builder 2 | 3 | ## The app 4 | 5 | Simple web app to easily create landing pages by dragging and dropping prebuilt blocks. 6 | 7 | Each block makes available a set of options to easily customize its content. 8 | 9 | Users don't need to write a single line of code. 10 | 11 | ## Video demo (click to go to YouTube) 12 | 13 | [![YouTube Demo Video](https://img.youtube.com/vi/4MfJ4UAkQjg/0.jpg)](https://www.youtube.com/watch?v=4MfJ4UAkQjg) 14 | 15 | ## The stack 16 | 17 | ### Frontend 18 | 19 | 1. [Vue.js 3](https://v3.vuejs.org/) + [Vuex 4](https://vuex.vuejs.org/) + [Vue Router 4](https://router.vuejs.org/) 20 | 2. [Vite.js](https://vitejs.dev/) 21 | 3. [Tailwind CSS 3](https://tailwindcss.com/) + [Daisy UI](https://daisyui.com/) 22 | 5. [Sortable.js](https://github.com/SortableJS/vue.draggable.next) 23 | 24 | ### Backend 25 | 26 | 1. [Laravel 8](https://laravel.com/docs/8.x) 27 | 2. [Laravel Sail](https://laravel.com/docs/8.x/sail) 28 | 3. [Laravel Sanctum](https://laravel.com/docs/8.x/sanctum) 29 | 4. [Laravel Fortify](https://laravel.com/docs/8.x/fortify) 30 | 31 | ## Setting up the backend 32 | 33 | 1. Clone the repo and navigate to the directory 34 | ``` 35 | git clone git@github.com:isaac-souza/pagebuilder-laravel.git 36 | cd pagebuilder-laravel 37 | ``` 38 | 2. Copy the sample .env file 39 | ``` 40 | cp .env.example .env 41 | ``` 42 | 3. Install the dependencies (requires at least PHP 8.0) 43 | ``` 44 | composer install 45 | ``` 46 | 4. Start Laravel Sail (needs Docker installed in your system) 47 | ``` 48 | vendor/bin/sail up 49 | ``` 50 | 5. Generate key, run the migrations and link the storage folder 51 | ``` 52 | vendor/bin/sail artisan key:generate 53 | vendor/bin/sail artisan migrate --seed 54 | vendor/bin/sail artisan storage:link 55 | ``` 56 | 6. Run the tests 57 | ``` 58 | vendor/bin/sail artisan test 59 | ``` 60 | 7. The backend should be available at 61 | ``` 62 | http://localhost 63 | ``` 64 | 65 | ## Setting up the frontend 66 | 67 | 1. Clone the repo and navigate to the directory 68 | ``` 69 | git clone git@github.com:isaac-souza/pagebuilder-vue3.git 70 | cd pagebuilder-vue3 71 | ``` 72 | 2. Install the dependencies 73 | ``` 74 | npm install 75 | ``` 76 | 3. Copy the sample .env file 77 | ``` 78 | cp .env.example .env 79 | ``` 80 | 4. Start the dev server 81 | ``` 82 | npm run dev 83 | ``` 84 | 5. The frontend should be available at 85 | ``` 86 | http://localhost:3000 87 | ``` 88 | 89 | ## Testing 90 | 91 | Now you should be able to go to http://localhost:3000, access the login page and sign in into the app 92 | 93 | ## My development environment 94 | 95 | OS: 96 | ``` 97 | No LSB modules are available. 98 | Distributor ID: Ubuntu 99 | Description: Ubuntu 18.04.6 LTS 100 | Release: 18.04 101 | Codename: bionic 102 | ``` 103 | 104 | Docker: 105 | ``` 106 | Docker version 20.10.12, build e91ed57 107 | ``` 108 | 109 | Docker-compose: 110 | ``` 111 | docker-compose version 1.29.2, build 5becea4c 112 | ``` 113 | 114 | PHP: 115 | ``` 116 | PHP 8.0.15 (cli) (built: Jan 29 2022 07:24:35) ( NTS ) 117 | Copyright (c) The PHP Group 118 | Zend Engine v4.0.15, Copyright (c) Zend Technologies 119 | with Zend OPcache v8.0.15, Copyright (c), by Zend Technologies 120 | ``` 121 | Composer 122 | ``` 123 | Composer version 2.1.6 2021-08-19 17:11:08 124 | ``` 125 | Node 126 | ``` 127 | v14.19.0 128 | ``` 129 | NPM 130 | ``` 131 | 6.14.16 132 | ``` -------------------------------------------------------------------------------- /app/Actions/Fortify/CreateNewUser.php: -------------------------------------------------------------------------------- 1 | ['required', 'string', 'max:255'], 28 | 'email' => [ 29 | 'required', 30 | 'string', 31 | 'email', 32 | 'max:255', 33 | Rule::unique(User::class), 34 | ], 35 | 'slug' => 'required|unique:accounts,slug', 36 | 'password' => $this->passwordRules(), 37 | ])->validate(); 38 | 39 | $user = User::create([ 40 | 'name' => $input['name'], 41 | 'email' => $input['email'], 42 | 'password' => Hash::make($input['password']), 43 | ]); 44 | 45 | $user->account()->create([ 46 | 'slug' => Str::slug($input['name']), 47 | ]); 48 | 49 | return $user; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/Actions/Fortify/PasswordValidationRules.php: -------------------------------------------------------------------------------- 1 | $this->passwordRules(), 24 | ])->validate(); 25 | 26 | $user->forceFill([ 27 | 'password' => Hash::make($input['password']), 28 | ])->save(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Actions/Fortify/UpdateUserPassword.php: -------------------------------------------------------------------------------- 1 | ['required', 'string'], 24 | 'password' => $this->passwordRules(), 25 | ])->after(function ($validator) use ($user, $input) { 26 | if (! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) { 27 | $validator->errors()->add('current_password', __('The provided password does not match your current password.')); 28 | } 29 | })->validateWithBag('updatePassword'); 30 | 31 | $user->forceFill([ 32 | 'password' => Hash::make($input['password']), 33 | ])->save(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/Actions/Fortify/UpdateUserProfileInformation.php: -------------------------------------------------------------------------------- 1 | ['required', 'string', 'max:255'], 23 | 24 | 'email' => [ 25 | 'required', 26 | 'string', 27 | 'email', 28 | 'max:255', 29 | Rule::unique('users')->ignore($user->id), 30 | ], 31 | ])->validateWithBag('updateProfileInformation'); 32 | 33 | if ($input['email'] !== $user->email && 34 | $user instanceof MustVerifyEmail) { 35 | $this->updateVerifiedUser($user, $input); 36 | } else { 37 | $user->forceFill([ 38 | 'name' => $input['name'], 39 | 'email' => $input['email'], 40 | ])->save(); 41 | } 42 | } 43 | 44 | /** 45 | * Update the given verified user's profile information. 46 | * 47 | * @param mixed $user 48 | * @param array $input 49 | * @return void 50 | */ 51 | protected function updateVerifiedUser($user, array $input) 52 | { 53 | $user->forceFill([ 54 | 'name' => $input['name'], 55 | 'email' => $input['email'], 56 | 'email_verified_at' => null, 57 | ])->save(); 58 | 59 | $user->sendEmailVerificationNotification(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | > 14 | */ 15 | protected $dontReport = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the inputs that are never flashed for validation exceptions. 21 | * 22 | * @var array 23 | */ 24 | protected $dontFlash = [ 25 | 'current_password', 26 | 'password', 27 | 'password_confirmation', 28 | ]; 29 | 30 | /** 31 | * Register the exception handling callbacks for the application. 32 | * 33 | * @return void 34 | */ 35 | public function register() 36 | { 37 | $this->reportable(function (Throwable $e) { 38 | // 39 | }); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/Http/Controllers/AuthController.php: -------------------------------------------------------------------------------- 1 | json(['authenticated' => false], Response::HTTP_OK); 15 | } 16 | 17 | return response()->json(['authenticated' => true], Response::HTTP_OK); 18 | } 19 | 20 | public function account() 21 | { 22 | return new AccountResource(account()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | images); 19 | } 20 | 21 | public function store(ImageUploadApiRequest $request) 22 | { 23 | try 24 | { 25 | DB::beginTransaction(); 26 | 27 | $uuid = uuid(); 28 | $account = account(); 29 | $extension = $request->file->extension(); 30 | $filename = $request->file->getClientOriginalName(); 31 | $folder = "files/{$account->uuid}/images"; 32 | 33 | $image = $account->images()->create([ 34 | 'uuid' => $uuid, 35 | 'filename' => $filename, 36 | 'extension' => $extension, 37 | 'path' => "{$folder}/{$uuid}.{$extension}", 38 | 'thumb_path' => "{$folder}/thumb-{$uuid}.{$extension}", 39 | ]); 40 | 41 | Storage::disk('public')->putFileAs($folder, $request->file, "{$uuid}.{$extension}"); 42 | 43 | /** @var \Intervention\Image\Image $thumb */ 44 | $thumb = InterventionImage::make($request->file) 45 | ->resize(150, 150, function (Constraint $constraint) { 46 | $constraint->aspectRatio(); 47 | $constraint->upsize(); 48 | }) 49 | ->encode($extension, 90); 50 | 51 | Storage::disk('public')->put($folder . "/thumb-{$uuid}.{$extension}", $thumb); 52 | 53 | DB::commit(); 54 | 55 | return response()->json(new ImageResource($image), Response::HTTP_CREATED); 56 | } 57 | catch (\Throwable $th) 58 | { 59 | DB::rollBack(); 60 | return response()->json(['error' => $th->getMessage()], Response::HTTP_INTERNAL_SERVER_ERROR); 61 | } 62 | } 63 | 64 | public function destroy(string $uuid) 65 | { 66 | $image = Image::where('account_uuid', account()->uuid)->where('uuid', $uuid)->first(); 67 | 68 | if(is_null($image)) 69 | { 70 | return response()->json([], Response::HTTP_NOT_FOUND); 71 | } 72 | 73 | if(account()->uuid != $image->account_uuid) 74 | { 75 | return response()->json([], Response::HTTP_UNAUTHORIZED); 76 | } 77 | 78 | try 79 | { 80 | DB::beginTransaction(); 81 | 82 | Storage::disk('public')->delete($image->path); 83 | Storage::disk('public')->delete($image->thumb_path); 84 | 85 | $image->delete(); 86 | 87 | DB::commit(); 88 | 89 | return response()->json([], Response::HTTP_NO_CONTENT); 90 | } 91 | catch (\Throwable $th) 92 | { 93 | DB::rollBack(); 94 | return response()->json([], Response::HTTP_INTERNAL_SERVER_ERROR); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/Http/Controllers/LandingPageController.php: -------------------------------------------------------------------------------- 1 | landingPages); 16 | } 17 | 18 | public function store(LandingPageApiRequest $request) 19 | { 20 | $landingPage = account()->landingPages()->create(array_merge( 21 | $request->validated(), 22 | [ 23 | 'type' => 'sales', 24 | 'pages' => [ 25 | 'main' => [], 26 | 'thanks' => [], 27 | ], 28 | 'draft' => [ 29 | 'main' => [], 30 | 'thanks' => [], 31 | ], 32 | ] 33 | )); 34 | 35 | return new LandingPageResource($landingPage); 36 | } 37 | 38 | public function show($uuid) 39 | { 40 | $landingPage = LandingPage::find($uuid); 41 | 42 | if(is_null($landingPage)) 43 | { 44 | return response()->json([], Response::HTTP_NOT_FOUND); 45 | } 46 | 47 | return new LandingPageResource($landingPage); 48 | } 49 | 50 | public function update(Request $request, $uuid) 51 | { 52 | $landingPage = LandingPage::find($uuid); 53 | 54 | if(is_null($landingPage)) 55 | { 56 | return response()->json([], Response::HTTP_NOT_FOUND); 57 | } 58 | 59 | $landingPage->update([ 60 | 'pages' => ['main' => $request->pages, 'thanks' => []], 61 | 'draft' => ['main' => $request->pages, 'thanks' => []], 62 | ]); 63 | 64 | return new LandingPageResource($landingPage->refresh()); 65 | } 66 | 67 | public function destroy($uuid) 68 | { 69 | $landingPage = LandingPage::find($uuid); 70 | 71 | if(is_null($landingPage)) 72 | { 73 | return response()->json([], Response::HTTP_NOT_FOUND); 74 | } 75 | 76 | if($landingPage->account_uuid != account()->uuid) 77 | { 78 | return response()->json([], Response::HTTP_NOT_FOUND); 79 | } 80 | 81 | $landingPage->delete(); 82 | 83 | return response()->json([], Response::HTTP_NO_CONTENT); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /app/Http/Controllers/LandingPageDraftController.php: -------------------------------------------------------------------------------- 1 | json([], Response::HTTP_NOT_FOUND); 19 | } 20 | 21 | $landingPage->update([ 22 | 'draft' => ['main' => $request->pages], 23 | ]); 24 | 25 | return new LandingPageResource($landingPage->refresh()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Http/Controllers/PageBuilderController.php: -------------------------------------------------------------------------------- 1 | first(); 14 | 15 | if(is_null($landingPage)) 16 | { 17 | return response()->json([], Response::HTTP_NOT_FOUND); 18 | } 19 | 20 | return new LandingPageResource($landingPage->refresh()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Fruitcake\Cors\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | // \Illuminate\Session\Middleware\AuthenticateSession::class, 37 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 38 | \App\Http\Middleware\VerifyCsrfToken::class, 39 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 40 | ], 41 | 42 | 'api' => [ 43 | \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 44 | // 'throttle:api', 45 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 46 | ], 47 | ]; 48 | 49 | /** 50 | * The application's route middleware. 51 | * 52 | * These middleware may be assigned to groups or used individually. 53 | * 54 | * @var array 55 | */ 56 | protected $routeMiddleware = [ 57 | 'auth' => \App\Http\Middleware\Authenticate::class, 58 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 63 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 64 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 65 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 66 | 'simulate.network.delay' => \App\Http\Middleware\SimulateNetworkDelay::class 67 | ]; 68 | } 69 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) 26 | { 27 | if ($request->expectsJson()) 28 | { 29 | return response()->json(['error' => 'Already authenticated.'], 200); 30 | } 31 | 32 | return redirect(RouteServiceProvider::HOME); 33 | } 34 | } 35 | 36 | return $next($request); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/Http/Middleware/SimulateNetworkDelay.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Requests/ImageUploadApiRequest.php: -------------------------------------------------------------------------------- 1 | json([ 14 | 'success' => false, 15 | 'message' => 'Validation errors', 16 | 'data' => $validator->errors() 17 | ], 422)); 18 | } 19 | 20 | public function authorize() 21 | { 22 | return true; 23 | } 24 | 25 | public function rules() 26 | { 27 | return [ 28 | 'file' => 'required|file|max:5120|mimes:jpg,jpeg,png', 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Http/Requests/LandingPageApiRequest.php: -------------------------------------------------------------------------------- 1 | json([ 15 | 'success' => false, 16 | 'message' => 'Validation errors', 17 | 'data' => $validator->errors() 18 | ], 422)); 19 | } 20 | 21 | protected function prepareForValidation() 22 | { 23 | $this->merge([ 24 | 'slug' => Str::slug($this->name), 25 | ]); 26 | } 27 | 28 | public function authorize() 29 | { 30 | return true; 31 | } 32 | 33 | public function rules() 34 | { 35 | return [ 36 | 'name' => 'required|string|max:255', 37 | 'slug' => 'required|string|unique:landing_pages,slug' 38 | ]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Http/Resources/AccountResource.php: -------------------------------------------------------------------------------- 1 | $this->uuid, 20 | 'filename' => $this->filename, 21 | 'url' => Storage::disk('public')->url($this->path), 22 | 'thumbUrl' => Storage::disk('public')->url($this->thumb_path), 23 | ]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/Http/Resources/LandingPageResource.php: -------------------------------------------------------------------------------- 1 | $this->uuid, 13 | 'name' => $this->name, 14 | 'slug' => $this->slug, 15 | 'pages' => $this->pages, 16 | 'draft' => $this->draft, 17 | ]; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Resources/UserResource.php: -------------------------------------------------------------------------------- 1 | hasMany(LandingPage::class); 29 | } 30 | 31 | public function user() 32 | { 33 | return $this->belongsTo(User::class); 34 | } 35 | 36 | public function images() 37 | { 38 | return $this->hasMany(Image::class); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /app/Models/Concerns/HasUUID.php: -------------------------------------------------------------------------------- 1 | uuid = Str::uuid(); 15 | }); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/Models/Image.php: -------------------------------------------------------------------------------- 1 | 'array', 31 | 'draft' => 'array', 32 | ]; 33 | 34 | public function account() 35 | { 36 | return $this->belongsTo(Account::class); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 28 | */ 29 | protected $fillable = [ 30 | 'name', 31 | 'email', 32 | 'password', 33 | ]; 34 | 35 | /** 36 | * The attributes that should be hidden for serialization. 37 | * 38 | * @var array 39 | */ 40 | protected $hidden = [ 41 | 'password', 42 | 'remember_token', 43 | ]; 44 | 45 | /** 46 | * The attributes that should be cast. 47 | * 48 | * @var array 49 | */ 50 | protected $casts = [ 51 | 'email_verified_at' => 'datetime', 52 | ]; 53 | 54 | public function account() 55 | { 56 | return $this->hasOne(Account::class); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->singleton(LandingPageRepositoryInterface::class, function() { 20 | return new LandingPageRepositoryCacheDecorator(new LandingPageRepository); 21 | }); 22 | } 23 | 24 | /** 25 | * Bootstrap any application services. 26 | * 27 | * @return void 28 | */ 29 | public function boot() 30 | { 31 | // 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/Providers/AuthServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Providers/FortifyServiceProvider.php: -------------------------------------------------------------------------------- 1 | email; 41 | 42 | // return Limit::perMinute(5)->by($email.$request->ip()); 43 | // }); 44 | 45 | // RateLimiter::for('two-factor', function (Request $request) { 46 | // return Limit::perMinute(5)->by($request->session()->get('login.id')); 47 | // }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 39 | 40 | $this->routes(function () { 41 | Route::prefix('v1') 42 | ->middleware('api') 43 | ->group(base_path('routes/api/v1.php')); 44 | 45 | Route::prefix('v2') 46 | ->middleware('api') 47 | ->group(base_path('routes/api/v2.php')); 48 | }); 49 | } 50 | 51 | /** 52 | * Configure the rate limiters for the application. 53 | * 54 | * @return void 55 | */ 56 | protected function configureRateLimiting() 57 | { 58 | // RateLimiter::for('api', function (Request $request) { 59 | // return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()); 60 | // }); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/Providers/TelescopeServiceProvider.php: -------------------------------------------------------------------------------- 1 | hideSensitiveRequestDetails(); 22 | 23 | Telescope::filter(function (IncomingEntry $entry) { 24 | if ($this->app->environment('local')) { 25 | return true; 26 | } 27 | 28 | return $entry->isReportableException() || 29 | $entry->isFailedRequest() || 30 | $entry->isFailedJob() || 31 | $entry->isScheduledTask() || 32 | $entry->hasMonitoredTag(); 33 | }); 34 | } 35 | 36 | /** 37 | * Prevent sensitive request details from being logged by Telescope. 38 | * 39 | * @return void 40 | */ 41 | protected function hideSensitiveRequestDetails() 42 | { 43 | if ($this->app->environment('local')) { 44 | return; 45 | } 46 | 47 | Telescope::hideRequestParameters(['_token']); 48 | 49 | Telescope::hideRequestHeaders([ 50 | 'cookie', 51 | 'x-csrf-token', 52 | 'x-xsrf-token', 53 | ]); 54 | } 55 | 56 | /** 57 | * Register the Telescope gate. 58 | * 59 | * This gate determines who can access Telescope in non-local environments. 60 | * 61 | * @return void 62 | */ 63 | protected function gate() 64 | { 65 | Gate::define('viewTelescope', function ($user) { 66 | return in_array($user->email, [ 67 | // 68 | ]); 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/helpers.php: -------------------------------------------------------------------------------- 1 | user(); 20 | 21 | return $user; 22 | } 23 | } 24 | 25 | if (! function_exists('account')) 26 | { 27 | /** 28 | * Returns the current logged in user's account 29 | * 30 | * @return \App\Models\Account|null 31 | * */ 32 | function account(): Account|null 33 | { 34 | /** @var \App\Models\Account|null $account */ 35 | $account = auth()->user()->account; 36 | 37 | return $account; 38 | } 39 | } 40 | 41 | if (! function_exists('uuid')) 42 | { 43 | /** 44 | * Generated a new UUID v4 45 | * 46 | * @return string 47 | * */ 48 | function uuid(): string 49 | { 50 | return (string) Str::uuid(); 51 | } 52 | } 53 | 54 | if (! function_exists('getImageUrlFromUuid')) 55 | { 56 | /** 57 | * Generated a new UUID v4 58 | * 59 | * @return string 60 | * */ 61 | function getImageUrlFromUuid(string|null $uuid): string 62 | { 63 | return Storage::disk('public')->url(Image::find($uuid)?->path); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": ["framework", "laravel"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^7.3|^8.0", 9 | "barryvdh/laravel-ide-helper": "^2.12", 10 | "fruitcake/laravel-cors": "^2.0", 11 | "guzzlehttp/guzzle": "^7.0.1", 12 | "intervention/image": "^2.7", 13 | "laravel/fortify": "^1.9", 14 | "laravel/framework": "^8.75", 15 | "laravel/sanctum": "^2.11", 16 | "laravel/telescope": "^4.7", 17 | "laravel/tinker": "^2.5", 18 | "nunomaduro/larastan": "^1.0" 19 | }, 20 | "require-dev": { 21 | "facade/ignition": "^2.5", 22 | "fakerphp/faker": "^1.9.1", 23 | "laravel/sail": "^1.0.1", 24 | "mockery/mockery": "^1.4.4", 25 | "nunomaduro/collision": "^5.10", 26 | "phpunit/phpunit": "^9.5.10" 27 | }, 28 | "autoload": { 29 | "psr-4": { 30 | "App\\": "app/", 31 | "Database\\Factories\\": "database/factories/", 32 | "Database\\Seeders\\": "database/seeders/" 33 | }, 34 | "files": [ 35 | "app/helpers.php" 36 | ] 37 | }, 38 | "autoload-dev": { 39 | "psr-4": { 40 | "Tests\\": "tests/" 41 | } 42 | }, 43 | "scripts": { 44 | "post-autoload-dump": [ 45 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 46 | "@php artisan package:discover --ansi" 47 | ], 48 | "post-update-cmd": [ 49 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 50 | ], 51 | "post-root-package-install": [ 52 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 53 | ], 54 | "post-create-project-cmd": [ 55 | "@php artisan key:generate --ansi" 56 | ] 57 | }, 58 | "extra": { 59 | "laravel": { 60 | "dont-discover": [] 61 | } 62 | }, 63 | "config": { 64 | "optimize-autoloader": true, 65 | "preferred-install": "dist", 66 | "sort-packages": true 67 | }, 68 | "minimum-stability": "dev", 69 | "prefer-stable": true 70 | } 71 | -------------------------------------------------------------------------------- /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' => (bool) 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 | App\Providers\TelescopeServiceProvider::class, 178 | App\Providers\FortifyServiceProvider::class, 179 | 180 | ], 181 | 182 | /* 183 | |-------------------------------------------------------------------------- 184 | | Class Aliases 185 | |-------------------------------------------------------------------------- 186 | | 187 | | This array of class aliases will be registered when this application 188 | | is started. However, feel free to register as many as you wish as 189 | | the aliases are "lazy" loaded so they don't hinder performance. 190 | | 191 | */ 192 | 193 | 'aliases' => [ 194 | 195 | 'App' => Illuminate\Support\Facades\App::class, 196 | 'Arr' => Illuminate\Support\Arr::class, 197 | 'Artisan' => Illuminate\Support\Facades\Artisan::class, 198 | 'Auth' => Illuminate\Support\Facades\Auth::class, 199 | 'Blade' => Illuminate\Support\Facades\Blade::class, 200 | 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, 201 | 'Bus' => Illuminate\Support\Facades\Bus::class, 202 | 'Cache' => Illuminate\Support\Facades\Cache::class, 203 | 'Config' => Illuminate\Support\Facades\Config::class, 204 | 'Cookie' => Illuminate\Support\Facades\Cookie::class, 205 | 'Crypt' => Illuminate\Support\Facades\Crypt::class, 206 | 'Date' => Illuminate\Support\Facades\Date::class, 207 | 'DB' => Illuminate\Support\Facades\DB::class, 208 | 'Eloquent' => Illuminate\Database\Eloquent\Model::class, 209 | 'Event' => Illuminate\Support\Facades\Event::class, 210 | 'File' => Illuminate\Support\Facades\File::class, 211 | 'Gate' => Illuminate\Support\Facades\Gate::class, 212 | 'Hash' => Illuminate\Support\Facades\Hash::class, 213 | 'Http' => Illuminate\Support\Facades\Http::class, 214 | 'Js' => Illuminate\Support\Js::class, 215 | 'Lang' => Illuminate\Support\Facades\Lang::class, 216 | 'Log' => Illuminate\Support\Facades\Log::class, 217 | 'Mail' => Illuminate\Support\Facades\Mail::class, 218 | 'Notification' => Illuminate\Support\Facades\Notification::class, 219 | 'Password' => Illuminate\Support\Facades\Password::class, 220 | 'Queue' => Illuminate\Support\Facades\Queue::class, 221 | 'RateLimiter' => Illuminate\Support\Facades\RateLimiter::class, 222 | 'Redirect' => Illuminate\Support\Facades\Redirect::class, 223 | // 'Redis' => Illuminate\Support\Facades\Redis::class, 224 | 'Request' => Illuminate\Support\Facades\Request::class, 225 | 'Response' => Illuminate\Support\Facades\Response::class, 226 | 'Route' => Illuminate\Support\Facades\Route::class, 227 | 'Schema' => Illuminate\Support\Facades\Schema::class, 228 | 'Session' => Illuminate\Support\Facades\Session::class, 229 | 'Storage' => Illuminate\Support\Facades\Storage::class, 230 | 'Str' => Illuminate\Support\Str::class, 231 | 'URL' => Illuminate\Support\Facades\URL::class, 232 | 'Validator' => Illuminate\Support\Facades\Validator::class, 233 | 'View' => Illuminate\Support\Facades\View::class, 234 | 235 | ], 236 | 237 | ]; 238 | -------------------------------------------------------------------------------- /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" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | ], 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | User Providers 48 | |-------------------------------------------------------------------------- 49 | | 50 | | All authentication drivers have a user provider. This defines how the 51 | | users are actually retrieved out of your database or other storage 52 | | mechanisms used by this application to persist your user's data. 53 | | 54 | | If you have multiple user tables or models you may configure multiple 55 | | sources which represent each model / table. These sources may then 56 | | be assigned to any extra authentication guards you have defined. 57 | | 58 | | Supported: "database", "eloquent" 59 | | 60 | */ 61 | 62 | 'providers' => [ 63 | 'users' => [ 64 | 'driver' => 'eloquent', 65 | 'model' => App\Models\User::class, 66 | ], 67 | 68 | // 'users' => [ 69 | // 'driver' => 'database', 70 | // 'table' => 'users', 71 | // ], 72 | ], 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Resetting Passwords 77 | |-------------------------------------------------------------------------- 78 | | 79 | | You may specify multiple password reset configurations if you have more 80 | | than one user table or model in the application and you want to have 81 | | separate password reset settings based on the specific user types. 82 | | 83 | | The expire time is the number of minutes that the reset token should be 84 | | considered valid. This security feature keeps tokens short-lived so 85 | | they have less time to be guessed. You may change this as needed. 86 | | 87 | */ 88 | 89 | 'passwords' => [ 90 | 'users' => [ 91 | 'provider' => 'users', 92 | 'table' => 'password_resets', 93 | 'expire' => 60, 94 | 'throttle' => 60, 95 | ], 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Password Confirmation Timeout 101 | |-------------------------------------------------------------------------- 102 | | 103 | | Here you may define the amount of seconds before a password confirmation 104 | | times out and the user is prompted to re-enter their password via the 105 | | confirmation screen. By default, the timeout lasts for three hours. 106 | | 107 | */ 108 | 109 | 'password_timeout' => 10800, 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /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 | 'useTLS' => true, 41 | ], 42 | ], 43 | 44 | 'ably' => [ 45 | 'driver' => 'ably', 46 | 'key' => env('ABLY_KEY'), 47 | ], 48 | 49 | 'redis' => [ 50 | 'driver' => 'redis', 51 | 'connection' => 'default', 52 | ], 53 | 54 | 'log' => [ 55 | 'driver' => 'log', 56 | ], 57 | 58 | 'null' => [ 59 | 'driver' => 'null', 60 | ], 61 | 62 | ], 63 | 64 | ]; 65 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | ], 56 | 57 | 'memcached' => [ 58 | 'driver' => 'memcached', 59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 60 | 'sasl' => [ 61 | env('MEMCACHED_USERNAME'), 62 | env('MEMCACHED_PASSWORD'), 63 | ], 64 | 'options' => [ 65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 66 | ], 67 | 'servers' => [ 68 | [ 69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 70 | 'port' => env('MEMCACHED_PORT', 11211), 71 | 'weight' => 100, 72 | ], 73 | ], 74 | ], 75 | 76 | 'redis' => [ 77 | 'driver' => 'redis', 78 | 'connection' => 'cache', 79 | 'lock_connection' => 'default', 80 | ], 81 | 82 | 'dynamodb' => [ 83 | 'driver' => 'dynamodb', 84 | 'key' => env('AWS_ACCESS_KEY_ID'), 85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 88 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 89 | ], 90 | 91 | 'octane' => [ 92 | 'driver' => 'octane', 93 | ], 94 | 95 | ], 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Cache Key Prefix 100 | |-------------------------------------------------------------------------- 101 | | 102 | | When utilizing a RAM based store such as APC or Memcached, there might 103 | | be other applications utilizing the same cache. So, we'll specify a 104 | | value to get prefixed to all our keys so we can avoid collisions. 105 | | 106 | */ 107 | 108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['v1/*', '/login', '/logout', '/register', 'sanctum/csrf-cookie'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['*'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => true, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 | ]) : [], 64 | ], 65 | 66 | 'pgsql' => [ 67 | 'driver' => 'pgsql', 68 | 'url' => env('DATABASE_URL'), 69 | 'host' => env('DB_HOST', '127.0.0.1'), 70 | 'port' => env('DB_PORT', '5432'), 71 | 'database' => env('DB_DATABASE', 'forge'), 72 | 'username' => env('DB_USERNAME', 'forge'), 73 | 'password' => env('DB_PASSWORD', ''), 74 | 'charset' => 'utf8', 75 | 'prefix' => '', 76 | 'prefix_indexes' => true, 77 | 'schema' => 'public', 78 | 'sslmode' => 'prefer', 79 | ], 80 | 81 | 'sqlsrv' => [ 82 | 'driver' => 'sqlsrv', 83 | 'url' => env('DATABASE_URL'), 84 | 'host' => env('DB_HOST', 'localhost'), 85 | 'port' => env('DB_PORT', '1433'), 86 | 'database' => env('DB_DATABASE', 'forge'), 87 | 'username' => env('DB_USERNAME', 'forge'), 88 | 'password' => env('DB_PASSWORD', ''), 89 | 'charset' => 'utf8', 90 | 'prefix' => '', 91 | 'prefix_indexes' => true, 92 | ], 93 | 94 | ], 95 | 96 | /* 97 | |-------------------------------------------------------------------------- 98 | | Migration Repository Table 99 | |-------------------------------------------------------------------------- 100 | | 101 | | This table keeps track of all the migrations that have already run for 102 | | your application. Using this information, we can determine which of 103 | | the migrations on disk haven't actually been run in the database. 104 | | 105 | */ 106 | 107 | 'migrations' => 'migrations', 108 | 109 | /* 110 | |-------------------------------------------------------------------------- 111 | | Redis Databases 112 | |-------------------------------------------------------------------------- 113 | | 114 | | Redis is an open source, fast, and advanced key-value store that also 115 | | provides a richer body of commands than a typical key-value system 116 | | such as APC or Memcached. Laravel makes it easy to dig right in. 117 | | 118 | */ 119 | 120 | 'redis' => [ 121 | 122 | 'client' => env('REDIS_CLIENT', 'phpredis'), 123 | 124 | 'options' => [ 125 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 126 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 127 | ], 128 | 129 | 'default' => [ 130 | 'url' => env('REDIS_URL'), 131 | 'host' => env('REDIS_HOST', '127.0.0.1'), 132 | 'password' => env('REDIS_PASSWORD', null), 133 | 'port' => env('REDIS_PORT', '6379'), 134 | 'database' => env('REDIS_DB', '0'), 135 | ], 136 | 137 | 'cache' => [ 138 | 'url' => env('REDIS_URL'), 139 | 'host' => env('REDIS_HOST', '127.0.0.1'), 140 | 'password' => env('REDIS_PASSWORD', null), 141 | 'port' => env('REDIS_PORT', '6379'), 142 | 'database' => env('REDIS_CACHE_DB', '1'), 143 | ], 144 | 145 | ], 146 | 147 | ]; 148 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DRIVER', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been setup for each driver as an example of the required options. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | ], 37 | 38 | 'public' => [ 39 | 'driver' => 'local', 40 | 'root' => storage_path('app/public'), 41 | 'url' => env('APP_URL').'/storage', 42 | 'visibility' => 'public', 43 | ], 44 | 45 | 's3' => [ 46 | 'driver' => 's3', 47 | 'key' => env('AWS_ACCESS_KEY_ID'), 48 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 49 | 'region' => env('AWS_DEFAULT_REGION'), 50 | 'bucket' => env('AWS_BUCKET'), 51 | 'url' => env('AWS_URL'), 52 | 'endpoint' => env('AWS_ENDPOINT'), 53 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 54 | ], 55 | 56 | ], 57 | 58 | /* 59 | |-------------------------------------------------------------------------- 60 | | Symbolic Links 61 | |-------------------------------------------------------------------------- 62 | | 63 | | Here you may configure the symbolic links that will be created when the 64 | | `storage:link` Artisan command is executed. The array keys should be 65 | | the locations of the links and the values should be their targets. 66 | | 67 | */ 68 | 69 | 'links' => [ 70 | public_path('storage') => storage_path('app/public'), 71 | ], 72 | 73 | ]; 74 | -------------------------------------------------------------------------------- /config/fortify.php: -------------------------------------------------------------------------------- 1 | 'web', 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Fortify Password Broker 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Here you may specify which password broker Fortify can use when a user 27 | | is resetting their password. This configured value should match one 28 | | of your password brokers setup in your "auth" configuration file. 29 | | 30 | */ 31 | 32 | 'passwords' => 'users', 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Username / Email 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This value defines which model attribute should be considered as your 40 | | application's "username" field. Typically, this might be the email 41 | | address of the users but you are free to change this value here. 42 | | 43 | | Out of the box, Fortify expects forgot password and reset password 44 | | requests to have a field named 'email'. If the application uses 45 | | another name for the field you may define it below as needed. 46 | | 47 | */ 48 | 49 | 'username' => 'email', 50 | 51 | 'email' => 'email', 52 | 53 | /* 54 | |-------------------------------------------------------------------------- 55 | | Home Path 56 | |-------------------------------------------------------------------------- 57 | | 58 | | Here you may configure the path where users will get redirected during 59 | | authentication or password reset when the operations are successful 60 | | and the user is authenticated. You are free to change this value. 61 | | 62 | */ 63 | 64 | 'home' => RouteServiceProvider::HOME, 65 | 66 | /* 67 | |-------------------------------------------------------------------------- 68 | | Fortify Routes Prefix / Subdomain 69 | |-------------------------------------------------------------------------- 70 | | 71 | | Here you may specify which prefix Fortify will assign to all the routes 72 | | that it registers with the application. If necessary, you may change 73 | | subdomain under which all of the Fortify routes will be available. 74 | | 75 | */ 76 | 77 | 'prefix' => '', 78 | 79 | 'domain' => null, 80 | 81 | /* 82 | |-------------------------------------------------------------------------- 83 | | Fortify Routes Middleware 84 | |-------------------------------------------------------------------------- 85 | | 86 | | Here you may specify which middleware Fortify will assign to the routes 87 | | that it registers with the application. If necessary, you may change 88 | | these middleware but typically this provided default is preferred. 89 | | 90 | */ 91 | 92 | 'middleware' => ['web'], 93 | 94 | /* 95 | |-------------------------------------------------------------------------- 96 | | Rate Limiting 97 | |-------------------------------------------------------------------------- 98 | | 99 | | By default, Fortify will throttle logins to five requests per minute for 100 | | every email and IP address combination. However, if you would like to 101 | | specify a custom rate limiter to call then you may specify it here. 102 | | 103 | */ 104 | 105 | 'limiters' => [ 106 | // 'login' => 'login', 107 | // 'two-factor' => 'two-factor', 108 | ], 109 | 110 | /* 111 | |-------------------------------------------------------------------------- 112 | | Register View Routes 113 | |-------------------------------------------------------------------------- 114 | | 115 | | Here you may specify if the routes returning views should be disabled as 116 | | you may not need them when building your own application. This may be 117 | | especially true if you're writing a custom single-page application. 118 | | 119 | */ 120 | 121 | 'views' => false, 122 | 123 | /* 124 | |-------------------------------------------------------------------------- 125 | | Features 126 | |-------------------------------------------------------------------------- 127 | | 128 | | Some of the Fortify features are optional. You may disable the features 129 | | by removing them from this array. You're free to only remove some of 130 | | these features or you can even remove all of these if you need to. 131 | | 132 | */ 133 | 134 | 'features' => [ 135 | Features::registration(), 136 | // Features::resetPasswords(), 137 | // Features::emailVerification(), 138 | // Features::updateProfileInformation(), 139 | // Features::updatePasswords(), 140 | // Features::twoFactorAuthentication([ 141 | // 'confirmPassword' => true, 142 | // ]), 143 | ], 144 | 145 | ]; 146 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Deprecations Log Channel 25 | |-------------------------------------------------------------------------- 26 | | 27 | | This option controls the log channel that should be used to log warnings 28 | | regarding deprecated PHP and library features. This allows you to get 29 | | your application ready for upcoming major versions of dependencies. 30 | | 31 | */ 32 | 33 | 'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Log Channels 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may configure the log channels for your application. Out of 41 | | the box, Laravel uses the Monolog PHP logging library. This gives 42 | | you a variety of powerful log handlers / formatters to utilize. 43 | | 44 | | Available Drivers: "single", "daily", "slack", "syslog", 45 | | "errorlog", "monolog", 46 | | "custom", "stack" 47 | | 48 | */ 49 | 50 | 'channels' => [ 51 | 'stack' => [ 52 | 'driver' => 'stack', 53 | 'channels' => ['single'], 54 | 'ignore_exceptions' => false, 55 | ], 56 | 57 | 'single' => [ 58 | 'driver' => 'single', 59 | 'path' => storage_path('logs/laravel.log'), 60 | 'level' => env('LOG_LEVEL', 'debug'), 61 | ], 62 | 63 | 'daily' => [ 64 | 'driver' => 'daily', 65 | 'path' => storage_path('logs/laravel.log'), 66 | 'level' => env('LOG_LEVEL', 'debug'), 67 | 'days' => 14, 68 | ], 69 | 70 | 'slack' => [ 71 | 'driver' => 'slack', 72 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 73 | 'username' => 'Laravel Log', 74 | 'emoji' => ':boom:', 75 | 'level' => env('LOG_LEVEL', 'critical'), 76 | ], 77 | 78 | 'papertrail' => [ 79 | 'driver' => 'monolog', 80 | 'level' => env('LOG_LEVEL', 'debug'), 81 | 'handler' => SyslogUdpHandler::class, 82 | 'handler_with' => [ 83 | 'host' => env('PAPERTRAIL_URL'), 84 | 'port' => env('PAPERTRAIL_PORT'), 85 | ], 86 | ], 87 | 88 | 'stderr' => [ 89 | 'driver' => 'monolog', 90 | 'level' => env('LOG_LEVEL', 'debug'), 91 | 'handler' => StreamHandler::class, 92 | 'formatter' => env('LOG_STDERR_FORMATTER'), 93 | 'with' => [ 94 | 'stream' => 'php://stderr', 95 | ], 96 | ], 97 | 98 | 'syslog' => [ 99 | 'driver' => 'syslog', 100 | 'level' => env('LOG_LEVEL', 'debug'), 101 | ], 102 | 103 | 'errorlog' => [ 104 | 'driver' => 'errorlog', 105 | 'level' => env('LOG_LEVEL', 'debug'), 106 | ], 107 | 108 | 'null' => [ 109 | 'driver' => 'monolog', 110 | 'handler' => NullHandler::class, 111 | ], 112 | 113 | 'emergency' => [ 114 | 'path' => storage_path('logs/laravel.log'), 115 | ], 116 | ], 117 | 118 | ]; 119 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", 32 | | "postmark", "log", "array", "failover" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 40 | 'port' => env('MAIL_PORT', 587), 41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 42 | 'username' => env('MAIL_USERNAME'), 43 | 'password' => env('MAIL_PASSWORD'), 44 | 'timeout' => null, 45 | 'auth_mode' => null, 46 | ], 47 | 48 | 'ses' => [ 49 | 'transport' => 'ses', 50 | ], 51 | 52 | 'mailgun' => [ 53 | 'transport' => 'mailgun', 54 | ], 55 | 56 | 'postmark' => [ 57 | 'transport' => 'postmark', 58 | ], 59 | 60 | 'sendmail' => [ 61 | 'transport' => 'sendmail', 62 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'), 63 | ], 64 | 65 | 'log' => [ 66 | 'transport' => 'log', 67 | 'channel' => env('MAIL_LOG_CHANNEL'), 68 | ], 69 | 70 | 'array' => [ 71 | 'transport' => 'array', 72 | ], 73 | 74 | 'failover' => [ 75 | 'transport' => 'failover', 76 | 'mailers' => [ 77 | 'smtp', 78 | 'log', 79 | ], 80 | ], 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Global "From" Address 86 | |-------------------------------------------------------------------------- 87 | | 88 | | You may wish for all e-mails sent by your application to be sent from 89 | | the same address. Here, you may specify a name and address that is 90 | | used globally for all e-mails that are sent by your application. 91 | | 92 | */ 93 | 94 | 'from' => [ 95 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 96 | 'name' => env('MAIL_FROM_NAME', 'Example'), 97 | ], 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Markdown Mail Settings 102 | |-------------------------------------------------------------------------- 103 | | 104 | | If you are using Markdown based email rendering, you may configure your 105 | | theme and component paths here, allowing you to customize the design 106 | | of the emails. Or, you may simply stick with the Laravel defaults! 107 | | 108 | */ 109 | 110 | 'markdown' => [ 111 | 'theme' => 'default', 112 | 113 | 'paths' => [ 114 | resource_path('views/vendor/mail'), 115 | ], 116 | ], 117 | 118 | ]; 119 | -------------------------------------------------------------------------------- /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 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 17 | '%s%s', 18 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 19 | env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '' 20 | ))), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Sanctum Guards 25 | |-------------------------------------------------------------------------- 26 | | 27 | | This array contains the authentication guards that will be checked when 28 | | Sanctum is trying to authenticate a request. If none of these guards 29 | | are able to authenticate the request, Sanctum will use the bearer 30 | | token that's present on an incoming request for authentication. 31 | | 32 | */ 33 | 34 | 'guard' => ['web'], 35 | 36 | /* 37 | |-------------------------------------------------------------------------- 38 | | Expiration Minutes 39 | |-------------------------------------------------------------------------- 40 | | 41 | | This value controls the number of minutes until an issued token will be 42 | | considered expired. If this value is null, personal access tokens do 43 | | not expire. This won't tweak the lifetime of first-party sessions. 44 | | 45 | */ 46 | 47 | 'expiration' => null, 48 | 49 | /* 50 | |-------------------------------------------------------------------------- 51 | | Sanctum Middleware 52 | |-------------------------------------------------------------------------- 53 | | 54 | | When authenticating your first-party SPA with Sanctum you may need to 55 | | customize some of the middleware Sanctum uses while processing the 56 | | request. You may change the middleware listed below as required. 57 | | 58 | */ 59 | 60 | 'middleware' => [ 61 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 62 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 63 | ], 64 | 65 | ]; 66 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | ], 22 | 23 | 'postmark' => [ 24 | 'token' => env('POSTMARK_TOKEN'), 25 | ], 26 | 27 | 'ses' => [ 28 | 'key' => env('AWS_ACCESS_KEY_ID'), 29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 31 | ], 32 | 33 | ]; 34 | -------------------------------------------------------------------------------- /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 | | While using one of the framework's cache driven session backends you may 96 | | list a cache store that should be used for these sessions. This value 97 | | must match with one of the application's configured cache "stores". 98 | | 99 | | Affects: "apc", "dynamodb", "memcached", "redis" 100 | | 101 | */ 102 | 103 | 'store' => env('SESSION_STORE', null), 104 | 105 | /* 106 | |-------------------------------------------------------------------------- 107 | | Session Sweeping Lottery 108 | |-------------------------------------------------------------------------- 109 | | 110 | | Some session drivers must manually sweep their storage location to get 111 | | rid of old sessions from storage. Here are the chances that it will 112 | | happen on a given request. By default, the odds are 2 out of 100. 113 | | 114 | */ 115 | 116 | 'lottery' => [2, 100], 117 | 118 | /* 119 | |-------------------------------------------------------------------------- 120 | | Session Cookie Name 121 | |-------------------------------------------------------------------------- 122 | | 123 | | Here you may change the name of the cookie used to identify a session 124 | | instance by ID. The name specified here will get used every time a 125 | | new session cookie is created by the framework for every driver. 126 | | 127 | */ 128 | 129 | 'cookie' => env( 130 | 'SESSION_COOKIE', 131 | Str::slug(env('APP_NAME', 'laravel'), '_').'_session' 132 | ), 133 | 134 | /* 135 | |-------------------------------------------------------------------------- 136 | | Session Cookie Path 137 | |-------------------------------------------------------------------------- 138 | | 139 | | The session cookie path determines the path for which the cookie will 140 | | be regarded as available. Typically, this will be the root path of 141 | | your application but you are free to change this when necessary. 142 | | 143 | */ 144 | 145 | 'path' => '/', 146 | 147 | /* 148 | |-------------------------------------------------------------------------- 149 | | Session Cookie Domain 150 | |-------------------------------------------------------------------------- 151 | | 152 | | Here you may change the domain of the cookie used to identify a session 153 | | in your application. This will determine which domains the cookie is 154 | | available to in your application. A sensible default has been set. 155 | | 156 | */ 157 | 158 | 'domain' => env('SESSION_DOMAIN', null), 159 | 160 | /* 161 | |-------------------------------------------------------------------------- 162 | | HTTPS Only Cookies 163 | |-------------------------------------------------------------------------- 164 | | 165 | | By setting this option to true, session cookies will only be sent back 166 | | to the server if the browser has a HTTPS connection. This will keep 167 | | the cookie from being sent to you when it can't be done securely. 168 | | 169 | */ 170 | 171 | 'secure' => env('SESSION_SECURE_COOKIE'), 172 | 173 | /* 174 | |-------------------------------------------------------------------------- 175 | | HTTP Access Only 176 | |-------------------------------------------------------------------------- 177 | | 178 | | Setting this value to true will prevent JavaScript from accessing the 179 | | value of the cookie and the cookie will only be accessible through 180 | | the HTTP protocol. You are free to modify this option if needed. 181 | | 182 | */ 183 | 184 | 'http_only' => true, 185 | 186 | /* 187 | |-------------------------------------------------------------------------- 188 | | Same-Site Cookies 189 | |-------------------------------------------------------------------------- 190 | | 191 | | This option determines how your cookies behave when cross-site requests 192 | | take place, and can be used to mitigate CSRF attacks. By default, we 193 | | will set this value to "lax" since this is a secure default value. 194 | | 195 | | Supported: "lax", "strict", "none", null 196 | | 197 | */ 198 | 199 | 'same_site' => 'lax', 200 | 201 | ]; 202 | -------------------------------------------------------------------------------- /config/telescope.php: -------------------------------------------------------------------------------- 1 | env('TELESCOPE_DOMAIN', null), 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Telescope Path 24 | |-------------------------------------------------------------------------- 25 | | 26 | | This is the URI path where Telescope will be accessible from. Feel free 27 | | to change this path to anything you like. Note that the URI will not 28 | | affect the paths of its internal API that aren't exposed to users. 29 | | 30 | */ 31 | 32 | 'path' => env('TELESCOPE_PATH', 'telescope'), 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Telescope Storage Driver 37 | |-------------------------------------------------------------------------- 38 | | 39 | | This configuration options determines the storage driver that will 40 | | be used to store Telescope's data. In addition, you may set any 41 | | custom options as needed by the particular driver you choose. 42 | | 43 | */ 44 | 45 | 'driver' => env('TELESCOPE_DRIVER', 'database'), 46 | 47 | 'storage' => [ 48 | 'database' => [ 49 | 'connection' => env('DB_CONNECTION', 'mysql'), 50 | 'chunk' => 1000, 51 | ], 52 | ], 53 | 54 | /* 55 | |-------------------------------------------------------------------------- 56 | | Telescope Master Switch 57 | |-------------------------------------------------------------------------- 58 | | 59 | | This option may be used to disable all Telescope watchers regardless 60 | | of their individual configuration, which simply provides a single 61 | | and convenient way to enable or disable Telescope data storage. 62 | | 63 | */ 64 | 65 | 'enabled' => env('TELESCOPE_ENABLED', true), 66 | 67 | /* 68 | |-------------------------------------------------------------------------- 69 | | Telescope Route Middleware 70 | |-------------------------------------------------------------------------- 71 | | 72 | | These middleware will be assigned to every Telescope route, giving you 73 | | the chance to add your own middleware to this list or change any of 74 | | the existing middleware. Or, you can simply stick with this list. 75 | | 76 | */ 77 | 78 | 'middleware' => [ 79 | 'web', 80 | Authorize::class, 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Allowed / Ignored Paths & Commands 86 | |-------------------------------------------------------------------------- 87 | | 88 | | The following array lists the URI paths and Artisan commands that will 89 | | not be watched by Telescope. In addition to this list, some Laravel 90 | | commands, like migrations and queue commands, are always ignored. 91 | | 92 | */ 93 | 94 | 'only_paths' => [ 95 | // 'api/*' 96 | ], 97 | 98 | 'ignore_paths' => [ 99 | 'nova-api*', 100 | ], 101 | 102 | 'ignore_commands' => [ 103 | // 104 | ], 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | Telescope Watchers 109 | |-------------------------------------------------------------------------- 110 | | 111 | | The following array lists the "watchers" that will be registered with 112 | | Telescope. The watchers gather the application's profile data when 113 | | a request or task is executed. Feel free to customize this list. 114 | | 115 | */ 116 | 117 | 'watchers' => [ 118 | Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true), 119 | Watchers\CacheWatcher::class => env('TELESCOPE_CACHE_WATCHER', true), 120 | Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true), 121 | 122 | Watchers\CommandWatcher::class => [ 123 | 'enabled' => env('TELESCOPE_COMMAND_WATCHER', true), 124 | 'ignore' => [], 125 | ], 126 | 127 | Watchers\DumpWatcher::class => env('TELESCOPE_DUMP_WATCHER', true), 128 | 129 | Watchers\EventWatcher::class => [ 130 | 'enabled' => env('TELESCOPE_EVENT_WATCHER', true), 131 | 'ignore' => [], 132 | ], 133 | 134 | Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true), 135 | 136 | Watchers\GateWatcher::class => [ 137 | 'enabled' => env('TELESCOPE_GATE_WATCHER', true), 138 | 'ignore_abilities' => [], 139 | 'ignore_packages' => true, 140 | ], 141 | 142 | Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true), 143 | Watchers\LogWatcher::class => env('TELESCOPE_LOG_WATCHER', true), 144 | Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true), 145 | 146 | Watchers\ModelWatcher::class => [ 147 | 'enabled' => env('TELESCOPE_MODEL_WATCHER', true), 148 | 'events' => ['eloquent.*'], 149 | 'hydrations' => true, 150 | ], 151 | 152 | Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true), 153 | 154 | Watchers\QueryWatcher::class => [ 155 | 'enabled' => env('TELESCOPE_QUERY_WATCHER', true), 156 | 'ignore_packages' => true, 157 | 'slow' => 100, 158 | ], 159 | 160 | Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true), 161 | 162 | Watchers\RequestWatcher::class => [ 163 | 'enabled' => env('TELESCOPE_REQUEST_WATCHER', true), 164 | 'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64), 165 | 'ignore_status_codes' => [], 166 | ], 167 | 168 | Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true), 169 | Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true), 170 | ], 171 | ]; 172 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /database/factories/AccountFactory.php: -------------------------------------------------------------------------------- 1 | User::factory(), 20 | 'slug' => Str::slug($this->faker->sentence(2)), 21 | ]; 22 | } 23 | 24 | /** 25 | * Indicate that the model's email address should be unverified. 26 | * 27 | * @return \Illuminate\Database\Eloquent\Factories\Factory 28 | */ 29 | public function unverified() 30 | { 31 | return $this->state(function (array $attributes) { 32 | return [ 33 | 'email_verified_at' => null, 34 | ]; 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /database/factories/LandingPageFactory.php: -------------------------------------------------------------------------------- 1 | Account::factory(), 20 | 21 | 'name' => $this->faker->sentence(2), 22 | 'slug' => Str::slug($this->faker->sentence(2)), 23 | 'type' => 'infoproduct', 24 | 25 | 'pages' => [ 26 | 'main' => [], 27 | 'thanks' => [], 28 | ], 29 | 'draft' => [ 30 | 'main' => [], 31 | 'thanks' => [], 32 | ], 33 | ]; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | $this->faker->name(), 19 | 'email' => $this->faker->unique()->safeEmail(), 20 | 'email_verified_at' => now(), 21 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 22 | 'remember_token' => Str::random(10), 23 | ]; 24 | } 25 | 26 | /** 27 | * Indicate that the model's email address should be unverified. 28 | * 29 | * @return \Illuminate\Database\Eloquent\Factories\Factory 30 | */ 31 | public function unverified() 32 | { 33 | return $this->state(function (array $attributes) { 34 | return [ 35 | 'email_verified_at' => null, 36 | ]; 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | uuid('uuid')->unique()->index()->primary(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | $table->softDeletes(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('users'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /database/migrations/2022_01_22_061226_create_accounts_table.php: -------------------------------------------------------------------------------- 1 | uuid('uuid')->unique()->index()->primary(); 18 | $table->uuid('user_uuid')->index(); 19 | 20 | $table->string('slug'); 21 | 22 | $table->timestamps(); 23 | $table->softDeletes(); 24 | 25 | $table->foreign('user_uuid')->references('uuid')->on('users'); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('accounts'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /database/migrations/2022_01_23_213543_create_landing_pages_table.php: -------------------------------------------------------------------------------- 1 | uuid('uuid')->unique()->index()->primary(); 18 | $table->uuid('account_uuid')->index(); 19 | 20 | $table->string('name'); 21 | $table->string('slug')->index()->unique(); 22 | $table->string('type'); //sale, lead_magnet 23 | 24 | $table->json('pages')->nullable(); 25 | $table->json('draft')->nullable(); 26 | 27 | $table->timestamps(); 28 | $table->softDeletes(); 29 | 30 | $table->foreign('account_uuid')->references('uuid')->on('accounts'); 31 | }); 32 | } 33 | 34 | /** 35 | * Reverse the migrations. 36 | * 37 | * @return void 38 | */ 39 | public function down() 40 | { 41 | Schema::dropIfExists('landing_pages'); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /database/migrations/2022_01_23_214153_create_images_table.php: -------------------------------------------------------------------------------- 1 | uuid('uuid')->unique()->index()->primary(); 18 | $table->uuid('account_uuid')->index(); 19 | 20 | $table->string('filename'); 21 | $table->string('path'); 22 | $table->string('thumb_path'); 23 | 24 | $table->timestamps(); 25 | 26 | $table->foreign('account_uuid')->references('uuid')->on('accounts'); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('images'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | create([ 20 | 'name' => 'Isaac Souza', 21 | 'email' => 'isaacsouza17@gmail.com' 22 | ]); 23 | 24 | Account::factory(1)->for(User::first())->create(['slug' => 'isaac-souza']); 25 | 26 | LandingPage::factory(5)->for(Account::first())->create(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | # For more information: https://laravel.com/docs/sail 2 | version: '3' 3 | 4 | services: 5 | laravel.test: 6 | build: 7 | context: ./vendor/laravel/sail/runtimes/8.1 8 | dockerfile: Dockerfile 9 | args: 10 | WWWGROUP: '${WWWGROUP}' 11 | image: sail-8.1/app 12 | extra_hosts: 13 | - 'host.docker.internal:host-gateway' 14 | ports: 15 | - '${APP_PORT:-80}:80' 16 | environment: 17 | WWWUSER: '${WWWUSER}' 18 | LARAVEL_SAIL: 1 19 | XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' 20 | XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' 21 | volumes: 22 | - '.:/var/www/html' 23 | networks: 24 | - sail 25 | depends_on: 26 | - mysql 27 | 28 | phpmyadmin: 29 | image: phpmyadmin:5.1.1-apache 30 | ports: 31 | - 8100:80 32 | environment: 33 | MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' 34 | MYSQL_USER: '${DB_USERNAME}' 35 | MYSQL_PASSWORD: '${DB_PASSWORD}' 36 | PMA_HOST: mysql 37 | depends_on: 38 | - mysql 39 | networks: 40 | - sail 41 | 42 | mysql: 43 | image: 'mysql:5.7.34' 44 | ports: 45 | - '${FORWARD_DB_PORT:-3306}:3306' 46 | environment: 47 | MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' 48 | MYSQL_ROOT_HOST: "%" 49 | MYSQL_DATABASE: '${DB_DATABASE}' 50 | MYSQL_USER: '${DB_USERNAME}' 51 | MYSQL_PASSWORD: '${DB_PASSWORD}' 52 | MYSQL_ALLOW_EMPTY_PASSWORD: 1 53 | volumes: 54 | - 'sail-mysql:/var/lib/mysql' 55 | networks: 56 | - sail 57 | healthcheck: 58 | test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"] 59 | retries: 3 60 | timeout: 5s 61 | 62 | networks: 63 | sail: 64 | driver: bridge 65 | 66 | volumes: 67 | sail-mysql: 68 | driver: local 69 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "mix", 6 | "watch": "mix watch", 7 | "watch-poll": "mix watch -- --watch-options-poll=1000", 8 | "hot": "mix watch --hot", 9 | "prod": "npm run production", 10 | "production": "mix --production" 11 | }, 12 | "devDependencies": { 13 | "axios": "^0.21", 14 | "laravel-mix": "^6.0.6", 15 | "lodash": "^4.17.19", 16 | "postcss": "^8.1.14" 17 | }, 18 | "dependencies": { 19 | "daisyui": "^1.25.4" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /phpstan.neon: -------------------------------------------------------------------------------- 1 | includes: 2 | - ./vendor/nunomaduro/larastan/extension.neon 3 | 4 | parameters: 5 | 6 | paths: 7 | - app 8 | 9 | # The level 9 is the highest level 10 | level: 1 11 | 12 | ignoreErrors: 13 | - '#Unsafe usage of new static#' 14 | 15 | excludePaths: 16 | - ./*/*/FileToBeExcluded.php 17 | 18 | checkMissingIterableValueType: false -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /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 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/css/app.css: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/isaac-souza/pagebuilder-laravel/cd3cb7be3fa9049ed4b2ebd801652997c9c2d89d/public/favicon.ico -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/js/app.js": "/js/app.js", 3 | "/css/app.css": "/css/app.css" 4 | } 5 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /public/vendor/telescope/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/isaac-souza/pagebuilder-laravel/cd3cb7be3fa9049ed4b2ebd801652997c9c2d89d/public/vendor/telescope/favicon.ico -------------------------------------------------------------------------------- /public/vendor/telescope/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/app.js": "/app.js?id=d3ff915bff3de87b87cc", 3 | "/app-dark.css": "/app-dark.css?id=3ae28ef5f7b987d68dc6", 4 | "/app.css": "/app.css?id=7c970f699ed9cf60d80b" 5 | } 6 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/isaac-souza/pagebuilder-laravel/cd3cb7be3fa9049ed4b2ebd801652997c9c2d89d/resources/css/app.css -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | require('./bootstrap'); 2 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | window._ = require('lodash'); 2 | 3 | /** 4 | * We'll load the axios HTTP library which allows us to easily issue requests 5 | * to our Laravel back-end. This library automatically handles sending the 6 | * CSRF token as a header based on the value of the "XSRF" token cookie. 7 | */ 8 | 9 | window.axios = require('axios'); 10 | 11 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 12 | 13 | /** 14 | * Echo exposes an expressive API for subscribing to channels and listening 15 | * for events that are broadcast by Laravel. Echo and event broadcasting 16 | * allows your team to easily build robust real-time web applications. 17 | */ 18 | 19 | // import Echo from 'laravel-echo'; 20 | 21 | // window.Pusher = require('pusher-js'); 22 | 23 | // window.Echo = new Echo({ 24 | // broadcaster: 'pusher', 25 | // key: process.env.MIX_PUSHER_APP_KEY, 26 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, 27 | // forceTLS: true 28 | // }); 29 | -------------------------------------------------------------------------------- /resources/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /resources/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /resources/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /resources/lang/en/validation.php: -------------------------------------------------------------------------------- 1 | 'The :attribute must be accepted.', 17 | 'accepted_if' => 'The :attribute must be accepted when :other is :value.', 18 | 'active_url' => 'The :attribute is not a valid URL.', 19 | 'after' => 'The :attribute must be a date after :date.', 20 | 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', 21 | 'alpha' => 'The :attribute must only contain letters.', 22 | 'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.', 23 | 'alpha_num' => 'The :attribute must only contain letters and numbers.', 24 | 'array' => 'The :attribute must be an array.', 25 | 'before' => 'The :attribute must be a date before :date.', 26 | 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', 27 | 'between' => [ 28 | 'numeric' => 'The :attribute must be between :min and :max.', 29 | 'file' => 'The :attribute must be between :min and :max kilobytes.', 30 | 'string' => 'The :attribute must be between :min and :max characters.', 31 | 'array' => 'The :attribute must have between :min and :max items.', 32 | ], 33 | 'boolean' => 'The :attribute field must be true or false.', 34 | 'confirmed' => 'The :attribute confirmation does not match.', 35 | 'current_password' => 'The password is incorrect.', 36 | 'date' => 'The :attribute is not a valid date.', 37 | 'date_equals' => 'The :attribute must be a date equal to :date.', 38 | 'date_format' => 'The :attribute does not match the format :format.', 39 | 'declined' => 'The :attribute must be declined.', 40 | 'declined_if' => 'The :attribute must be declined when :other is :value.', 41 | 'different' => 'The :attribute and :other must be different.', 42 | 'digits' => 'The :attribute must be :digits digits.', 43 | 'digits_between' => 'The :attribute must be between :min and :max digits.', 44 | 'dimensions' => 'The :attribute has invalid image dimensions.', 45 | 'distinct' => 'The :attribute field has a duplicate value.', 46 | 'email' => 'The :attribute must be a valid email address.', 47 | 'ends_with' => 'The :attribute must end with one of the following: :values.', 48 | 'enum' => 'The selected :attribute is invalid.', 49 | 'exists' => 'The selected :attribute is invalid.', 50 | 'file' => 'The :attribute must be a file.', 51 | 'filled' => 'The :attribute field must have a value.', 52 | 'gt' => [ 53 | 'numeric' => 'The :attribute must be greater than :value.', 54 | 'file' => 'The :attribute must be greater than :value kilobytes.', 55 | 'string' => 'The :attribute must be greater than :value characters.', 56 | 'array' => 'The :attribute must have more than :value items.', 57 | ], 58 | 'gte' => [ 59 | 'numeric' => 'The :attribute must be greater than or equal to :value.', 60 | 'file' => 'The :attribute must be greater than or equal to :value kilobytes.', 61 | 'string' => 'The :attribute must be greater than or equal to :value characters.', 62 | 'array' => 'The :attribute must have :value items or more.', 63 | ], 64 | 'image' => 'The :attribute must be an image.', 65 | 'in' => 'The selected :attribute is invalid.', 66 | 'in_array' => 'The :attribute field does not exist in :other.', 67 | 'integer' => 'The :attribute must be an integer.', 68 | 'ip' => 'The :attribute must be a valid IP address.', 69 | 'ipv4' => 'The :attribute must be a valid IPv4 address.', 70 | 'ipv6' => 'The :attribute must be a valid IPv6 address.', 71 | 'mac_address' => 'The :attribute must be a valid MAC address.', 72 | 'json' => 'The :attribute must be a valid JSON string.', 73 | 'lt' => [ 74 | 'numeric' => 'The :attribute must be less than :value.', 75 | 'file' => 'The :attribute must be less than :value kilobytes.', 76 | 'string' => 'The :attribute must be less than :value characters.', 77 | 'array' => 'The :attribute must have less than :value items.', 78 | ], 79 | 'lte' => [ 80 | 'numeric' => 'The :attribute must be less than or equal to :value.', 81 | 'file' => 'The :attribute must be less than or equal to :value kilobytes.', 82 | 'string' => 'The :attribute must be less than or equal to :value characters.', 83 | 'array' => 'The :attribute must not have more than :value items.', 84 | ], 85 | 'max' => [ 86 | 'numeric' => 'The :attribute must not be greater than :max.', 87 | 'file' => 'The :attribute must not be greater than :max kilobytes.', 88 | 'string' => 'The :attribute must not be greater than :max characters.', 89 | 'array' => 'The :attribute must not have more than :max items.', 90 | ], 91 | 'mimes' => 'The :attribute must be a file of type: :values.', 92 | 'mimetypes' => 'The :attribute must be a file of type: :values.', 93 | 'min' => [ 94 | 'numeric' => 'The :attribute must be at least :min.', 95 | 'file' => 'The :attribute must be at least :min kilobytes.', 96 | 'string' => 'The :attribute must be at least :min characters.', 97 | 'array' => 'The :attribute must have at least :min items.', 98 | ], 99 | 'multiple_of' => 'The :attribute must be a multiple of :value.', 100 | 'not_in' => 'The selected :attribute is invalid.', 101 | 'not_regex' => 'The :attribute format is invalid.', 102 | 'numeric' => 'The :attribute must be a number.', 103 | 'password' => 'The password is incorrect.', 104 | 'present' => 'The :attribute field must be present.', 105 | 'prohibited' => 'The :attribute field is prohibited.', 106 | 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', 107 | 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', 108 | 'prohibits' => 'The :attribute field prohibits :other from being present.', 109 | 'regex' => 'The :attribute format is invalid.', 110 | 'required' => 'The :attribute field is required.', 111 | 'required_if' => 'The :attribute field is required when :other is :value.', 112 | 'required_unless' => 'The :attribute field is required unless :other is in :values.', 113 | 'required_with' => 'The :attribute field is required when :values is present.', 114 | 'required_with_all' => 'The :attribute field is required when :values are present.', 115 | 'required_without' => 'The :attribute field is required when :values is not present.', 116 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 117 | 'same' => 'The :attribute and :other must match.', 118 | 'size' => [ 119 | 'numeric' => 'The :attribute must be :size.', 120 | 'file' => 'The :attribute must be :size kilobytes.', 121 | 'string' => 'The :attribute must be :size characters.', 122 | 'array' => 'The :attribute must contain :size items.', 123 | ], 124 | 'starts_with' => 'The :attribute must start with one of the following: :values.', 125 | 'string' => 'The :attribute must be a string.', 126 | 'timezone' => 'The :attribute must be a valid timezone.', 127 | 'unique' => 'The :attribute has already been taken.', 128 | 'uploaded' => 'The :attribute failed to upload.', 129 | 'url' => 'The :attribute must be a valid URL.', 130 | 'uuid' => 'The :attribute must be a valid UUID.', 131 | 132 | /* 133 | |-------------------------------------------------------------------------- 134 | | Custom Validation Language Lines 135 | |-------------------------------------------------------------------------- 136 | | 137 | | Here you may specify custom validation messages for attributes using the 138 | | convention "attribute.rule" to name the lines. This makes it quick to 139 | | specify a specific custom language line for a given attribute rule. 140 | | 141 | */ 142 | 143 | 'custom' => [ 144 | 'attribute-name' => [ 145 | 'rule-name' => 'custom-message', 146 | ], 147 | ], 148 | 149 | /* 150 | |-------------------------------------------------------------------------- 151 | | Custom Validation Attributes 152 | |-------------------------------------------------------------------------- 153 | | 154 | | The following language lines are used to swap our attribute placeholder 155 | | with something more reader friendly such as "E-Mail Address" instead 156 | | of "email". This simply helps us make our message more expressive. 157 | | 158 | */ 159 | 160 | 'attributes' => [], 161 | 162 | ]; 163 | -------------------------------------------------------------------------------- /resources/views/welcome.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Laravel 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 22 | 23 | 24 |
25 | @if (Route::has('login')) 26 | 37 | @endif 38 | 39 |
40 |
41 | 42 | 43 | 44 | 45 | 46 |
47 | 48 |
49 |
50 |
51 |
52 | 53 | 54 |
55 | 56 |
57 |
58 | Laravel has wonderful, thorough documentation covering every aspect of the framework. Whether you are new to the framework or have previous experience with Laravel, we recommend reading all of the documentation from beginning to end. 59 |
60 |
61 |
62 | 63 |
64 |
65 | 66 | 67 |
68 | 69 |
70 |
71 | Laracasts offers thousands of video tutorials on Laravel, PHP, and JavaScript development. Check them out, see for yourself, and massively level up your development skills in the process. 72 |
73 |
74 |
75 | 76 |
77 |
78 | 79 | 80 |
81 | 82 |
83 |
84 | Laravel News is a community driven portal and newsletter aggregating all of the latest and most important news in the Laravel ecosystem, including new package releases and tutorials. 85 |
86 |
87 |
88 | 89 |
90 |
91 | 92 |
Vibrant Ecosystem
93 |
94 | 95 |
96 |
97 | Laravel's robust library of first-party tools and libraries, such as Forge, Vapor, Nova, and Envoyer help you take your projects to the next level. Pair them with powerful open source libraries like Cashier, Dusk, Echo, Horizon, Sanctum, Telescope, and more. 98 |
99 |
100 |
101 |
102 |
103 | 104 |
105 |
106 |
107 | 108 | 109 | 110 | 111 | 112 | Shop 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Sponsor 121 | 122 |
123 |
124 | 125 |
126 | Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}) 127 |
128 |
129 |
130 |
131 | 132 | 133 | -------------------------------------------------------------------------------- /routes/api/v1.php: -------------------------------------------------------------------------------- 1 | group(function() { 11 | 12 | Route::get('landing-pages/{slug}', [PublicLandingPageController::class, 'show'])->name('public.landing-pages.show'); 13 | 14 | }); 15 | 16 | Route::middleware(['simulate.network.delay', 'auth:sanctum'])->group(function() { 17 | 18 | Route::get('/auth/check', [AuthController::class, 'check']); 19 | Route::get('/auth/account', [AuthController::class, 'account']); 20 | 21 | Route::put('landing-pages/{uuid}/draft', [LandingPageDraftController::class, 'update']); 22 | 23 | Route::get('landing-pages', [LandingPageController::class, 'index'])->name('landing-pages.index'); 24 | Route::get('landing-pages/{uuid}', [LandingPageController::class, 'show'])->name('landing-pages.show'); 25 | Route::post('landing-pages', [LandingPageController::class, 'store'])->name('landing-pages.store'); 26 | Route::put('landing-pages/{uuid}', [LandingPageController::class, 'update'])->name('landing-pages.update'); 27 | Route::delete('landing-pages/{uuid}', [LandingPageController::class, 'destroy'])->name('landing-pages.destroy'); 28 | 29 | Route::prefix('images')->group(function() { 30 | 31 | Route::get('', [ImageController::class, 'index'])->name('images.index'); 32 | Route::post('', [ImageController::class, 'store'])->name('images.store'); 33 | Route::delete('{uuid}', [ImageController::class, 'destroy'])->name('images.delete'); 34 | 35 | }); 36 | 37 | }); 38 | -------------------------------------------------------------------------------- /routes/api/v2.php: -------------------------------------------------------------------------------- 1 | user())) 8 | { 9 | return response()->json(['authenticated' => false], Response::HTTP_OK); 10 | } 11 | 12 | return response()->json(['authenticated' => true], Response::HTTP_OK); 13 | }); 14 | 15 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ImageTest.php: -------------------------------------------------------------------------------- 1 | assertDatabaseCount('images', 0); 27 | 28 | // Act 29 | $file = UploadedFile::fake()->image('ebook-cover.jpg', 400, 400); 30 | $response = $this->postJson(route('images.store'), [ 31 | 'file' => $file, 32 | ]); 33 | 34 | // Assert 35 | $response->assertStatus(Response::HTTP_UNAUTHORIZED); 36 | $this->assertDatabaseCount('images', 0); 37 | } 38 | 39 | public function test_an_uploaded_image_is_stored_in_the_correct_folder_and_a_thumb_is_generated() 40 | { 41 | // Arrange 42 | Storage::fake('public'); 43 | 44 | /** @var \App\Models\User $user */ 45 | $user = User::factory()->create(); 46 | Account::factory()->for($user)->create(); 47 | 48 | // Pre assert 49 | $this->assertDatabaseCount('images', 0); 50 | 51 | // Act 52 | $this->actingAs($user); 53 | 54 | $file = UploadedFile::fake()->image('ebook-cover.jpg', 400, 400); 55 | $response = $this->postJson(route('images.store'), [ 56 | 'file' => $file, 57 | ]); 58 | 59 | // Assert 60 | $image = Image::first(); 61 | 62 | $response->assertStatus(Response::HTTP_CREATED); 63 | Storage::disk('public')->assertExists($image->path); 64 | Storage::disk('public')->assertExists($image->thumb_path); 65 | $this->assertDatabaseCount('images', 1); 66 | } 67 | 68 | public function test_when_an_image_is_deleted_its_corresponding_files_are_also_deleted() 69 | { 70 | // Arrange 71 | Storage::fake('public'); 72 | 73 | /** @var \App\Models\User $user */ 74 | $user = User::factory()->create(); 75 | Account::factory()->for($user)->create(); 76 | 77 | $this->actingAs($user); 78 | 79 | $file = UploadedFile::fake()->image('ebook-cover.jpg', 400, 400); 80 | 81 | $this->postJson(route('images.store'), [ 82 | 'file' => $file, 83 | ]); 84 | 85 | $image = Image::first(); 86 | 87 | // Pre assert 88 | $this->assertDatabaseCount('images', 1); 89 | 90 | // Act 91 | $response = $this->delete(route('images.delete', $image->uuid)); 92 | 93 | // Assert 94 | $response->assertStatus(Response::HTTP_NO_CONTENT); 95 | Storage::disk('public')->assertMissing($image->path); 96 | Storage::disk('public')->assertMissing($image->thumb_path); 97 | $this->assertDatabaseCount('images', 0); 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /tests/Feature/LandingPageTest.php: -------------------------------------------------------------------------------- 1 | create(); 22 | $account = Account::factory()->for(($user))->create(); 23 | $landingPage = LandingPage::factory()->for($account)->create(); 24 | 25 | // Pre assert 26 | $this->assertEquals(1, LandingPage::count()); 27 | $this->assertDatabaseCount('users', 1); 28 | $this->assertDatabaseCount('accounts', 1); 29 | $this->assertDatabaseHas('landing_pages', [ 30 | 'uuid' => $landingPage->uuid, 31 | 'deleted_at' => null, 32 | ]); 33 | 34 | // Act 35 | $this->actingAs($user); 36 | $response = $this->delete(route('landing-pages.destroy', $landingPage->uuid)); 37 | 38 | // Assert 39 | $response->assertStatus(204); 40 | $this->assertEquals(0, LandingPage::count()); 41 | $this->assertDatabaseCount('users', 1); 42 | $this->assertDatabaseCount('accounts', 1); 43 | $this->assertDatabaseHas('landing_pages', [ 44 | 'uuid' => $landingPage->uuid, 45 | 'deleted_at' => now(), 46 | ]); 47 | } 48 | 49 | public function test_only_an_authenticated_user_can_delete_a_landing_page() 50 | { 51 | // Arrange 52 | /** @var \App\Models\User $user */ 53 | $user = User::factory()->create(); 54 | $account = Account::factory()->for(($user))->create(); 55 | $landingPage = LandingPage::factory()->for($account)->create(); 56 | 57 | // Pre assert 58 | $this->assertDatabaseCount('users', 1); 59 | $this->assertDatabaseCount('accounts', 1); 60 | $this->assertDatabaseCount('landing_pages', 1); 61 | $this->assertDatabaseHas('landing_pages', [ 62 | 'uuid' => $landingPage->uuid, 63 | 'deleted_at' => null, 64 | ]); 65 | 66 | // Act 67 | Auth::logout(); 68 | $response = $this->deleteJson(route('landing-pages.destroy', $landingPage->uuid)); 69 | 70 | // Assert 71 | $response->assertStatus(401); 72 | $this->assertDatabaseCount('users', 1); 73 | $this->assertDatabaseCount('accounts', 1); 74 | $this->assertDatabaseCount('landing_pages', 1); 75 | $this->assertDatabaseHas('landing_pages', [ 76 | 'uuid' => $landingPage->uuid, 77 | 'deleted_at' => null, 78 | ]); 79 | } 80 | 81 | public function test_404_must_be_returned_if_a_landing_page_is_not_found_when_trying_to_delete() 82 | { 83 | // Arrange 84 | /** @var \App\Models\User $user */ 85 | $user = User::factory()->create(); 86 | $account = Account::factory()->for(($user))->create(); 87 | $landingPage = LandingPage::factory()->for($account)->create(); 88 | 89 | // Pre assert 90 | $this->assertDatabaseCount('users', 1); 91 | $this->assertDatabaseCount('accounts', 1); 92 | $this->assertDatabaseCount('landing_pages', 1); 93 | $this->assertDatabaseHas('landing_pages', [ 94 | 'uuid' => $landingPage->uuid, 95 | 'deleted_at' => null, 96 | ]); 97 | 98 | // Act 99 | $this->actingAs($user); 100 | $response = $this->deleteJson(route('landing-pages.destroy', Str::uuid())); 101 | 102 | // Assert 103 | $response->assertStatus(404); 104 | $this->assertDatabaseCount('users', 1); 105 | $this->assertDatabaseCount('accounts', 1); 106 | $this->assertDatabaseCount('landing_pages', 1); 107 | $this->assertDatabaseHas('landing_pages', [ 108 | 'uuid' => $landingPage->uuid, 109 | 'deleted_at' => null, 110 | ]); 111 | } 112 | 113 | public function test_a_user_cannot_delete_other_user_landing_page() 114 | { 115 | // Arrange 116 | /** @var \App\Models\User $user */ 117 | $user = User::factory()->create(); 118 | Account::factory()->for(($user))->create(); 119 | 120 | $otherUserLandingPage = LandingPage::factory()->create(); 121 | 122 | // Pre assert 123 | $this->assertDatabaseCount('users', 2); 124 | $this->assertDatabaseCount('accounts', 2); 125 | $this->assertDatabaseCount('landing_pages', 1); 126 | $this->assertDatabaseHas('landing_pages', [ 127 | 'uuid' => $otherUserLandingPage->uuid, 128 | 'deleted_at' => null, 129 | ]); 130 | 131 | // Act 132 | $this->actingAs($user); 133 | $response = $this->deleteJson(route('landing-pages.destroy', $otherUserLandingPage->uuid)); 134 | 135 | // Assert 136 | $response->assertStatus(404); 137 | $this->assertDatabaseCount('users', 2); 138 | $this->assertDatabaseCount('accounts', 2); 139 | $this->assertDatabaseCount('landing_pages', 1); 140 | $this->assertDatabaseHas('landing_pages', [ 141 | 'uuid' => $otherUserLandingPage->uuid, 142 | 'deleted_at' => null, 143 | ]); 144 | } 145 | 146 | public function test_a_user_can_create_a_landing_page() 147 | { 148 | // Arrange 149 | /** @var \App\Models\User $user */ 150 | $user = User::factory()->create(); 151 | Account::factory()->for(($user))->create(); 152 | 153 | // Pre assert 154 | $this->assertDatabaseCount('users', 1); 155 | $this->assertDatabaseCount('accounts', 1); 156 | $this->assertDatabaseCount('landing_pages', 0); 157 | 158 | // Act 159 | $this->actingAs($user); 160 | $response = $this->postJson(route('landing-pages.store'), [ 161 | 'name' => 'New landing pages name', 162 | ]); 163 | 164 | // Assert 165 | $response->assertStatus(201); 166 | $this->assertDatabaseCount('users', 1); 167 | $this->assertDatabaseCount('accounts', 1); 168 | $this->assertDatabaseCount('landing_pages', 1); 169 | $this->assertDatabaseHas('landing_pages', [ 170 | 'name' => 'New landing pages name', 171 | 'deleted_at' => null, 172 | ]); 173 | } 174 | 175 | public function test_the_name_is_required() 176 | { 177 | // Arrange 178 | /** @var \App\Models\User $user */ 179 | $user = User::factory()->create(); 180 | Account::factory()->for(($user))->create(); 181 | 182 | // Pre assert 183 | $this->assertDatabaseCount('users', 1); 184 | $this->assertDatabaseCount('accounts', 1); 185 | $this->assertDatabaseCount('landing_pages', 0); 186 | 187 | // Act 188 | $this->actingAs($user); 189 | $response = $this->postJson(route('landing-pages.store'), [ 190 | 'name' => null, 191 | ]); 192 | 193 | // Assert 194 | $response->assertStatus(422); 195 | $response->assertJsonFragment([ 196 | 0 => 'The name field is required.', 197 | 0 => 'The slug field is required.', 198 | ]); 199 | $this->assertDatabaseCount('users', 1); 200 | $this->assertDatabaseCount('accounts', 1); 201 | $this->assertDatabaseCount('landing_pages', 0); 202 | } 203 | 204 | public function test_only_authenticated_users_can_create_landing_pages() 205 | { 206 | // Arrange 207 | 208 | // Pre assert 209 | $this->assertDatabaseCount('users', 0); 210 | $this->assertDatabaseCount('accounts', 0); 211 | $this->assertDatabaseCount('landing_pages', 0); 212 | 213 | // Act 214 | Auth::logout(); 215 | $response = $this->postJson(route('landing-pages.store'), [ 216 | 'name' => 'It doesn\'t matter', 217 | ]); 218 | 219 | // Assert 220 | $response->assertStatus(401); 221 | $this->assertDatabaseCount('users', 0); 222 | $this->assertDatabaseCount('accounts', 0); 223 | $this->assertDatabaseCount('landing_pages', 0); 224 | } 225 | 226 | public function test_guest_users_can_view_a_published_landingpage() 227 | { 228 | // Arrange 229 | $landingPage = LandingPage::factory()->create([ 230 | 'name' => 'Test Landing Page', 231 | 'slug' => 'test-landing-page', 232 | ]); 233 | 234 | // Pre assert 235 | $this->assertDatabaseCount('landing_pages', 1); 236 | 237 | // Act 238 | Auth::logout(); 239 | $response = $this->getJson(route('public.landing-pages.show', $landingPage->slug)); 240 | 241 | // Assert 242 | $response->assertStatus(200); 243 | } 244 | 245 | } 246 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /webpack.mix.js: -------------------------------------------------------------------------------- 1 | const mix = require('laravel-mix'); 2 | 3 | /* 4 | |-------------------------------------------------------------------------- 5 | | Mix Asset Management 6 | |-------------------------------------------------------------------------- 7 | | 8 | | Mix provides a clean, fluent API for defining some Webpack build steps 9 | | for your Laravel applications. By default, we are compiling the CSS 10 | | file for the application as well as bundling up all the JS files. 11 | | 12 | */ 13 | 14 | mix.js('resources/js/app.js', 'public/js') 15 | .postCss('resources/css/app.css', 'public/css', [ 16 | // 17 | ]); 18 | --------------------------------------------------------------------------------