├── public ├── favicon.ico ├── robots.txt ├── images │ ├── card-gradient.png │ ├── card-gradient-teal.png │ ├── logo-dark.svg │ ├── logo-light.svg │ ├── logo-light-teal.svg │ └── abstract-1.svg ├── build │ ├── assets │ │ ├── Logout.f87497ed.js │ │ ├── Login.957ed9f7.js │ │ ├── Register.431fd2c3.js │ │ ├── Lists.194129ab.js │ │ ├── Portals.32e25f1a.js │ │ ├── Meself.0010e2c3.js │ │ └── vform.es.531cc530.js │ └── manifest.json ├── .htaccess └── index.php ├── database ├── .gitignore ├── seeders │ └── DatabaseSeeder.php ├── migrations │ ├── 2022_10_17_101858_create_teams_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2022_10_17_102845_create_team_user_table.php │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ └── 2022_10_23_095951_create_portals_table.php └── factories │ └── UserFactory.php ├── bootstrap ├── cache │ └── .gitignore └── app.php ├── storage ├── logs │ └── .gitignore ├── app │ ├── public │ │ └── .gitignore │ └── .gitignore └── framework │ ├── testing │ └── .gitignore │ ├── views │ └── .gitignore │ ├── cache │ ├── data │ │ └── .gitignore │ └── .gitignore │ ├── sessions │ └── .gitignore │ └── .gitignore ├── Procfile ├── resources ├── js │ ├── store │ │ ├── index.js │ │ ├── hubspot.js │ │ └── auth.js │ ├── api │ │ └── axios.js │ ├── pages │ │ ├── auth │ │ │ ├── Logout.vue │ │ │ ├── Login.vue │ │ │ ├── Register.vue │ │ │ ├── Portals.vue │ │ │ └── Meself.vue │ │ └── hubspot │ │ │ ├── Lists.vue │ │ │ └── Tables.vue │ ├── plugins │ │ └── font-loader.js │ ├── app.js │ ├── router │ │ ├── index.js │ │ └── routes.js │ └── bootstrap.js ├── css │ ├── tailwind.css │ ├── app.css │ └── sass │ │ └── main.scss └── views │ └── app.blade.php ├── postcss.config.js ├── captain-definition ├── .deploy ├── config │ ├── crontab │ ├── php │ │ └── local.ini │ ├── Caddyfile │ └── supervisor.conf ├── entrypoint.sh └── Dockerfile ├── tests ├── TestCase.php ├── Unit │ └── ExampleTest.php ├── Feature │ └── ExampleTest.php └── CreatesApplication.php ├── .gitattributes ├── app ├── Models │ ├── Portal.php │ ├── TeamUser.php │ ├── Team.php │ └── User.php ├── Http │ ├── Middleware │ │ ├── EncryptCookies.php │ │ ├── VerifyCsrfToken.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── TrustHosts.php │ │ ├── TrimStrings.php │ │ ├── Authenticate.php │ │ ├── ValidateSignature.php │ │ ├── TrustProxies.php │ │ ├── RedirectIfAuthenticated.php │ │ └── UserTeam.php │ ├── Controllers │ │ ├── Controller.php │ │ ├── AuthController.php │ │ ├── PortalController.php │ │ ├── TeamController.php │ │ └── HubSpotAuthController.php │ └── Kernel.php ├── Providers │ ├── BroadcastServiceProvider.php │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── EventServiceProvider.php │ └── RouteServiceProvider.php ├── Console │ └── Kernel.php ├── Exceptions │ └── Handler.php └── Traits │ └── HubSpotTrait.php ├── .gitignore ├── .editorconfig ├── tailwind.config.js ├── lang └── en │ ├── pagination.php │ ├── auth.php │ ├── passwords.php │ └── validation.php ├── routes ├── channels.php ├── console.php ├── web.php └── api.php ├── vite.config.js ├── config ├── cors.php ├── services.php ├── view.php ├── hashing.php ├── broadcasting.php ├── sanctum.php ├── filesystems.php ├── queue.php ├── cache.php ├── mail.php ├── auth.php ├── logging.php ├── database.php ├── session.php └── app.php ├── phpunit.xml ├── package.json ├── .env.example ├── artisan ├── composer.json └── README.md /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: vendor/bin/heroku-php-apache2 public/ -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /resources/js/store/index.js: -------------------------------------------------------------------------------- 1 | export * from './auth'; 2 | export * from './hubspot'; -------------------------------------------------------------------------------- /resources/css/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | }, 5 | }; -------------------------------------------------------------------------------- /captain-definition: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion" :2 , 3 | "dockerfilePath" : "./.deploy/Dockerfile" 4 | } 5 | 6 | -------------------------------------------------------------------------------- /.deploy/config/crontab: -------------------------------------------------------------------------------- 1 | * * * * * /usr/local/bin/php /srv/app/artisan schedule:run > /proc/1/fd/1 2>/proc/1/fd/2 2 | -------------------------------------------------------------------------------- /.deploy/config/php/local.ini: -------------------------------------------------------------------------------- 1 | memory_limit = 512M 2 | max_execution_time = 30 3 | upload_max_filesize = 30M 4 | post_max_size = 35M 5 | -------------------------------------------------------------------------------- /public/images/card-gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evendrop/laravel-hubspot-starter-kit/HEAD/public/images/card-gradient.png -------------------------------------------------------------------------------- /public/images/card-gradient-teal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/evendrop/laravel-hubspot-starter-kit/HEAD/public/images/card-gradient-teal.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | { 4 | const token = $cookies.get("token") 5 | request.headers.Authorization = `Bearer ${token}` 6 | return request; 7 | }, function(error) { 8 | return Promise.reject(error); 9 | }); -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /app/Models/TeamUser.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /public/build/assets/Logout.f87497ed.js: -------------------------------------------------------------------------------- 1 | import{_ as t,u as o,r as s}from"./app.b5f93124.js";/* empty css */const a={name:"Logout",props:{},data:()=>({auth:o()}),async mounted(){await axios.get(route("auth.logout")),this.auth.setIsLoggedIn(!1),this.auth.update(),s.push("/login")},methods:{}};function e(u,r,n,p,c,h){return null}const _=t(a,[["render",e]]);export{_ as default}; 2 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | mode: "jit", 4 | purge: ["./resources/**/*.blade.php", "./resources/**/*.vue"], 5 | theme: { 6 | screens: { 7 | sm: '480px', 8 | md: '768px', 9 | lg: '976px', 10 | xl: '1440px', 11 | } 12 | }, 13 | variants: {}, 14 | plugins: [ 15 | {divideStyle: true} 16 | ], 17 | } -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /.deploy/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "🎬 entrypoint.sh: [$(whoami)] [PHP $(php -r 'echo phpversion();')]" 4 | 5 | composer dump-autoload --no-interaction --no-dev --optimize 6 | 7 | echo "🎬 artisan commands" 8 | 9 | # 💡 Group into a custom command e.g. php artisan app:on-deploy 10 | php artisan migrate --no-interaction --force 11 | 12 | echo "🎬 start supervisord" 13 | 14 | supervisord -c $LARAVEL_PATH/.deploy/config/supervisor.conf -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Laravel HubSpot Starter Kit 7 | 8 | @vite('resources/css/app.css') 9 | @routes 10 | 11 | 12 |
13 | 14 | @vite('resources/js/app.js') 15 | 16 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /resources/js/plugins/font-loader.js: -------------------------------------------------------------------------------- 1 | import { library } from '@fortawesome/fontawesome-svg-core' 2 | 3 | import { 4 | faUsers, 5 | faLock, 6 | faUserPlus, 7 | faRightToBracket, 8 | faList 9 | } from '@fortawesome/free-solid-svg-icons' 10 | 11 | import { 12 | faHubspot, 13 | faGithub 14 | } from '@fortawesome/free-brands-svg-icons' 15 | 16 | library.add( 17 | faUsers, 18 | faLock, 19 | faHubspot, 20 | faUserPlus, 21 | faRightToBracket, 22 | faList, 23 | faGithub 24 | ) 25 | -------------------------------------------------------------------------------- /.deploy/config/Caddyfile: -------------------------------------------------------------------------------- 1 | :80 { 2 | root * /srv/app/public 3 | 4 | @websockets { 5 | header Connection *upgrade* 6 | header Upgrade websocket 7 | } 8 | reverse_proxy @websockets 127.0.0.1:6001 { 9 | header_down -X-Powered-By 10 | } 11 | 12 | redir /index.php / 308 13 | redir /index.php/ / 308 14 | route /index.php/* { 15 | uri strip_prefix /index.php 16 | redir {path} 308 17 | } 18 | 19 | php_fastcgi 127.0.0.1:9000 20 | encode gzip 21 | header -X-Powered-By 22 | file_server 23 | log 24 | } 25 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | create(); 18 | 19 | // \App\Models\User::factory()->create([ 20 | // 'name' => 'Test User', 21 | // 'email' => 'test@example.com', 22 | // ]); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /app/Models/Team.php: -------------------------------------------------------------------------------- 1 | belongsToMany(User::class); 24 | } 25 | public function portals() { 26 | return $this->hasMany(Portal::class); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | import vue from '@vitejs/plugin-vue' 4 | import basicSsl from '@vitejs/plugin-basic-ssl' 5 | 6 | export default defineConfig({ 7 | plugins: [ 8 | basicSsl(), 9 | vue({ 10 | template: { 11 | transformAssetUrls: { 12 | base: null, 13 | includeAbsolute: false, 14 | }, 15 | }, 16 | }), 17 | laravel({ 18 | input: ['resources/css/app.css', 'resources/js/app.js'], 19 | refresh: true, 20 | }), 21 | ], 22 | server: { 23 | https: true 24 | } 25 | }); 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import { createPinia } from 'pinia' 2 | const pinia = createPinia() 3 | 4 | import { createApp } from 'vue' 5 | import VueCookies from 'vue-cookies' 6 | 7 | import router from '@/router' 8 | import { useRoute } from 'vue-router'; 9 | const route = useRoute(); 10 | 11 | import App from '@/components/App.vue' 12 | 13 | 14 | 15 | import './bootstrap' 16 | import '../css/app.css'; 17 | 18 | import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' 19 | import './plugins/font-loader.js'; 20 | 21 | import Popper from "vue3-popper"; 22 | 23 | const app = createApp(App) 24 | app.component('font-awesome-icon', FontAwesomeIcon) 25 | app.component("Popper", Popper) 26 | app.use(pinia) 27 | app.use(VueCookies) 28 | app.use(router) 29 | app.use(route) 30 | app.mount('#app') 31 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /database/migrations/2022_10_17_101858_create_teams_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->timestamps(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('teams'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | where('any', '.*'); -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /resources/js/router/index.js: -------------------------------------------------------------------------------- 1 | import routes from './routes' 2 | import { createRouter, createWebHistory } from 'vue-router' 3 | import axios from 'axios' 4 | import { useAuthStore } from '@/store/auth' 5 | 6 | const router = makeRouter() 7 | 8 | export default router 9 | 10 | function makeRouter() { 11 | const router = new createRouter({ 12 | history: createWebHistory(), 13 | routes 14 | }) 15 | 16 | router.beforeEach(beforeEach) 17 | router.afterEach(afterEach) 18 | 19 | return router 20 | } 21 | 22 | async function beforeEach(to, from) { 23 | 24 | const authStore = useAuthStore() 25 | 26 | if (to.meta.requiresAuth) { 27 | const res = await axios.get(route('user.check.get')) 28 | if (!res.data) { 29 | return { name: 'login' } 30 | } else { 31 | authStore.setIsLoggedIn(true) 32 | authStore.update() 33 | } 34 | } 35 | } 36 | 37 | function afterEach() { 38 | 39 | } -------------------------------------------------------------------------------- /resources/js/store/hubspot.js: -------------------------------------------------------------------------------- 1 | import { defineStore } from 'pinia' 2 | 3 | export const useHubSpotPortalsStore = defineStore({ 4 | id: 'HubSpotPortals', 5 | state: () => ({ 6 | portals: [] 7 | }), 8 | actions: { 9 | async fetchPortals() { 10 | const res = await axios.get(route("portals.index")); 11 | this.portals = res.data.portals; 12 | }, 13 | reset() { 14 | this.fetchPortals() 15 | } 16 | }, 17 | }) 18 | 19 | export const useHubSpotListsStore = defineStore({ 20 | id: 'HubSpotLists', 21 | state: () => ({ 22 | loading: true, 23 | lists: [] 24 | }), 25 | actions: { 26 | async fetchLists(){ 27 | this.loading = true 28 | const res = await axios.get(route('hs-lists.get')) 29 | this.lists = res.data.lists 30 | this.loading = false 31 | }, 32 | reset() { 33 | this.fetchLists() 34 | } 35 | }, 36 | }) -------------------------------------------------------------------------------- /database/migrations/2022_10_17_102845_create_team_user_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->foreignId('user_id'); 19 | $table->foreignId('team_id'); 20 | $table->tinyInteger('primary')->default(0); 21 | $table->tinyInteger('last_used')->default(0); 22 | }); 23 | } 24 | 25 | /** 26 | * Reverse the migrations. 27 | * 28 | * @return void 29 | */ 30 | public function down() 31 | { 32 | Schema::dropIfExists('team_user'); 33 | } 34 | }; 35 | -------------------------------------------------------------------------------- /config/cors.php: -------------------------------------------------------------------------------- 1 | ['api/*', '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' => false, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamp('expires_at')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('personal_access_tokens'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /resources/js/router/routes.js: -------------------------------------------------------------------------------- 1 | 2 | export default [ 3 | { 4 | path: '/', 5 | name: 'home', 6 | redirect: { name: 'login' } 7 | }, 8 | { 9 | path: '/login', 10 | name: 'login', 11 | component: () => import('@/pages/auth/Login.vue') 12 | }, 13 | { 14 | path: '/register', 15 | name: 'register', 16 | component: () => import('@/pages/auth/Register.vue') 17 | }, 18 | { 19 | path: '/logout', 20 | name: 'logout', 21 | component: () => import('@/pages/auth/Logout.vue') 22 | }, 23 | { 24 | path: '/me', 25 | name: 'me', 26 | component: () => import('@/pages/auth/Meself.vue'), 27 | meta: {requiresAuth: true} 28 | }, 29 | { 30 | path: '/portals', 31 | name: 'portals', 32 | component: () => import('@/pages/auth/Portals.vue'), 33 | meta: {requiresAuth: true} 34 | }, 35 | { 36 | path: '/hs/lists', 37 | name: 'lists', 38 | component: () => import('@/pages/hubspot/Lists.vue'), 39 | meta: {requiresAuth: true} 40 | } 41 | ] -------------------------------------------------------------------------------- /app/Providers/EventServiceProvider.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 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->unique()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | } 28 | 29 | /** 30 | * Indicate that the model's email address should be unverified. 31 | * 32 | * @return static 33 | */ 34 | public function unverified() 35 | { 36 | return $this->state(fn (array $attributes) => [ 37 | 'email_verified_at' => null, 38 | ]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /resources/js/store/auth.js: -------------------------------------------------------------------------------- 1 | import { defineStore } from 'pinia' 2 | 3 | export const useAuthStore = defineStore({ 4 | id: 'Auth', 5 | state: () => ({ 6 | loggedIn: false, 7 | team: null, 8 | hub: null, 9 | teams: null , 10 | hubs: null 11 | }), 12 | getters: { 13 | isLoggedIn: (state) => state.loggedIn 14 | }, 15 | actions: { 16 | setIsLoggedIn(val) { 17 | this.loggedIn = val 18 | }, 19 | setTeam(team){ 20 | this.team = team 21 | }, 22 | setHub(hub){ 23 | this.hub = hub 24 | }, 25 | setTeams(teams){ 26 | this.teams = teams 27 | }, 28 | setHubs(hubs){ 29 | this.hubs = hubs 30 | }, 31 | async update(callback){ 32 | if(this.isLoggedIn){ 33 | const res = await axios.post(route("post.me")); 34 | this.setTeam(res.data.team) 35 | this.setHub(res.data.portal) 36 | this.setTeams(res.data.teams) 37 | this.setHubs(this.team.portals) 38 | } 39 | void 0 !== callback ? callback() : null 40 | }, 41 | 42 | async logout() { 43 | this.$reset(); 44 | }, 45 | }, 46 | }) -------------------------------------------------------------------------------- /database/migrations/2022_10_23_095951_create_portals_table.php: -------------------------------------------------------------------------------- 1 | id(); 19 | $table->foreignId('user_id'); 20 | $table->foreignId('team_id'); 21 | $table->string('hub__id')->nullable(); 22 | $table->string('hub__name')->nullable(); 23 | $table->string('hub__user_email')->nullable(); 24 | $table->string('hub__domain')->nullable(); 25 | $table->dateTime('token_expires'); 26 | $table->string('refresh_token'); 27 | $table->string('access_token'); 28 | $table->timestamps(); 29 | 30 | }); 31 | } 32 | 33 | /** 34 | * Reverse the migrations. 35 | * 36 | * @return void 37 | */ 38 | public function down() 39 | { 40 | Schema::dropIfExists('portals'); 41 | } 42 | }; 43 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "engines": { 4 | "node": "v16.13.1" 5 | }, 6 | "scripts": { 7 | "dev": "vite --https", 8 | "build": "vite build", 9 | "deploy": "caprover deploy -d", 10 | "php": "valet use php@8.1 && php artisan cache:clear && php artisan view:clear" 11 | }, 12 | "devDependencies": { 13 | "autoprefixer": "^10.4.12", 14 | "axios": "^1.1.2", 15 | "laravel-vite-plugin": "^0.6.0", 16 | "lodash": "^4.17.19", 17 | "postcss": "^8.4.17", 18 | "tailwindcss": "^3.1.8", 19 | "vite": "^3.0.0" 20 | }, 21 | "dependencies": { 22 | "@fortawesome/fontawesome-svg-core": "^6.2.0", 23 | "@fortawesome/free-brands-svg-icons": "^6.2.0", 24 | "@fortawesome/free-regular-svg-icons": "^6.2.0", 25 | "@fortawesome/free-solid-svg-icons": "^6.2.0", 26 | "@fortawesome/vue-fontawesome": "^3.0.1", 27 | "@vitejs/plugin-basic-ssl": "^0.1.2", 28 | "@vitejs/plugin-vue": "^3.1.2", 29 | "pinia": "^2.0.23", 30 | "vform": "^2.1.2", 31 | "vue": "^3.2.40", 32 | "vue-cookies": "^1.8.1", 33 | "vue-meta": "^3.0.0-alpha.2", 34 | "vue-router": "^4.1.5", 35 | "vue3-popper": "^1.5.0" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/Http/Middleware/UserTeam.php: -------------------------------------------------------------------------------- 1 | user())){ 24 | 25 | // make sure a session id is set and that the session id belongs to the user 26 | 27 | if(!session()->has('alias') || !TeamUser::whereUserId(auth()->user()->id)->whereTeamId(session('alias'))->exists()){ 28 | 29 | $team_id = TeamUser::whereUserId(auth()->user()->id)->wherePrimary(1)->first()->id; 30 | $portal = Portal::whereTeamId($team_id)->first(); 31 | 32 | session()->put('alias', $team_id); 33 | session()->put('portal', $portal); 34 | } 35 | 36 | } 37 | 38 | return $next($request); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | axios.defaults.withCredentials = true; 12 | 13 | window.axios = axios; 14 | 15 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 16 | 17 | /** 18 | * Echo exposes an expressive API for subscribing to channels and listening 19 | * for events that are broadcast by Laravel. Echo and event broadcasting 20 | * allows your team to easily build robust real-time web applications. 21 | */ 22 | 23 | // import Echo from 'laravel-echo'; 24 | 25 | // import Pusher from 'pusher-js'; 26 | // window.Pusher = Pusher; 27 | 28 | // window.Echo = new Echo({ 29 | // broadcaster: 'pusher', 30 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 31 | // wsHost: import.meta.env.VITE_PUSHER_HOST ?? `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 32 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 33 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 34 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 35 | // enabledTransports: ['ws', 'wss'], 36 | // }); 37 | -------------------------------------------------------------------------------- /.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=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=hs_starter_kit 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=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="hello@example.com" 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_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | 60 | HS_AUTH_URL=https://app.hubspot.com/oauth/authorize 61 | HS_APP_ID= 62 | HS_CLIENT_ID= 63 | HS_CLIENT_SECRET= -------------------------------------------------------------------------------- /.deploy/config/supervisor.conf: -------------------------------------------------------------------------------- 1 | [supervisord] 2 | logfile=/dev/null 3 | logfile_maxbytes=0 4 | logfile_backups=0 5 | loglevel=info 6 | nodaemon=true 7 | 8 | [program:php-fpm] 9 | command=php-fpm --nodaemonize 10 | autorestart=true 11 | stdout_events_enabled=true 12 | stderr_events_enabled=true 13 | stdout_logfile_maxbytes=0 14 | stderr_logfile_maxbytes=0 15 | stdout_logfile=/dev/stdout 16 | stderr_logfile=/dev/stderr 17 | 18 | [program:caddy] 19 | command=caddy run --config %(ENV_LARAVEL_PATH)s/.deploy/config/Caddyfile 20 | autorestart=true 21 | stdout_events_enabled=true 22 | stderr_events_enabled=true 23 | stdout_logfile_maxbytes=0 24 | stderr_logfile_maxbytes=0 25 | stdout_logfile=/dev/stdout 26 | stderr_logfile=/dev/stderr 27 | 28 | [program:cron] 29 | command=crond -l 2 -f 30 | autorestart=true 31 | 32 | ; [program:horizon] 33 | ; command=php %(ENV_LARAVEL_PATH)s/artisan horizon 34 | ; autorestart=true 35 | ; stdout_events_enabled=true 36 | ; stderr_events_enabled=true 37 | ; stdout_logfile_maxbytes=0 38 | ; stderr_logfile_maxbytes=0 39 | ; stdout_logfile=/dev/stdout 40 | ; stderr_logfile=/dev/stderr 41 | ; stopwaitsecs=3600 42 | 43 | ; [program:websockets] 44 | ; command=php %(ENV_LARAVEL_PATH)s/artisan websockets:serve --port=6001 45 | ; numprocs=1 46 | ; autorestart=true 47 | ; stdout_events_enabled=true 48 | ; stderr_events_enabled=true 49 | ; stdout_logfile_maxbytes=0 50 | ; stderr_logfile_maxbytes=0 51 | ; stdout_logfile=/dev/stdout 52 | ; stderr_logfile=/dev/stderr 53 | -------------------------------------------------------------------------------- /app/Traits/HubSpotTrait.php: -------------------------------------------------------------------------------- 1 | firstOrFail(); 14 | $portal = Portal::whereTeamId($team->id)->whereId(session('portal')['id'])->firstOrFail(); 15 | 16 | $query = [ 17 | 'grant_type' => 'refresh_token', 18 | 'client_id' => env('HS_CLIENT_ID'), 19 | 'client_secret' => env('HS_CLIENT_SECRET'), 20 | 'refresh_token' => $portal->refresh_token 21 | ]; 22 | 23 | $client = new Client(); 24 | 25 | try{ 26 | $token_response = $client->request('POST', 'https://api.hubapi.com/oauth/v1/token', [ 27 | 'query' => $query, 28 | 'headers' => ['Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8'] 29 | ]); 30 | $token_response = json_decode($token_response->getBody(), true); 31 | } catch (\Exception $e) { 32 | \Log::info($e->getMessage()); 33 | die; 34 | } 35 | 36 | $portal->token_expires = \Carbon\Carbon::now()->addSecond($token_response['expires_in']); 37 | $portal->access_token = $token_response['access_token']; 38 | 39 | $portal->save(); 40 | 41 | return $token_response['access_token']; 42 | } 43 | 44 | } -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 20 | */ 21 | protected $fillable = [ 22 | 'name', 23 | 'email', 24 | 'password', 25 | ]; 26 | 27 | /** 28 | * The attributes that should be hidden for serialization. 29 | * 30 | * @var array 31 | */ 32 | protected $hidden = [ 33 | 'password', 34 | 'remember_token', 35 | ]; 36 | 37 | /** 38 | * The attributes that should be cast. 39 | * 40 | * @var array 41 | */ 42 | protected $casts = [ 43 | 'email_verified_at' => 'datetime', 44 | ]; 45 | 46 | public function teams() { 47 | return $this->belongsToMany(Team::class); 48 | } 49 | 50 | public static function create(array $attributes = []){ 51 | 52 | $model = static::query()->create($attributes); 53 | 54 | $team = Team::create([ 55 | 'name' => $model->name . ' Team' 56 | ]); 57 | 58 | $team->users()->attach($model, ['primary' => 1, 'last_used' => 1]); 59 | 60 | return $model; 61 | 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /public/build/assets/Login.957ed9f7.js: -------------------------------------------------------------------------------- 1 | import{_ as m,u as p,r as c,a as u,o as f,c as g,b as s,w as h,d as a,v as n,n as i,e as l,f as x,g as w}from"./app.b5f93124.js";import{g as v}from"./vform.es.531cc530.js";/* empty css */const _={name:"Login",props:{},data:()=>({auth:p(),loginModel:new v({email:"",password:""})}),mounted(){},methods:{async loginUser(){try{const e=await axios.post(route("post.login"),this.loginModel);this.auth.setIsLoggedIn(!0),c.push("/portals")}catch(e){console.log(e)}}}},b={class:"block justify-center items-center p-4 mx-4 mt-4 mb-6"},M={class:"min-h-[50vh] flex flex-col"},y={class:"container max-w-sm mx-auto flex-1 flex flex-col items-center justify-center px-2"},k=s("h1",{class:"text-[#202030] text-center mb-10"},"Sign in",-1),V=s("button",{type:"submit",class:"btn w-full"},"Log in",-1),L={class:"text-[#818479] font-light mt-6 text-center text-sm"};function N(e,o,U,$,B,r){const d=u("router-link");return f(),g("div",b,[s("div",M,[s("div",y,[s("form",{class:"bg-[#edf5ff] px-6 py-8 rounded shadow-2xl text-black w-full",onSubmit:o[2]||(o[2]=h(t=>r.loginUser(),["prevent"]))},[k,a(s("input",{"onUpdate:modelValue":o[0]||(o[0]=t=>e.loginModel.email=t),class:i({"is-invalid":e.loginModel.errors.has("email")}),type:"email",name:"email",placeholder:"Email"},null,2),[[n,e.loginModel.email]]),a(s("input",{"onUpdate:modelValue":o[1]||(o[1]=t=>e.loginModel.password=t),class:i({"is-invalid":e.loginModel.errors.has("password")}),type:"password",name:"password",placeholder:"Password"},null,2),[[n,e.loginModel.password]]),V,s("div",L,[l(" Need an account? "),x(d,{to:{name:"register"}},{default:w(()=>[l("Register")]),_:1}),l(". ")])],32)])])])}const E=m(_,[["render",N]]);export{E as default}; 2 | -------------------------------------------------------------------------------- /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' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /resources/js/pages/auth/Login.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /public/build/assets/Register.431fd2c3.js: -------------------------------------------------------------------------------- 1 | import{_ as d,u as p,r as m,a as u,o as c,c as f,b as e,w as g,d as r,v as a,e as n,f as h,g as w}from"./app.b5f93124.js";import{g as x}from"./vform.es.531cc530.js";/* empty css */const _={name:"Login",props:{},data:()=>({auth:p(),registerModel:new x({email:"",password:"",password:""})}),mounted(){},methods:{async registerUser(){try{const t=await axios.post(route("post.register"),this.registerModel);this.auth.setIsLoggedIn(!0),this.auth.update(()=>m.push("/portals"))}catch(t){console.log(t)}}}},v={class:"block justify-center items-center p-4 mx-4 mt-4 mb-6"},y={class:"min-h-[50vh] flex flex-col"},b={class:"container max-w-sm mx-auto flex-1 flex flex-col items-center justify-center px-2"},M=e("h1",{class:"text-[#202030] text-center mb-10"},"Sign up",-1),k=e("input",{type:"password",name:"confirm_password",placeholder:"Confirm Password"},null,-1),V=e("button",{type:"submit",class:"btn w-full"},"Create Account",-1),U={class:"text-[#818479] font-light mt-6 text-center text-sm"};function C(t,s,N,$,A,l){const i=u("router-link");return c(),f("div",v,[e("div",y,[e("div",b,[e("form",{class:"bg-[#edf5ff] px-6 py-8 rounded shadow-2xl text-black w-full",onSubmit:s[3]||(s[3]=g(o=>l.registerUser(),["prevent"]))},[M,r(e("input",{type:"text",name:"name","onUpdate:modelValue":s[0]||(s[0]=o=>t.registerModel.name=o),placeholder:"Full Name"},null,512),[[a,t.registerModel.name]]),r(e("input",{type:"text",name:"email","onUpdate:modelValue":s[1]||(s[1]=o=>t.registerModel.email=o),placeholder:"Email"},null,512),[[a,t.registerModel.email]]),r(e("input",{type:"password",name:"password","onUpdate:modelValue":s[2]||(s[2]=o=>t.registerModel.password=o),placeholder:"Password"},null,512),[[a,t.registerModel.password]]),k,V,e("div",U,[n(" Already have an account? "),h(i,{to:{name:"login"}},{default:w(()=>[n("Log in")]),_:1}),n(". ")])],32)])])])}const j=d(_,[["render",C]]);export{j as default}; 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /resources/css/sass/main.scss: -------------------------------------------------------------------------------- 1 | body { 2 | @apply bg-[#171721]; 3 | font-family: 'Noto Sans', sans-serif; 4 | } 5 | 6 | h1 { 7 | @apply mb-2 text-3xl font-extrabold text-[#ffffff] 8 | } 9 | 10 | select, 11 | textarea, 12 | input[type="text"], 13 | input[type="password"], 14 | input[type="datetime"], 15 | input[type="date"], 16 | input[type="month"], 17 | input[type="time"], 18 | input[type="number"], 19 | input[type="email"], 20 | input[type="url"], 21 | input[type="search"], 22 | input[type="tel"] { 23 | @apply block shadow w-full p-3 rounded mb-4 bg-white text-[#5e60bc] 24 | } 25 | 26 | button:not(.naked), .btn { 27 | @apply inline-block text-center px-5 py-3 rounded bg-[#7678ED] text-white hover:bg-[#5e60bc] hover:text-white focus:outline-none my-1 transition duration-500 ease-in-out border-0 28 | } 29 | .btn.hubspot { 30 | @apply bg-[#cf5e41] hover:bg-[#b25138] 31 | } 32 | .btn-with-icon { 33 | @apply flex justify-center items-center 34 | } 35 | 36 | a { 37 | @apply no-underline border-b border-[#7678ED] text-[#7678ED] hover:text-[#5e60bc] hover:border-[#5e60bc] font-medium transition duration-500 ease-in-out 38 | } 39 | 40 | input:-webkit-autofill, 41 | input:-webkit-autofill:hover, 42 | input:-webkit-autofill:focus, 43 | input:-webkit-autofill:active { 44 | -webkit-box-shadow: 0 0 0 30px white inset !important; 45 | box-shadow: 0 0 0 30px white inset !important; 46 | border: 1px solid rgb(222, 222, 222); 47 | } 48 | 49 | .sidebar-link { 50 | @apply flex items-center text-[#ffffff] hover:text-[#20E3C3] p-4 mb-2 mt-2 text-[16px] border-0 51 | } 52 | .card { 53 | @apply overflow-hidden bg-[#22222C] rounded-3xl p-12 54 | } 55 | .card-gradient-teal { 56 | @apply w-full h-full top-0 right-0 absolute; 57 | background: url('/images/card-gradient-teal.png') no-repeat; 58 | background-position: top right; 59 | } 60 | .subtext, .muted { 61 | @apply text-[#707A9C] 62 | } 63 | 64 | .bg-mute { 65 | opacity: 0.01; 66 | } -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 22 | return $request->user(); 23 | }); 24 | 25 | Route::get('/user/check', function (Request $request) { 26 | return \Auth::check() ? 1 : 0; 27 | })->name('user.check.get'); 28 | 29 | Route::post('/register', [AuthController::class, 'register'])->name('post.register'); 30 | Route::post('/login', [AuthController::class, 'login'])->name('post.login'); 31 | Route::post('/me', [AuthController::class, 'me'])->middleware('auth:sanctum')->name('post.me'); 32 | 33 | Route::get('/auth-logout', function (Request $request) { 34 | Auth::logout(); 35 | $request->session()->invalidate(); 36 | $request->session()->regenerateToken(); 37 | return redirect('/login'); 38 | })->name('auth.logout'); 39 | 40 | Route::group(['middleware' => 'auth'], function(){ 41 | 42 | Route::resource('portals', PortalController::class); 43 | Route::resource('teams', TeamController::class); 44 | Route::post('portals-alias-as', [PortalController::class, 'aliasAs'])->name('portals.alias-as'); 45 | Route::post('teams-alias-as', [TeamController::class, 'aliasAs'])->name('teams.alias-as'); 46 | Route::get('hubdb/tables', [HubSpotAuthController::class, 'tables'])->name('hubdb-tables.get'); 47 | Route::get('hs/lists', [HubSpotAuthController::class, 'lists'])->name('hs-lists.get'); 48 | 49 | }); -------------------------------------------------------------------------------- /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": "^8.0.2", 9 | "guzzlehttp/guzzle": "^7.2", 10 | "laravel/framework": "^9.19", 11 | "laravel/sanctum": "^3.0", 12 | "laravel/tinker": "^2.7", 13 | "tightenco/ziggy": "^1.5" 14 | }, 15 | "require-dev": { 16 | "fakerphp/faker": "^1.9.1", 17 | "laravel/pint": "^1.0", 18 | "laravel/sail": "^1.0.1", 19 | "mockery/mockery": "^1.4.4", 20 | "nunomaduro/collision": "^6.1", 21 | "phpunit/phpunit": "^9.5.10", 22 | "spatie/laravel-ignition": "^1.0" 23 | }, 24 | "autoload": { 25 | "psr-4": { 26 | "App\\": "app/", 27 | "Database\\Factories\\": "database/factories/", 28 | "Database\\Seeders\\": "database/seeders/" 29 | } 30 | }, 31 | "autoload-dev": { 32 | "psr-4": { 33 | "Tests\\": "tests/" 34 | } 35 | }, 36 | "scripts": { 37 | "post-autoload-dump": [ 38 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 39 | "@php artisan package:discover --ansi" 40 | ], 41 | "post-update-cmd": [ 42 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 43 | ], 44 | "post-root-package-install": [ 45 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 46 | ], 47 | "post-create-project-cmd": [ 48 | "@php artisan key:generate --ansi" 49 | ] 50 | }, 51 | "extra": { 52 | "laravel": { 53 | "dont-discover": [] 54 | } 55 | }, 56 | "config": { 57 | "optimize-autoloader": true, 58 | "preferred-install": "dist", 59 | "sort-packages": true, 60 | "allow-plugins": { 61 | "pestphp/pest-plugin": true 62 | } 63 | }, 64 | "minimum-stability": "dev", 65 | "prefer-stable": true 66 | } 67 | -------------------------------------------------------------------------------- /resources/js/pages/auth/Register.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | -------------------------------------------------------------------------------- /app/Http/Controllers/AuthController.php: -------------------------------------------------------------------------------- 1 | validate([ 15 | 'name' => 'required|string|max:255', 16 | 'email' => 'required|string|email|max:255|unique:users', 17 | 'password' => 'required|string|min:8', 18 | ]); 19 | 20 | $user = User::create([ 21 | 'name' => $validatedData['name'], 22 | 'email' => $validatedData['email'], 23 | 'password' => Hash::make($validatedData['password']), 24 | ]); 25 | 26 | $token = $user->createToken('auth_token')->plainTextToken; 27 | 28 | Auth::loginUsingId($user->id); 29 | 30 | return response()->json([ 31 | 'access_token' => $token, 32 | 'token_type' => 'Bearer', 33 | ]); 34 | } 35 | 36 | public function login(Request $request) { 37 | if (!Auth::attempt($request->only('email', 'password'))) { 38 | return response()->json([ 39 | 'message' => 'Invalid login details' 40 | ], 401); 41 | } 42 | 43 | $user = User::where('email', $request['email'])->firstOrFail(); 44 | 45 | $token = $user->createToken('auth_token')->plainTextToken; 46 | 47 | return response()->json([ 48 | 'access_token' => $token, 49 | 'token_type' => 'Bearer', 50 | ]); 51 | } 52 | 53 | public function me(Request $request) { 54 | $user = User::whereId($request->user()->id)->with(['teams' => function ($query){ 55 | $query->withCount('portals'); 56 | $query->with(['portals' => function ($query2){ 57 | $query2->select('team_id', 'id', 'hub__domain'); 58 | }]); 59 | }])->first(); 60 | 61 | $user->team = null; 62 | 63 | foreach($user->teams as $team) { 64 | if($team->id == session('alias')) $user->team = $team; 65 | } 66 | 67 | $user->portal = (session('portal') ? session('portal') : null); 68 | 69 | return $user; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /public/build/assets/Lists.194129ab.js: -------------------------------------------------------------------------------- 1 | import{m as u,s as g,u as y,r as w,a as h,o as e,c as o,b as t,l as n,n as k,F as _,i as C,j as l,e as s,f as m,g as S,t as c}from"./app.b5f93124.js";/* empty css */const L=t("div",{class:"block justify-center items-center"},[t("div",{class:"px-12"},[t("div",{class:"pt-5 flex justify-between"},[t("div",null,[t("h1",null,"My HubSpot contact lists"),s(),t("div",{class:"subtext"},"Contact lists currently active in your HubSpot hub.")])])])],-1),j={class:"block justify-center items-center p-4 mx-4 mt-4 mb-6"},N={key:0,class:"flex flex-wrap -mx-1 lg:-mx-4"},H={class:"p-6 card relative"},T=t("div",{class:"card-gradient-teal"},null,-1),V={class:"flex mb-8"},z=t("div",{class:"px-4 flex whitespace-nowrap text-ellipsis overflow-hidden"},[t("h3",{class:"text-white text-xl"},"Contact List")],-1),B=t("div",{class:"border-b-2 border-[#707A9C] mb-8"},null,-1),A={class:"mb-2 text-lg font-semibold tracking-tight text-white"},D=t("span",{class:"muted pr-2"},"Name:",-1),F={class:"mb-2 text-lg font-semibold tracking-tight text-white"},E=t("span",{class:"muted pr-2"},"Type:",-1),M={class:"mb-2 text-lg font-semibold tracking-tight text-white"},R=t("span",{class:"muted pr-2"},"Size:",-1),Y={key:1,class:"flex justify-center"},q=t("h1",{class:"mb-8 text-3xl text-center"},"No Lists found.",-1),G={class:"text-center subtext"},I=t("br",null,null,-1),W={__name:"Lists",setup(J){const p=u(),{lists:a,loading:x}=g(u());return y().hub?p.fetchLists():w.push("/portals"),(O,P)=>{var r;const f=h("font-awesome-icon"),b=h("router-link");return e(),o(_,null,[L,t("div",j,[n(x)?l("",!0):(e(),o("div",{key:0,class:k(["min-h-[50vh]",(r=n(a))!=null&&r.length?"":"flex justify-center items-center"])},[n(a).length?(e(),o("div",N,[(e(!0),o(_,null,C(n(a),(i,v)=>{var d;return e(),o("div",{class:"my-1 px-1 w-full md:w-1/2 lg:my-4 lg:px-4 lg:w-1/4",key:v},[t("div",H,[T,t("div",V,[m(f,{icon:"fa-brands fa-hubspot",class:"pr-0 text-3xl text-[#ff7a59]"}),z]),B,t("h5",A,[D,s(" "+c(i.name),1)]),t("h5",F,[E,s(" "+c(i.listType),1)]),t("h5",M,[R,s(" "+c((d=i.metaData)==null?void 0:d.size),1)])])])}),128))])):l("",!0),n(a).length?l("",!0):(e(),o("div",Y,[t("div",null,[q,t("p",G,[s("You don't have any Contact Lists in this hub."),I,s(),m(b,{to:{name:"portals"}},{default:S(()=>[s("Choose another hub")]),_:1}),s(" or navigate to your HubSpot hub and add some contact lists.")])])]))],2))])],64)}}};export{W as default}; 2 | -------------------------------------------------------------------------------- /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 | 'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /resources/js/pages/hubspot/Lists.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 63 | -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', '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 set up for each driver as an example of the required values. 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 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /app/Http/Controllers/PortalController.php: -------------------------------------------------------------------------------- 1 | get([ 18 | 'id', 'created_at', 'hub__domain', 'hub__id', 'hub__user_email' 19 | ]); 20 | 21 | return response()->json(['portals' => $portals, 'active_portal' => session('portal')]); 22 | } 23 | 24 | /** 25 | * Show the form for creating a new resource. 26 | * 27 | * @return \Illuminate\Http\Response 28 | */ 29 | public function create() 30 | { 31 | 32 | return redirect()->route('/hs-auth'); 33 | 34 | } 35 | 36 | /** 37 | * Store a newly created resource in storage. 38 | * 39 | * @param \Illuminate\Http\Request $request 40 | * @return \Illuminate\Http\Response 41 | */ 42 | public function store(Request $request) 43 | { 44 | // 45 | } 46 | 47 | /** 48 | * Display the specified resource. 49 | * 50 | * @param int $id 51 | * @return \Illuminate\Http\Response 52 | */ 53 | public function show($id) 54 | { 55 | // 56 | } 57 | 58 | /** 59 | * Show the form for editing the specified resource. 60 | * 61 | * @param int $id 62 | * @return \Illuminate\Http\Response 63 | */ 64 | public function edit($id) 65 | { 66 | // 67 | } 68 | 69 | /** 70 | * Update the specified resource in storage. 71 | * 72 | * @param \Illuminate\Http\Request $request 73 | * @param int $id 74 | * @return \Illuminate\Http\Response 75 | */ 76 | public function update(Request $request, $id) 77 | { 78 | // 79 | } 80 | 81 | /** 82 | * Remove the specified resource from storage. 83 | * 84 | * @param int $id 85 | * @return \Illuminate\Http\Response 86 | */ 87 | public function destroy($id) 88 | { 89 | // 90 | } 91 | 92 | public function aliasAs(Request $request) { 93 | 94 | $portal = Portal::whereTeamId(session('alias'))->whereId($request->input('id'))->first(); 95 | 96 | if(!$portal){ 97 | return response()->json(['status' => '0', 'message' => 'invalid portal.'], 401); 98 | }else{ 99 | session()->put('portal', $portal); 100 | return response()->json(['status' => '1', 'message' => 'Portal switched.']); 101 | } 102 | 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /public/build/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "resources/js/app.js": { 3 | "file": "assets/app.b5f93124.js", 4 | "src": "resources/js/app.js", 5 | "isEntry": true, 6 | "dynamicImports": [ 7 | "resources/js/pages/auth/Login.vue", 8 | "resources/js/pages/auth/Register.vue", 9 | "resources/js/pages/auth/Logout.vue", 10 | "resources/js/pages/auth/Meself.vue", 11 | "resources/js/pages/auth/Portals.vue", 12 | "resources/js/pages/hubspot/Lists.vue" 13 | ], 14 | "css": [ 15 | "assets/app.52e5f057.css" 16 | ] 17 | }, 18 | "resources/js/pages/auth/Login.vue": { 19 | "file": "assets/Login.957ed9f7.js", 20 | "src": "resources/js/pages/auth/Login.vue", 21 | "isDynamicEntry": true, 22 | "imports": [ 23 | "resources/js/app.js", 24 | "_vform.es.531cc530.js" 25 | ], 26 | "css": [ 27 | "assets/app.52e5f057.css" 28 | ] 29 | }, 30 | "_vform.es.531cc530.js": { 31 | "file": "assets/vform.es.531cc530.js", 32 | "imports": [ 33 | "resources/js/app.js" 34 | ] 35 | }, 36 | "resources/js/pages/auth/Register.vue": { 37 | "file": "assets/Register.431fd2c3.js", 38 | "src": "resources/js/pages/auth/Register.vue", 39 | "isDynamicEntry": true, 40 | "imports": [ 41 | "resources/js/app.js", 42 | "_vform.es.531cc530.js" 43 | ], 44 | "css": [ 45 | "assets/app.52e5f057.css" 46 | ] 47 | }, 48 | "resources/js/pages/auth/Logout.vue": { 49 | "file": "assets/Logout.f87497ed.js", 50 | "src": "resources/js/pages/auth/Logout.vue", 51 | "isDynamicEntry": true, 52 | "imports": [ 53 | "resources/js/app.js" 54 | ], 55 | "css": [ 56 | "assets/app.52e5f057.css" 57 | ] 58 | }, 59 | "resources/js/pages/auth/Meself.vue": { 60 | "file": "assets/Meself.0010e2c3.js", 61 | "src": "resources/js/pages/auth/Meself.vue", 62 | "isDynamicEntry": true, 63 | "imports": [ 64 | "resources/js/app.js" 65 | ], 66 | "css": [ 67 | "assets/app.52e5f057.css" 68 | ] 69 | }, 70 | "resources/js/pages/auth/Portals.vue": { 71 | "file": "assets/Portals.32e25f1a.js", 72 | "src": "resources/js/pages/auth/Portals.vue", 73 | "isDynamicEntry": true, 74 | "imports": [ 75 | "resources/js/app.js" 76 | ], 77 | "css": [ 78 | "assets/app.52e5f057.css" 79 | ] 80 | }, 81 | "resources/js/pages/hubspot/Lists.vue": { 82 | "file": "assets/Lists.194129ab.js", 83 | "src": "resources/js/pages/hubspot/Lists.vue", 84 | "isDynamicEntry": true, 85 | "imports": [ 86 | "resources/js/app.js" 87 | ], 88 | "css": [ 89 | "assets/app.52e5f057.css" 90 | ] 91 | }, 92 | "resources/css/app.css": { 93 | "file": "assets/app.52e5f057.css", 94 | "src": "resources/css/app.css", 95 | "isEntry": true 96 | } 97 | } -------------------------------------------------------------------------------- /app/Http/Kernel.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\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\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | \App\Http\Middleware\UserTeam::class, 40 | ], 41 | 42 | 'api' => [ 43 | \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 44 | 'throttle:api', 45 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 46 | \App\Http\Middleware\UserTeam::class, 47 | 48 | ], 49 | ]; 50 | 51 | /** 52 | * The application's route middleware. 53 | * 54 | * These middleware may be assigned to groups or used individually. 55 | * 56 | * @var array 57 | */ 58 | protected $routeMiddleware = [ 59 | 'auth' => \App\Http\Middleware\Authenticate::class, 60 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 61 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 62 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 63 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 64 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 65 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 66 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 67 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 68 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 69 | ]; 70 | } 71 | -------------------------------------------------------------------------------- /public/build/assets/Portals.32e25f1a.js: -------------------------------------------------------------------------------- 1 | import{k as g,s as w,u as k,a as S,o,c as n,b as t,f,e as s,n as C,l as a,F as v,i as j,j as i,t as l,r as H}from"./app.b5f93124.js";/* empty css */const N={class:"block justify-center items-center"},A={class:"px-12"},P={class:"pt-5 flex justify-between"},V=t("div",null,[t("h1",null,"My HubSpot hubs"),s(),t("div",{class:"subtext"},"HubSpot hubs currently connected to your team.")],-1),B={href:"/hs-auth",class:"btn hubspot flex items-center"},T={class:"block justify-center items-center p-4 mx-4 mt-4 mb-6"},F={class:"block px-4 my-5 w-100"},q={key:0,class:"flex flex-wrap -mx-1 lg:-mx-4"},z={class:"p-6 card relative"},D=t("div",{class:"card-gradient-teal"},null,-1),E={class:"relative"},I={class:"flex mb-8"},L={class:"px-4 flex whitespace-nowrap text-ellipsis overflow-hidden"},M={class:"text-white text-xl"},R=t("div",{class:"border-b-2 border-[#707A9C] mb-8"},null,-1),U={class:"mb-4 text-lg font-semibold tracking-tight text-white"},Y=t("span",{class:"muted pr-2"},"Hub id:",-1),$={class:"mb-4 text-lg font-semibold tracking-tight text-white whitespace-nowrap overflow-hidden"},G=t("span",{class:"muted pr-2"},"Authenticated by:",-1),J={class:"mb-2 pt-6 font-normal"},K=["onClick"],O={key:1,class:"py-3 muted"},Q={key:1,class:"flex justify-center items-center"},W=t("div",null,[t("h1",{class:"mb-8 text-3xl text-center"}," No connected HubSpot portals "),t("p",{class:"text-center subtext"},[s(" You don't have any portals connected to this team. "),t("a",{href:"/hs-auth",class:""},"Add one now"),s("."),t("br"),t("br"),s(" This sample app only requires a single scope "),t("strong",null,"crm.lists.read"),s(". "),t("br"),s("It cannot read your contacts and has "),t("strong",null,"no writing priveleges"),s(". ")])],-1),X=[W],nt={__name:"Portals",setup(Z){const r=g(),{portals:c}=w(r),d=k();r.fetchPortals();async function y(h){await axios.post(route("portals.alias-as"),h),H.push("/hs/lists")}return(h,tt)=>{var _,p,m;const u=S("font-awesome-icon");return o(),n(v,null,[t("div",N,[t("div",A,[t("div",P,[V,t("div",null,[t("a",B,[f(u,{icon:"fa-brands fa-hubspot",class:"pr-0 text-xl text-white mr-2"}),s(" Connect a HubSpot hub")])])])])]),t("div",T,[t("div",{class:C(["min-h-[50vh]",(_=a(c))!=null&&_.length?"":"flex justify-center items-center"])},[t("div",F,[(p=a(c))!=null&&p.length?(o(),n("div",q,[(o(!0),n(v,null,j(a(c),e=>{var b,x;return o(),n("div",{class:"my-1 px-1 w-full md:w-1/2 lg:my-4 lg:px-4 lg:w-1/3",key:e.id},[t("div",z,[D,t("div",E,[t("div",I,[f(u,{icon:"fa-brands fa-hubspot",class:"pr-0 text-3xl text-[#ff7a59]"}),t("div",L,[t("h3",M,l(e.hub__domain),1)])]),R,t("h5",U,[Y,s(" "+l(e.hub__id),1)]),t("h5",$,[G,s(" "+l(e.hub__user_email),1)]),t("div",J,[((b=a(d).hub)==null?void 0:b.id)!=e.id?(o(),n("a",{key:0,href:"javascript:void(0)",class:"btn",onClick:st=>y(e)},"Use this hub",8,K)):i("",!0),((x=a(d).hub)==null?void 0:x.id)==e.id?(o(),n("div",O," Currently active portal ")):i("",!0)])])])])}),128))])):i("",!0),(m=a(c))!=null&&m.length?i("",!0):(o(),n("div",Q,X))])],2)])],64)}}};export{nt as default}; 2 | -------------------------------------------------------------------------------- /app/Http/Controllers/TeamController.php: -------------------------------------------------------------------------------- 1 | $request->input('name') 43 | ]); 44 | 45 | $team->users()->attach(Auth::user(), ['primary' => 0, 'last_used' => 1]); 46 | 47 | session()->put('alias', $team->id); 48 | 49 | return response()->json(['status' => '1']); 50 | } 51 | 52 | /** 53 | * Display the specified resource. 54 | * 55 | * @param int $id 56 | * @return \Illuminate\Http\Response 57 | */ 58 | public function show($id) 59 | { 60 | // 61 | } 62 | 63 | /** 64 | * Show the form for editing the specified resource. 65 | * 66 | * @param int $id 67 | * @return \Illuminate\Http\Response 68 | */ 69 | public function edit($id) 70 | { 71 | // 72 | } 73 | 74 | /** 75 | * Update the specified resource in storage. 76 | * 77 | * @param \Illuminate\Http\Request $request 78 | * @param int $id 79 | * @return \Illuminate\Http\Response 80 | */ 81 | public function update(Request $request, $id) 82 | { 83 | // 84 | } 85 | 86 | /** 87 | * Remove the specified resource from storage. 88 | * 89 | * @param int $id 90 | * @return \Illuminate\Http\Response 91 | */ 92 | public function destroy($id) 93 | { 94 | // 95 | } 96 | 97 | public function aliasAs(Request $request){ 98 | 99 | $team_user = TeamUser::whereUserId(Auth::user()->id)->whereTeamId($request->input('team_id'))->first(); 100 | 101 | if(!$team_user){ 102 | return response()->json(['status' => '0', 'message' => 'invalid team.'], 401); 103 | }else{ 104 | 105 | $portal = Portal::whereTeamId($request->input('team_id'))->first(); 106 | 107 | session()->put('alias', $request->input('team_id')); 108 | session()->put('portal', $portal); 109 | return response()->json(['status' => '1', 'message' => 'Team switched.']); 110 | } 111 | 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /resources/js/pages/hubspot/Tables.vue: -------------------------------------------------------------------------------- 1 | 39 | 40 | -------------------------------------------------------------------------------- /app/Http/Controllers/HubSpotAuthController.php: -------------------------------------------------------------------------------- 1 | env('HS_CLIENT_ID'), 19 | 'redirect_uri' => env('APP_URL') . '/submitauth', 20 | 'scope' => implode(" ", $scopes), 21 | ]; 22 | 23 | $url = env('HS_AUTH_URL') . "?" . http_build_query($query); 24 | return redirect()->to($url); 25 | } 26 | 27 | public function authResponse(Request $request) 28 | { 29 | if (!$request->input('code')) { 30 | // TODO: do something with the failure 31 | return response("FAILED - HSA", 401); 32 | } 33 | 34 | $client = new Client(['base_uri' => 'https://api.hubapi.com/oauth/v1/']); 35 | $token_query = [ 36 | 'grant_type' => 'authorization_code', 37 | 'client_id' => env('HS_CLIENT_ID'), 38 | 'client_secret' => env('HS_CLIENT_SECRET'), 39 | 'redirect_uri' => env('APP_URL') . '/submitauth', 40 | 'code' => $request->input('code'), 41 | ]; 42 | 43 | try { 44 | $token_response = $client->request('POST', 'token', [ 45 | 'query' => $token_query, 46 | 'headers' => ['Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8'] 47 | ]); 48 | } catch (\Exception $e) { 49 | \Log::info($e->getMessage()); 50 | die; 51 | } 52 | 53 | $token_response = json_decode($token_response->getBody(), true); 54 | $token_meta_response = $client->request('GET', 'access-tokens/' . $token_response['access_token']); 55 | $token_meta_response = json_decode($token_meta_response->getBody(), true); 56 | 57 | $portal = new \App\Models\Portal(); 58 | 59 | $portal->user_id = Auth::user()->id; 60 | $portal->team_id = session('alias'); 61 | $portal->hub__id = $token_meta_response['hub_id']; 62 | $portal->hub__user_email = $token_meta_response['user']; 63 | $portal->hub__domain = $token_meta_response['hub_domain']; 64 | $portal->token_expires = \Carbon\Carbon::now()->addSecond($token_response['expires_in']); 65 | $portal->refresh_token = $token_response['refresh_token']; 66 | $portal->access_token = $token_response['access_token']; 67 | 68 | $portal->save(); 69 | 70 | session()->put('portal', $portal); 71 | 72 | return redirect()->to('/hs/lists'); 73 | } 74 | 75 | public function tables() 76 | { 77 | // TODO: Implement token refresh if expired. Currently refreshes on every call 78 | $token = $this->refreshAccessToken(); 79 | 80 | $client = new Client(); 81 | 82 | $response = $client->request('GET', 'https://api.hubapi.com/hubdb/api/v2/tables', [ 83 | 'query' => NULL, 84 | 'headers' => [ 85 | 'Authorization' => 'Bearer ' . $token, 86 | 'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8' 87 | ] 88 | ]); 89 | $response = json_decode($response->getBody(), true); 90 | 91 | return response()->json($response); 92 | } 93 | 94 | public function lists() 95 | { 96 | 97 | $token = $this->refreshAccessToken(); 98 | 99 | $client = new Client(); 100 | 101 | $response = $client->request('GET', 'https://api.hubapi.com/contacts/v1/lists', [ 102 | 'query' => NULL, 103 | 'headers' => [ 104 | 'Authorization' => 'Bearer ' . $token, 105 | 'Content-Type' => 'application/x-www-form-urlencoded;charset=utf-8' 106 | ] 107 | ]); 108 | $response = json_decode($response->getBody(), true); 109 | 110 | return response()->json($response); 111 | 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /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 the APC, database, memcached, Redis, or DynamoDB cache 103 | | stores there might be other applications using the same cache. For 104 | | that reason, you may prefix every cache key to avoid collisions. 105 | | 106 | */ 107 | 108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /.deploy/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG PHP_VERSION=${PHP_VERSION:-8.1} 2 | FROM php:${PHP_VERSION}-fpm-alpine AS php-system-setup 3 | 4 | # Install system dependencies 5 | RUN apk add --no-cache dcron busybox-suid libcap curl zip unzip git 6 | RUN apk add --update nodejs npm 7 | 8 | 9 | 10 | # Install PHP extensions 11 | COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/bin/ 12 | RUN install-php-extensions intl bcmath gd pdo_mysql pdo_pgsql opcache redis uuid exif pcntl zip 13 | 14 | # Install supervisord implementation 15 | COPY --from=ochinchina/supervisord:latest /usr/local/bin/supervisord /usr/local/bin/supervisord 16 | 17 | # Install caddy 18 | COPY --from=caddy:2.2.1 /usr/bin/caddy /usr/local/bin/caddy 19 | RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy 20 | 21 | # Install composer 22 | COPY --from=composer/composer:2 /usr/bin/composer /usr/local/bin/composer 23 | 24 | FROM php-system-setup AS app-setup 25 | 26 | # Set working directory 27 | ENV LARAVEL_PATH=/srv/app 28 | WORKDIR $LARAVEL_PATH 29 | 30 | # Add non-root user: 'app' 31 | ARG NON_ROOT_GROUP=${NON_ROOT_GROUP:-app} 32 | ARG NON_ROOT_USER=${NON_ROOT_USER:-app} 33 | RUN addgroup -S $NON_ROOT_GROUP && adduser -S $NON_ROOT_USER -G $NON_ROOT_GROUP 34 | RUN addgroup $NON_ROOT_USER wheel 35 | 36 | # Set cron job 37 | COPY ./.deploy/config/crontab /etc/crontabs/$NON_ROOT_USER 38 | RUN chmod 777 /usr/sbin/crond 39 | RUN chown -R $NON_ROOT_USER:$NON_ROOT_GROUP /etc/crontabs/$NON_ROOT_USER && setcap cap_setgid=ep /usr/sbin/crond 40 | 41 | # Switch to non-root 'app' user & install app dependencies 42 | COPY composer.json composer.lock ./ 43 | RUN chown -R $NON_ROOT_USER:$NON_ROOT_GROUP $LARAVEL_PATH 44 | USER $NON_ROOT_USER 45 | RUN composer install --prefer-dist --ignore-platform-reqs --no-scripts --no-dev --no-autoloader 46 | RUN rm -rf /home/$NON_ROOT_USER/.composer 47 | 48 | # Copy app 49 | COPY --chown=$NON_ROOT_USER:$NON_ROOT_GROUP . $LARAVEL_PATH/ 50 | COPY ./.deploy/config/php/local.ini /usr/local/etc/php/conf.d/local.ini 51 | 52 | 53 | 54 | 55 | 56 | # Set any ENVs 57 | ARG APP_KEY=${APP_KEY} 58 | ARG APP_NAME=${APP_NAME} 59 | ARG APP_URL=${APP_URL} 60 | ARG APP_ENV=${APP_ENV} 61 | ARG APP_DEBUG=${APP_DEBUG} 62 | 63 | ARG LOG_CHANNEL=${LOG_CHANNEL} 64 | 65 | ARG DB_CONNECTION=${DB_CONNECTION} 66 | ARG DB_HOST=${DB_HOST} 67 | ARG DB_PORT=${DB_PORT} 68 | ARG DB_DATABASE=${DB_DATABASE} 69 | ARG DB_USERNAME=${DB_USERNAME} 70 | ARG DB_PASSWORD=${DB_PASSWORD} 71 | 72 | ARG BROADCAST_DRIVER=${BROADCAST_DRIVER} 73 | ARG CACHE_DRIVER=${CACHE_DRIVER} 74 | ARG QUEUE_CONNECTION=${QUEUE_CONNECTION} 75 | ARG SESSION_DRIVER=${SESSION_DRIVER} 76 | ARG SESSION_LIFETIME=${SESSION_LIFETIME} 77 | 78 | ARG REDIS_HOST=${REDIS_HOST} 79 | ARG REDIS_PASSWORD=${REDIS_PASSWORD} 80 | ARG REDIS_PORT=${REDIS_PORT} 81 | 82 | ARG MAIL_MAILER=${MAIL_MAILER} 83 | ARG MAIL_HOST=${MAIL_HOST} 84 | ARG MAIL_PORT=${MAIL_PORT} 85 | ARG MAIL_USERNAME=${MAIL_USERNAME} 86 | ARG MAIL_PASSWORD=${MAIL_PASSWORD} 87 | ARG MAIL_ENCRYPTION=${MAIL_ENCRYPTION} 88 | ARG MAIL_FROM_ADDRESS=${MAIL_FROM_ADDRESS} 89 | ARG MAIL_ENCRYPTION=${MAIL_ENCRYPTION} 90 | ARG MAIL_FROM_NAME=${APP_NAME} 91 | 92 | ARG PUSHER_APP_ID=${PUSHER_APP_ID} 93 | ARG PUSHER_APP_KEY=${PUSHER_APP_KEY} 94 | ARG PUSHER_APP_SECRET=${PUSHER_APP_SECRET} 95 | ARG PUSHER_APP_CLUSTER=${PUSHER_APP_CLUSTER} 96 | 97 | # Start app 98 | EXPOSE 80 99 | COPY ./.deploy/entrypoint.sh / 100 | 101 | ENTRYPOINT ["sh", "/entrypoint.sh"] 102 | 103 | #FROM node:16.13.1 104 | 105 | # FROM node:16.13.1 106 | # RUN echo "Node: " && node -v 107 | # RUN echo "NPM: " && npm -v 108 | # RUN echo "DIR: " && pwd 109 | # WORKDIR /srv/app 110 | # RUN ls -al 111 | # RUN echo "DIR2: " && pwd 112 | # # RUN cd /srv/app 113 | # RUN npm install 114 | 115 | # FROM app-setup 116 | -------------------------------------------------------------------------------- /public/build/assets/Meself.0010e2c3.js: -------------------------------------------------------------------------------- 1 | import{_ as p,u as w,r as _,a as v,o,c as l,b as e,n as r,F as c,i as x,j as b,w as g,d as y,v as T,e as i,f as C,t as h}from"./app.b5f93124.js";/* empty css */const N={name:"Me",props:{},data:()=>({auth:w(),me:{},activeTeam:null,showCreateTeam:!1,newTeamName:""}),async created(){this.fetchMe(),setTimeout(()=>{},1e3)},methods:{showCreateNewTeam(){this.newTeamName="",this.showCreateTeam=!0},async changeActiveTeam(){await axios.post(route("teams.alias-as"),{team_id:this.activeTeam}),this.auth.update(),_.push("/portals")},async fetchMe(){const t=await axios.post(route("post.me"));this.me=t.data,this.activeTeam=this.me.team.id},async createNewTeam(){await axios.post(route("teams.store"),{name:this.newTeamName}),this.showCreateTeam=!1,this.fetchMe()}}},k={class:"block justify-center items-center"},M={class:"px-12"},j={class:"pt-5 flex justify-between"},L=e("div",null,[e("h1",null,"My teams"),i(),e("div",{class:"subtext"},"Having many teams is perfect for agencies that want to lockdown access.")],-1),V={class:"block justify-center items-center p-4 mx-4 mt-4 mb-6"},$={key:0,class:"flex flex-wrap -mx-1 lg:-mx-4"},B={class:"p-6 card relative"},z=e("div",{class:"card-gradient-teal"},null,-1),A={class:"flex mb-8"},S=e("div",{class:"px-4 flex whitespace-nowrap text-ellipsis overflow-hidden"},[e("h3",{class:"text-white text-xl"},"Team")],-1),D=e("div",{class:"border-b-2 border-[#707A9C] mb-8"},null,-1),F={class:"mb-2 text-lg font-semibold tracking-tight text-white"},E=e("span",{class:"muted pr-2"},"Name:",-1),H={class:"mb-2 text-lg font-semibold tracking-tight text-white"},U=e("span",{class:"muted pr-2"},"Connected hubs:",-1),q={class:"relative p-4 w-full max-w-md h-full md:h-auto"},G={class:"relative rounded-lg shadow bg-gray-800"},I=e("svg",{"aria-hidden":"true",class:"w-5 h-5",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},[e("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1),J=e("span",{class:"sr-only"},"Close modal",-1),K=[I,J],O={class:"py-6 px-6 lg:px-8"},P=e("h3",{class:"mb-4 text-xl font-medium text-white"}," Create new team ",-1),Q=e("label",{for:"email",class:"block mb-2 text-sm font-medium text-gray-300"},"Team name",-1),R=e("button",{type:"submit",class:"w-full mt-0"}," Create team ",-1);function W(t,s,X,Y,Z,n){var m,d;const u=v("font-awesome-icon");return o(),l(c,null,[e("div",k,[e("div",M,[e("div",j,[L,e("div",null,[e("button",{onClick:s[0]||(s[0]=a=>n.showCreateNewTeam())}," Create new team ")])])])]),e("div",V,[e("div",{class:r(["min-h-[50vh]",(m=t.me.teams)!=null&&m.length?"":"flex justify-center items-center"])},[(d=t.me.teams)!=null&&d.length?(o(),l("div",$,[(o(!0),l(c,null,x(t.me.teams,(a,f)=>(o(),l("div",{class:"my-1 px-1 w-full md:w-1/2 lg:my-4 lg:px-4 lg:w-1/4",key:f},[e("div",B,[z,e("div",A,[C(u,{icon:"fa-solid fa-users",class:"pr-0 text-3xl text-[#ffffff]"}),S]),D,e("h5",F,[E,i(" "+h(a.name),1)]),e("h5",H,[U,i(" "+h(a.portals_count),1)])])]))),128))])):b("",!0)],2)]),e("div",{id:"authentication-modal",tabindex:"-1",class:r([t.showCreateTeam?"":"hidden","overflow-y-auto overflow-x-hidden fixed top-0 right-0 left-0 z-50 w-full md:inset-0 h-modal md:h-full flex justify-center bg-black bg-opacity-60"])},[e("div",q,[e("div",G,[e("button",{type:"button",class:"absolute top-3 right-2.5 rounded-lg text-sm p-1.5 ml-auto inline-flex items-center",onClick:s[1]||(s[1]=a=>t.showCreateTeam=!1)},K),e("div",O,[P,e("form",{class:"mt-8",onSubmit:s[3]||(s[3]=g(a=>n.createNewTeam(),["prevent"]))},[e("div",null,[Q,y(e("input",{type:"text",class:"",placeholder:"my new team","onUpdate:modelValue":s[2]||(s[2]=a=>t.newTeamName=a)},null,512),[[T,t.newTeamName]])]),R],32)])])])],2)],64)}const se=p(N,[["render",W]]);export{se as default}; 2 | -------------------------------------------------------------------------------- /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 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 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 -bs -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/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 each reset token will 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/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' => [ 34 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 35 | 'trace' => false, 36 | ], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Log Channels 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Here you may configure the log channels for your application. Out of 44 | | the box, Laravel uses the Monolog PHP logging library. This gives 45 | | you a variety of powerful log handlers / formatters to utilize. 46 | | 47 | | Available Drivers: "single", "daily", "slack", "syslog", 48 | | "errorlog", "monolog", 49 | | "custom", "stack" 50 | | 51 | */ 52 | 53 | 'channels' => [ 54 | 'stack' => [ 55 | 'driver' => 'stack', 56 | 'channels' => ['single'], 57 | 'ignore_exceptions' => false, 58 | ], 59 | 60 | 'single' => [ 61 | 'driver' => 'single', 62 | 'path' => storage_path('logs/laravel.log'), 63 | 'level' => env('LOG_LEVEL', 'debug'), 64 | ], 65 | 66 | 'daily' => [ 67 | 'driver' => 'daily', 68 | 'path' => storage_path('logs/laravel.log'), 69 | 'level' => env('LOG_LEVEL', 'debug'), 70 | 'days' => 14, 71 | ], 72 | 73 | 'slack' => [ 74 | 'driver' => 'slack', 75 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 76 | 'username' => 'Laravel Log', 77 | 'emoji' => ':boom:', 78 | 'level' => env('LOG_LEVEL', 'critical'), 79 | ], 80 | 81 | 'papertrail' => [ 82 | 'driver' => 'monolog', 83 | 'level' => env('LOG_LEVEL', 'debug'), 84 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 85 | 'handler_with' => [ 86 | 'host' => env('PAPERTRAIL_URL'), 87 | 'port' => env('PAPERTRAIL_PORT'), 88 | 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 89 | ], 90 | ], 91 | 92 | 'stderr' => [ 93 | 'driver' => 'monolog', 94 | 'level' => env('LOG_LEVEL', 'debug'), 95 | 'handler' => StreamHandler::class, 96 | 'formatter' => env('LOG_STDERR_FORMATTER'), 97 | 'with' => [ 98 | 'stream' => 'php://stderr', 99 | ], 100 | ], 101 | 102 | 'syslog' => [ 103 | 'driver' => 'syslog', 104 | 'level' => env('LOG_LEVEL', 'debug'), 105 | ], 106 | 107 | 'errorlog' => [ 108 | 'driver' => 'errorlog', 109 | 'level' => env('LOG_LEVEL', 'debug'), 110 | ], 111 | 112 | 'null' => [ 113 | 'driver' => 'monolog', 114 | 'handler' => NullHandler::class, 115 | ], 116 | 117 | 'emergency' => [ 118 | 'path' => storage_path('logs/laravel.log'), 119 | ], 120 | ], 121 | 122 | ]; 123 | -------------------------------------------------------------------------------- /resources/js/pages/auth/Portals.vue: -------------------------------------------------------------------------------- 1 | 65 | 66 | 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Laravel HubSpot Starter Kit 2 | ### A good place to start if you're building a public App for HubSpot 3 | 4 | ##### [View the live demo](https://laravel-hubspot-starter-kit.server.joyceml.com/) 5 | 6 | ## Features 7 | - [Laravel 9.x](https://laravel.com/docs/9.x) 8 | - [Vite 3.x](https://vitejs.dev/) 9 | - [Vue 3.x](https://vuejs.org/guide/introduction.html) with Vue Router 10 | - [Pinia](https://pinia.vuejs.org/introduction.html) State Manager 11 | - [Tailwind](https://tailwindcss.com/) 3.x 12 | - [Laravel Valet](https://laravel.com/docs/9.x/valet) 13 | - [Laravel Ziggy](https://github.com/tighten/ziggy) 14 | - Integrated SPA (Utilizes Laravel API and vue 3 front-end on the same server instance) 15 | - Laravel Auth 16 | - [HubSpot OAuth2](https://developers.hubspot.com/docs/api/working-with-oauth) flow 17 | - A user can belong to many teams 18 | - A team can add many portals 19 | - Set team and portal in session to allow subsequent api calls within the app relate to chosen portal instance 20 | - Procfile included for easy deployment to [Heroku](https://www.heroku.com/) 21 | 22 | ## Requirements 23 | - [Laravel Valet](https://laravel.com/docs/9.x/valet) or [equivalent](https://www.wampserver.com/en/) 24 | - [Composer](https://getcomposer.org/) 25 | - [Node v16.13.1](https://github.com/nvm-sh/nvm) or later 26 | - [HubSpot Developer Account](https://developers.hubspot.com/) 27 | 28 | ## Laravel Installation 29 | 1. Clone or Fork this repo 30 | 2. Open terminal and cd to the working directory `cd laravel-hubspot-starter-kit` 31 | 3. run `composer install` 32 | 4. run `yarn install` or `npm install` 33 | 5. run `valet link` - To link your working directory to a `.local` or `.dev` domain (example: https://laravel-hubspot-starter-kit.dev/ is pointing to your local directory) 34 | 6. Secure your local API with `valet secure` - HubSpot apps require an SSL unless you are testing with `http://localhost` 35 | 7. At this point, if you run `yarn dev` you should be able to see your Laravel app running, but we still need to setup the database 36 | 8. Create your MySQL or MariaDB database 37 | 9. In your working directory, rename `.env.example` to `.env` 38 | 10. Enter your new database credentials in your `.env` file and save 39 | 11. While you're in the `.env` file, let's set the app URL `APP_URL=https://laravel-hubspot-starter-kit.dev` 40 | 12. Don't forget to save your `.env` file 41 | 13. Now that we have our database connected via the `.env` file, let's run the migrations with `php artisan migrate` 42 | 14. You should now be able to navigate to `https://laravel-hubspot-starter-kit.dev/register` in your browser, and register as a new user 43 | 44 | > you might see a broken SSL in the browser, that’s okay, we really needed to secure the Laravel API since HubSpot Auth callbacks require the HTTPS protocol and we are a little less worried about securing the SPA at this point. 45 | 46 | ## Creating your HubSpot App 47 | 1. Login or create a developer account at https://developers.hubspot.com/ 48 | 2. Choose to create a new public APP in HubSpot developer account 49 | 3. Name your app under App Info 50 | 4. Click on the Auth tab 51 | 5. First, let’s set our redirect url - this is the url that’s going to be called in our app after the user authenticates with HubSpot `https://llaravel-hubspot-starter-kit.dev/submitauth` 52 | ![Developers-Hub-Spot-2022-10-30-06-03-52.png](https://i.postimg.cc/43C6VchT/Developers-Hub-Spot-2022-10-30-06-03-52.png) 53 | 6. Next let's set some scopes... For the demo, we are going to choose to read contact lists (Make sure you have some lists created in your HubSpot client portal if you want to see some data pulled in) 54 | 7. Choose the CRM Dropdown 55 | 8. Then toggle on `crm.lists` Read 56 | ![scopes.png](https://i.postimg.cc/K8mk25Lj/Scopes.png) 57 | 9. When you’re done filling out the information hit Save, then we need to add our HubSpot app credentials to our `.env` file 58 | 10. Open your `.env` file again and add the following 59 | ``` 60 | HS_AUTH_URL=https://app.hubspot.com/oauth/authorize 61 | HS_APP_ID= 62 | HS_CLIENT_ID= 63 | HS_CLIENT_SECRET= 64 | ``` 65 | 11. Save your `.env` file 66 | 12. In your browser, login to your sample app and go to "My Hubs" 67 | 13. Click “Add Portal” 68 | 14. You should now be able to walk through the HubSpot OAuth flow 69 | 15. After you connect to your HubSpot portal, you should have been redirected to a page in your app that shows all of your HubSpot lists 70 | ![preview.png](https://i.postimg.cc/GtsY4hhp/preview.png) 71 | 72 | ## Contributing 73 | - Fork the repo, add your feature then create a pull request 74 | - All contributions will be credited 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /public/images/logo-dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Group 3 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /public/images/logo-light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Group 3 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /resources/js/pages/auth/Meself.vue: -------------------------------------------------------------------------------- 1 | 91 | 92 | 137 | -------------------------------------------------------------------------------- /public/build/assets/vform.es.531cc530.js: -------------------------------------------------------------------------------- 1 | import{h as m}from"./app.b5f93124.js";var j=Object.defineProperty,O=Object.prototype.hasOwnProperty,d=Object.getOwnPropertySymbols,A=Object.prototype.propertyIsEnumerable,f=(e,s,t)=>s in e?j(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,a=(e,s)=>{for(var t in s||(s={}))O.call(s,t)&&f(e,t,s[t]);if(d)for(var t of d(s))A.call(s,t)&&f(e,t,s[t]);return e};const l=e=>e===void 0,p=e=>Array.isArray(e),y=e=>e&&typeof e.size=="number"&&typeof e.type=="string"&&typeof e.slice=="function",u=(e,s,t,o)=>((s=s||{}).indices=!l(s.indices)&&s.indices,s.nullsAsUndefineds=!l(s.nullsAsUndefineds)&&s.nullsAsUndefineds,s.booleansAsIntegers=!l(s.booleansAsIntegers)&&s.booleansAsIntegers,s.allowEmptyArrays=!l(s.allowEmptyArrays)&&s.allowEmptyArrays,t=t||new FormData,l(e)||(e===null?s.nullsAsUndefineds||t.append(o,""):(r=>typeof r=="boolean")(e)?s.booleansAsIntegers?t.append(o,e?1:0):t.append(o,e):p(e)?e.length?e.forEach((r,n)=>{const c=o+"["+(s.indices?n:"")+"]";u(r,s,t,c)}):s.allowEmptyArrays&&t.append(o+"[]",""):(r=>r instanceof Date)(e)?t.append(o,e.toISOString()):!(r=>r===Object(r))(e)||(r=>y(r)&&typeof r.name=="string"&&(typeof r.lastModifiedDate=="object"||typeof r.lastModified=="number"))(e)||y(e)?t.append(o,e):Object.keys(e).forEach(r=>{const n=e[r];if(p(n))for(;r.length>2&&r.lastIndexOf("[]")===r.length-2;)r=r.substring(0,r.length-2);u(n,s,t,o?o+"["+r+"]":r)})),t);var w={serialize:u};function h(e){if(e===null||typeof e!="object")return e;const s=Array.isArray(e)?[]:{};return Object.keys(e).forEach(t=>{s[t]=h(e[t])}),s}function b(e){return Array.isArray(e)?e:[e]}function g(e){return e instanceof File||e instanceof Blob||e instanceof FileList||typeof e=="object"&&e!==null&&Object.values(e).find(s=>g(s))!==void 0}class E{constructor(){this.errors={},this.errors={}}set(s,t){typeof s=="object"?this.errors=s:this.set(a(a({},this.errors),{[s]:b(t)}))}all(){return this.errors}has(s){return Object.prototype.hasOwnProperty.call(this.errors,s)}hasAny(...s){return s.some(t=>this.has(t))}any(){return Object.keys(this.errors).length>0}get(s){if(this.has(s))return this.getAll(s)[0]}getAll(s){return b(this.errors[s]||[])}only(...s){const t=[];return s.forEach(o=>{const r=this.get(o);r&&t.push(r)}),t}flatten(){return Object.values(this.errors).reduce((s,t)=>s.concat(t),[])}clear(s){const t={};s&&Object.keys(this.errors).forEach(o=>{o!==s&&(t[o]=this.errors[o])}),this.set(t)}}class i{constructor(s={}){this.originalData={},this.busy=!1,this.successful=!1,this.recentlySuccessful=!1,this.recentlySuccessfulTimeoutId=void 0,this.errors=new E,this.progress=void 0,this.update(s)}static make(s){return new this(s)}update(s){this.originalData=Object.assign({},this.originalData,h(s)),Object.assign(this,s)}fill(s={}){this.keys().forEach(t=>{this[t]=s[t]})}data(){return this.keys().reduce((s,t)=>a(a({},s),{[t]:this[t]}),{})}keys(){return Object.keys(this).filter(s=>!i.ignore.includes(s))}startProcessing(){this.errors.clear(),this.busy=!0,this.successful=!1,this.progress=void 0,this.recentlySuccessful=!1,clearTimeout(this.recentlySuccessfulTimeoutId)}finishProcessing(){this.busy=!1,this.successful=!0,this.progress=void 0,this.recentlySuccessful=!0,this.recentlySuccessfulTimeoutId=setTimeout(()=>{this.recentlySuccessful=!1},i.recentlySuccessfulTimeout)}clear(){this.errors.clear(),this.successful=!1,this.recentlySuccessful=!1,this.progress=void 0,clearTimeout(this.recentlySuccessfulTimeoutId)}reset(){Object.keys(this).filter(s=>!i.ignore.includes(s)).forEach(s=>{this[s]=h(this.originalData[s])})}get(s,t={}){return this.submit("get",s,t)}post(s,t={}){return this.submit("post",s,t)}patch(s,t={}){return this.submit("patch",s,t)}put(s,t={}){return this.submit("put",s,t)}delete(s,t={}){return this.submit("delete",s,t)}submit(s,t,o={}){return this.startProcessing(),o=a({data:{},params:{},url:this.route(t),method:s,onUploadProgress:this.handleUploadProgress.bind(this)},o),s.toLowerCase()==="get"?o.params=a(a({},this.data()),o.params):(o.data=a(a({},this.data()),o.data),g(o.data)&&!o.transformRequest&&(o.transformRequest=[r=>w.serialize(r)])),new Promise((r,n)=>{(i.axios||m).request(o).then(c=>{this.finishProcessing(),r(c)}).catch(c=>{this.handleErrors(c),n(c)})})}handleErrors(s){this.busy=!1,this.progress=void 0,s.response&&this.errors.set(this.extractErrors(s.response))}extractErrors(s){return s.data&&typeof s.data=="object"?s.data.errors?a({},s.data.errors):s.data.message?{error:s.data.message}:a({},s.data):{error:i.errorMessage}}handleUploadProgress(s){this.progress={total:s.total,loaded:s.loaded,percentage:Math.round(100*s.loaded/s.total)}}route(s,t={}){let o=s;return Object.prototype.hasOwnProperty.call(i.routes,s)&&(o=decodeURI(i.routes[s])),typeof t!="object"&&(t={id:t}),Object.keys(t).forEach(r=>{o=o.replace(`{${r}}`,t[r])}),o}onKeydown(s){const t=s.target;t.name&&this.errors.clear(t.name)}}i.routes={},i.errorMessage="Something went wrong. Please try again.",i.recentlySuccessfulTimeout=2e3,i.ignore=["busy","successful","errors","progress","originalData","recentlySuccessful","recentlySuccessfulTimeoutId"];export{i as g}; 2 | -------------------------------------------------------------------------------- /public/images/logo-light-teal.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Group 2 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /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 | 'search_path' => '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 | // 'encrypt' => env('DB_ENCRYPT', 'yes'), 93 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Migration Repository Table 101 | |-------------------------------------------------------------------------- 102 | | 103 | | This table keeps track of all the migrations that have already run for 104 | | your application. Using this information, we can determine which of 105 | | the migrations on disk haven't actually been run in the database. 106 | | 107 | */ 108 | 109 | 'migrations' => 'migrations', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Redis Databases 114 | |-------------------------------------------------------------------------- 115 | | 116 | | Redis is an open source, fast, and advanced key-value store that also 117 | | provides a richer body of commands than a typical key-value system 118 | | such as APC or Memcached. Laravel makes it easy to dig right in. 119 | | 120 | */ 121 | 122 | 'redis' => [ 123 | 124 | 'client' => env('REDIS_CLIENT', 'phpredis'), 125 | 126 | 'options' => [ 127 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 128 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 129 | ], 130 | 131 | 'default' => [ 132 | 'url' => env('REDIS_URL'), 133 | 'host' => env('REDIS_HOST', '127.0.0.1'), 134 | 'username' => env('REDIS_USERNAME'), 135 | 'password' => env('REDIS_PASSWORD'), 136 | 'port' => env('REDIS_PORT', '6379'), 137 | 'database' => env('REDIS_DB', '0'), 138 | ], 139 | 140 | 'cache' => [ 141 | 'url' => env('REDIS_URL'), 142 | 'host' => env('REDIS_HOST', '127.0.0.1'), 143 | 'username' => env('REDIS_USERNAME'), 144 | 'password' => env('REDIS_PASSWORD'), 145 | 'port' => env('REDIS_PORT', '6379'), 146 | 'database' => env('REDIS_CACHE_DB', '1'), 147 | ], 148 | 149 | ], 150 | 151 | ]; 152 | -------------------------------------------------------------------------------- /public/images/abstract-1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Artboard 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /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'), 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'), 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'), 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/app.php: -------------------------------------------------------------------------------- 1 | env('APP_NAME', 'Laravel'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Application Environment 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This value determines the "environment" your application is currently 26 | | running in. This may determine how you prefer to configure various 27 | | services the application utilizes. Set this in your ".env" file. 28 | | 29 | */ 30 | 31 | 'env' => env('APP_ENV', 'production'), 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Application Debug Mode 36 | |-------------------------------------------------------------------------- 37 | | 38 | | When your application is in debug mode, detailed error messages with 39 | | stack traces will be shown on every error that occurs within your 40 | | application. If disabled, a simple generic error page is shown. 41 | | 42 | */ 43 | 44 | 'debug' => (bool) env('APP_DEBUG', false), 45 | 46 | /* 47 | |-------------------------------------------------------------------------- 48 | | Application URL 49 | |-------------------------------------------------------------------------- 50 | | 51 | | This URL is used by the console to properly generate URLs when using 52 | | the Artisan command line tool. You should set this to the root of 53 | | your application so that it is used when running Artisan tasks. 54 | | 55 | */ 56 | 57 | 'url' => env('APP_URL', 'http://localhost'), 58 | 59 | 'asset_url' => env('ASSET_URL'), 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Application Timezone 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may specify the default timezone for your application, which 67 | | will be used by the PHP date and date-time functions. We have gone 68 | | ahead and set this to a sensible default for you out of the box. 69 | | 70 | */ 71 | 72 | 'timezone' => 'UTC', 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Application Locale Configuration 77 | |-------------------------------------------------------------------------- 78 | | 79 | | The application locale determines the default locale that will be used 80 | | by the translation service provider. You are free to set this value 81 | | to any of the locales which will be supported by the application. 82 | | 83 | */ 84 | 85 | 'locale' => 'en', 86 | 87 | /* 88 | |-------------------------------------------------------------------------- 89 | | Application Fallback Locale 90 | |-------------------------------------------------------------------------- 91 | | 92 | | The fallback locale determines the locale to use when the current one 93 | | is not available. You may change the value to correspond to any of 94 | | the language folders that are provided through your application. 95 | | 96 | */ 97 | 98 | 'fallback_locale' => 'en', 99 | 100 | /* 101 | |-------------------------------------------------------------------------- 102 | | Faker Locale 103 | |-------------------------------------------------------------------------- 104 | | 105 | | This locale will be used by the Faker PHP library when generating fake 106 | | data for your database seeds. For example, this will be used to get 107 | | localized telephone numbers, street address information and more. 108 | | 109 | */ 110 | 111 | 'faker_locale' => 'en_US', 112 | 113 | /* 114 | |-------------------------------------------------------------------------- 115 | | Encryption Key 116 | |-------------------------------------------------------------------------- 117 | | 118 | | This key is used by the Illuminate encrypter service and should be set 119 | | to a random, 32 character string, otherwise these encrypted strings 120 | | will not be safe. Please do this before deploying an application! 121 | | 122 | */ 123 | 124 | 'key' => env('APP_KEY'), 125 | 126 | 'cipher' => 'AES-256-CBC', 127 | 128 | /* 129 | |-------------------------------------------------------------------------- 130 | | Maintenance Mode Driver 131 | |-------------------------------------------------------------------------- 132 | | 133 | | These configuration options determine the driver used to determine and 134 | | manage Laravel's "maintenance mode" status. The "cache" driver will 135 | | allow maintenance mode to be controlled across multiple machines. 136 | | 137 | | Supported drivers: "file", "cache" 138 | | 139 | */ 140 | 141 | 'maintenance' => [ 142 | 'driver' => 'file', 143 | // 'store' => 'redis', 144 | ], 145 | 146 | /* 147 | |-------------------------------------------------------------------------- 148 | | Autoloaded Service Providers 149 | |-------------------------------------------------------------------------- 150 | | 151 | | The service providers listed here will be automatically loaded on the 152 | | request to your application. Feel free to add your own services to 153 | | this array to grant expanded functionality to your applications. 154 | | 155 | */ 156 | 157 | 'providers' => [ 158 | 159 | /* 160 | * Laravel Framework Service Providers... 161 | */ 162 | Illuminate\Auth\AuthServiceProvider::class, 163 | Illuminate\Broadcasting\BroadcastServiceProvider::class, 164 | Illuminate\Bus\BusServiceProvider::class, 165 | Illuminate\Cache\CacheServiceProvider::class, 166 | Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, 167 | Illuminate\Cookie\CookieServiceProvider::class, 168 | Illuminate\Database\DatabaseServiceProvider::class, 169 | Illuminate\Encryption\EncryptionServiceProvider::class, 170 | Illuminate\Filesystem\FilesystemServiceProvider::class, 171 | Illuminate\Foundation\Providers\FoundationServiceProvider::class, 172 | Illuminate\Hashing\HashServiceProvider::class, 173 | Illuminate\Mail\MailServiceProvider::class, 174 | Illuminate\Notifications\NotificationServiceProvider::class, 175 | Illuminate\Pagination\PaginationServiceProvider::class, 176 | Illuminate\Pipeline\PipelineServiceProvider::class, 177 | Illuminate\Queue\QueueServiceProvider::class, 178 | Illuminate\Redis\RedisServiceProvider::class, 179 | Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, 180 | Illuminate\Session\SessionServiceProvider::class, 181 | Illuminate\Translation\TranslationServiceProvider::class, 182 | Illuminate\Validation\ValidationServiceProvider::class, 183 | Illuminate\View\ViewServiceProvider::class, 184 | 185 | /* 186 | * Package Service Providers... 187 | */ 188 | 189 | /* 190 | * Application Service Providers... 191 | */ 192 | App\Providers\AppServiceProvider::class, 193 | App\Providers\AuthServiceProvider::class, 194 | // App\Providers\BroadcastServiceProvider::class, 195 | App\Providers\EventServiceProvider::class, 196 | App\Providers\RouteServiceProvider::class, 197 | 198 | ], 199 | 200 | /* 201 | |-------------------------------------------------------------------------- 202 | | Class Aliases 203 | |-------------------------------------------------------------------------- 204 | | 205 | | This array of class aliases will be registered when this application 206 | | is started. However, feel free to register as many as you wish as 207 | | the aliases are "lazy" loaded so they don't hinder performance. 208 | | 209 | */ 210 | 211 | 'aliases' => Facade::defaultAliases()->merge([ 212 | // 'ExampleClass' => App\Example\ExampleClass::class, 213 | ])->toArray(), 214 | 215 | ]; 216 | -------------------------------------------------------------------------------- /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 | 'array' => 'The :attribute must have between :min and :max items.', 29 | 'file' => 'The :attribute must be between :min and :max kilobytes.', 30 | 'numeric' => 'The :attribute must be between :min and :max.', 31 | 'string' => 'The :attribute must be between :min and :max characters.', 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 | 'doesnt_end_with' => 'The :attribute may not end with one of the following: :values.', 47 | 'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.', 48 | 'email' => 'The :attribute must be a valid email address.', 49 | 'ends_with' => 'The :attribute must end with one of the following: :values.', 50 | 'enum' => 'The selected :attribute is invalid.', 51 | 'exists' => 'The selected :attribute is invalid.', 52 | 'file' => 'The :attribute must be a file.', 53 | 'filled' => 'The :attribute field must have a value.', 54 | 'gt' => [ 55 | 'array' => 'The :attribute must have more than :value items.', 56 | 'file' => 'The :attribute must be greater than :value kilobytes.', 57 | 'numeric' => 'The :attribute must be greater than :value.', 58 | 'string' => 'The :attribute must be greater than :value characters.', 59 | ], 60 | 'gte' => [ 61 | 'array' => 'The :attribute must have :value items or more.', 62 | 'file' => 'The :attribute must be greater than or equal to :value kilobytes.', 63 | 'numeric' => 'The :attribute must be greater than or equal to :value.', 64 | 'string' => 'The :attribute must be greater than or equal to :value characters.', 65 | ], 66 | 'image' => 'The :attribute must be an image.', 67 | 'in' => 'The selected :attribute is invalid.', 68 | 'in_array' => 'The :attribute field does not exist in :other.', 69 | 'integer' => 'The :attribute must be an integer.', 70 | 'ip' => 'The :attribute must be a valid IP address.', 71 | 'ipv4' => 'The :attribute must be a valid IPv4 address.', 72 | 'ipv6' => 'The :attribute must be a valid IPv6 address.', 73 | 'json' => 'The :attribute must be a valid JSON string.', 74 | 'lt' => [ 75 | 'array' => 'The :attribute must have less than :value items.', 76 | 'file' => 'The :attribute must be less than :value kilobytes.', 77 | 'numeric' => 'The :attribute must be less than :value.', 78 | 'string' => 'The :attribute must be less than :value characters.', 79 | ], 80 | 'lte' => [ 81 | 'array' => 'The :attribute must not have more than :value items.', 82 | 'file' => 'The :attribute must be less than or equal to :value kilobytes.', 83 | 'numeric' => 'The :attribute must be less than or equal to :value.', 84 | 'string' => 'The :attribute must be less than or equal to :value characters.', 85 | ], 86 | 'mac_address' => 'The :attribute must be a valid MAC address.', 87 | 'max' => [ 88 | 'array' => 'The :attribute must not have more than :max items.', 89 | 'file' => 'The :attribute must not be greater than :max kilobytes.', 90 | 'numeric' => 'The :attribute must not be greater than :max.', 91 | 'string' => 'The :attribute must not be greater than :max characters.', 92 | ], 93 | 'max_digits' => 'The :attribute must not have more than :max digits.', 94 | 'mimes' => 'The :attribute must be a file of type: :values.', 95 | 'mimetypes' => 'The :attribute must be a file of type: :values.', 96 | 'min' => [ 97 | 'array' => 'The :attribute must have at least :min items.', 98 | 'file' => 'The :attribute must be at least :min kilobytes.', 99 | 'numeric' => 'The :attribute must be at least :min.', 100 | 'string' => 'The :attribute must be at least :min characters.', 101 | ], 102 | 'min_digits' => 'The :attribute must have at least :min digits.', 103 | 'multiple_of' => 'The :attribute must be a multiple of :value.', 104 | 'not_in' => 'The selected :attribute is invalid.', 105 | 'not_regex' => 'The :attribute format is invalid.', 106 | 'numeric' => 'The :attribute must be a number.', 107 | 'password' => [ 108 | 'letters' => 'The :attribute must contain at least one letter.', 109 | 'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.', 110 | 'numbers' => 'The :attribute must contain at least one number.', 111 | 'symbols' => 'The :attribute must contain at least one symbol.', 112 | 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', 113 | ], 114 | 'present' => 'The :attribute field must be present.', 115 | 'prohibited' => 'The :attribute field is prohibited.', 116 | 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', 117 | 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', 118 | 'prohibits' => 'The :attribute field prohibits :other from being present.', 119 | 'regex' => 'The :attribute format is invalid.', 120 | 'required' => 'The :attribute field is required.', 121 | 'required_array_keys' => 'The :attribute field must contain entries for: :values.', 122 | 'required_if' => 'The :attribute field is required when :other is :value.', 123 | 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', 124 | 'required_unless' => 'The :attribute field is required unless :other is in :values.', 125 | 'required_with' => 'The :attribute field is required when :values is present.', 126 | 'required_with_all' => 'The :attribute field is required when :values are present.', 127 | 'required_without' => 'The :attribute field is required when :values is not present.', 128 | 'required_without_all' => 'The :attribute field is required when none of :values are present.', 129 | 'same' => 'The :attribute and :other must match.', 130 | 'size' => [ 131 | 'array' => 'The :attribute must contain :size items.', 132 | 'file' => 'The :attribute must be :size kilobytes.', 133 | 'numeric' => 'The :attribute must be :size.', 134 | 'string' => 'The :attribute must be :size characters.', 135 | ], 136 | 'starts_with' => 'The :attribute must start with one of the following: :values.', 137 | 'string' => 'The :attribute must be a string.', 138 | 'timezone' => 'The :attribute must be a valid timezone.', 139 | 'unique' => 'The :attribute has already been taken.', 140 | 'uploaded' => 'The :attribute failed to upload.', 141 | 'url' => 'The :attribute must be a valid URL.', 142 | 'uuid' => 'The :attribute must be a valid UUID.', 143 | 144 | /* 145 | |-------------------------------------------------------------------------- 146 | | Custom Validation Language Lines 147 | |-------------------------------------------------------------------------- 148 | | 149 | | Here you may specify custom validation messages for attributes using the 150 | | convention "attribute.rule" to name the lines. This makes it quick to 151 | | specify a specific custom language line for a given attribute rule. 152 | | 153 | */ 154 | 155 | 'custom' => [ 156 | 'attribute-name' => [ 157 | 'rule-name' => 'custom-message', 158 | ], 159 | ], 160 | 161 | /* 162 | |-------------------------------------------------------------------------- 163 | | Custom Validation Attributes 164 | |-------------------------------------------------------------------------- 165 | | 166 | | The following language lines are used to swap our attribute placeholder 167 | | with something more reader friendly such as "E-Mail Address" instead 168 | | of "email". This simply helps us make our message more expressive. 169 | | 170 | */ 171 | 172 | 'attributes' => [], 173 | 174 | ]; 175 | --------------------------------------------------------------------------------