├── database
├── .gitignore
├── factories
│ ├── OrganizationFactory.php
│ ├── ContactFactory.php
│ └── UserFactory.php
├── migrations
│ ├── 2020_01_01_000003_create_accounts_table.php
│ ├── 2020_01_01_000001_create_password_resets_table.php
│ ├── 2020_01_01_000002_create_failed_jobs_table.php
│ ├── 2019_12_14_000001_create_personal_access_tokens_table.php
│ ├── 2020_01_01_000004_create_users_table.php
│ ├── 2020_01_01_000005_create_organizations_table.php
│ └── 2020_01_01_000006_create_contacts_table.php
└── seeders
│ └── DatabaseSeeder.php
├── .github
└── FUNDING.yml
├── bootstrap
├── cache
│ └── .gitignore
└── app.php
├── storage
├── logs
│ └── .gitignore
├── app
│ ├── public
│ │ └── .gitignore
│ └── .gitignore
├── debugbar
│ └── .gitignore
└── framework
│ ├── testing
│ └── .gitignore
│ ├── views
│ └── .gitignore
│ ├── cache
│ ├── data
│ │ └── .gitignore
│ └── .gitignore
│ ├── sessions
│ └── .gitignore
│ └── .gitignore
├── public
├── robots.txt
├── .htaccess
├── favicon.svg
├── web.config
└── index.php
├── Procfile
├── screenshot.png
├── resources
├── css
│ ├── reset.css
│ ├── app.css
│ ├── buttons.css
│ └── form.css
├── js
│ ├── Shared
│ │ ├── LoadingButton.vue
│ │ ├── TrashedMessage.vue
│ │ ├── Pagination.vue
│ │ ├── TextareaInput.vue
│ │ ├── TextInput.vue
│ │ ├── SelectInput.vue
│ │ ├── Dropdown.vue
│ │ ├── SearchFilter.vue
│ │ ├── FileInput.vue
│ │ ├── Icon.vue
│ │ ├── MainMenu.vue
│ │ ├── Logo.vue
│ │ ├── FlashMessages.vue
│ │ └── Layout.vue
│ ├── Pages
│ │ ├── Reports
│ │ │ └── Index.vue
│ │ ├── Dashboard
│ │ │ └── Index.vue
│ │ ├── Auth
│ │ │ └── Login.vue
│ │ ├── Users
│ │ │ ├── Create.vue
│ │ │ ├── Edit.vue
│ │ │ └── Index.vue
│ │ ├── Organizations
│ │ │ ├── Create.vue
│ │ │ ├── Index.vue
│ │ │ └── Edit.vue
│ │ └── Contacts
│ │ │ ├── Create.vue
│ │ │ ├── Index.vue
│ │ │ └── Edit.vue
│ ├── ssr.js
│ └── app.js
├── lang
│ └── en
│ │ ├── pagination.php
│ │ ├── auth.php
│ │ └── passwords.php
└── views
│ └── app.blade.php
├── .gitattributes
├── .prettierrc
├── tests
├── TestCase.php
├── Unit
│ └── ExampleTest.php
├── CreatesApplication.php
└── Feature
│ ├── OrganizationsTest.php
│ └── ContactsTest.php
├── .styleci.yml
├── app
├── Http
│ ├── Controllers
│ │ ├── ReportsController.php
│ │ ├── DashboardController.php
│ │ ├── Controller.php
│ │ ├── ImagesController.php
│ │ ├── Auth
│ │ │ └── AuthenticatedSessionController.php
│ │ ├── OrganizationsController.php
│ │ ├── UsersController.php
│ │ └── ContactsController.php
│ ├── Middleware
│ │ ├── EncryptCookies.php
│ │ ├── VerifyCsrfToken.php
│ │ ├── PreventRequestsDuringMaintenance.php
│ │ ├── TrustHosts.php
│ │ ├── TrimStrings.php
│ │ ├── Authenticate.php
│ │ ├── TrustProxies.php
│ │ ├── RedirectIfAuthenticated.php
│ │ └── HandleInertiaRequests.php
│ ├── Requests
│ │ └── Auth
│ │ │ └── LoginRequest.php
│ └── Kernel.php
├── Models
│ ├── Account.php
│ ├── Organization.php
│ ├── Contact.php
│ └── User.php
├── Providers
│ ├── BroadcastServiceProvider.php
│ ├── AppServiceProvider.php
│ ├── AuthServiceProvider.php
│ ├── EventServiceProvider.php
│ └── RouteServiceProvider.php
├── Console
│ └── Kernel.php
└── Exceptions
│ └── Handler.php
├── .editorconfig
├── .gitignore
├── webpack.ssr.mix.js
├── webpack.config.js
├── server.php
├── routes
├── channels.php
├── api.php
├── console.php
└── web.php
├── config
├── cors.php
├── services.php
├── view.php
├── inertia.php
├── hashing.php
├── broadcasting.php
├── sanctum.php
├── filesystems.php
├── queue.php
├── cache.php
├── logging.php
├── mail.php
├── auth.php
└── database.php
├── .eslintrc.js
├── webpack.mix.js
├── .env.example
├── LICENSE
├── phpunit.xml
├── tailwind.config.js
├── readme.md
├── package.json
├── artisan
├── composer.json
└── .php-cs-fixer.dist.php
/database/.gitignore:
--------------------------------------------------------------------------------
1 | *.sqlite*
2 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [reinink]
2 |
--------------------------------------------------------------------------------
/bootstrap/cache/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/logs/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/storage/app/public/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/storage/debugbar/.gitignore:
--------------------------------------------------------------------------------
1 | *
2 | !.gitignore
3 |
--------------------------------------------------------------------------------
/Procfile:
--------------------------------------------------------------------------------
1 | web: vendor/bin/heroku-php-apache2 public/
2 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/inertiajs/pingcrm-vue2/HEAD/screenshot.png
--------------------------------------------------------------------------------
/resources/css/reset.css:
--------------------------------------------------------------------------------
1 | input, select, textarea, button, div, a {
2 | &:focus, &:active {
3 | outline: none;
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.css linguist-vendored
3 | *.scss linguist-vendored
4 | *.js linguist-vendored
5 | CHANGELOG.md export-ignore
6 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 10000,
3 | "semi": false,
4 | "singleQuote": true,
5 | "tabWidth": 2,
6 | "trailingComma": "all",
7 | "htmlWhitespaceSensitivity": "css"
8 | }
9 |
--------------------------------------------------------------------------------
/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 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/.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,vue}]
15 | indent_size = 2
16 |
17 | [docker-compose.yml]
18 | indent_size = 4
19 |
--------------------------------------------------------------------------------
/tests/Unit/ExampleTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | /public/css
3 | /public/hot
4 | /public/js
5 | /public/mix-manifest.json
6 | /public/storage
7 | /storage/*.key
8 | /vendor
9 | .DS_Store
10 | .env
11 | .env.backup
12 | .phpunit.result.cache
13 | .php-cs-fixer.php
14 | .php-cs-fixer.cache
15 | docker-compose.override.yml
16 | Homestead.json
17 | Homestead.yaml
18 | npm-debug.log
19 | yarn-error.log
20 | /.idea
21 | /.vscode
22 |
--------------------------------------------------------------------------------
/resources/js/Pages/Reports/Index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Reports
5 |
6 |
7 |
8 |
19 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Controller.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 |
--------------------------------------------------------------------------------
/app/Models/Account.php:
--------------------------------------------------------------------------------
1 | hasMany(User::class);
12 | }
13 |
14 | public function organizations()
15 | {
16 | return $this->hasMany(Organization::class);
17 | }
18 |
19 | public function contacts()
20 | {
21 | return $this->hasMany(Contact::class);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/CreatesApplication.php:
--------------------------------------------------------------------------------
1 | make(Kernel::class)->bootstrap();
19 |
20 | return $app;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/Providers/BroadcastServiceProvider.php:
--------------------------------------------------------------------------------
1 | expectsJson()) {
18 | return route('login');
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/resources/js/ssr.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import { createRenderer } from 'vue-server-renderer'
3 | import { createInertiaApp } from '@inertiajs/inertia-vue'
4 | import createServer from '@inertiajs/server'
5 |
6 | createServer((page) => createInertiaApp({
7 | page,
8 | render: createRenderer().renderToString,
9 | resolve: name => require(`./Pages/${name}`),
10 | title: title => title ? `${title} - Ping CRM` : 'Ping CRM',
11 | setup({ app, props, plugin }) {
12 | Vue.use(plugin)
13 | return new Vue({
14 | render: h => h(app, props),
15 | })
16 | },
17 | }))
18 |
--------------------------------------------------------------------------------
/resources/js/app.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import PortalVue from 'portal-vue'
3 | import { InertiaProgress } from '@inertiajs/progress'
4 | import { createInertiaApp } from '@inertiajs/inertia-vue'
5 |
6 | Vue.config.productionTip = false
7 | Vue.use(PortalVue)
8 |
9 | InertiaProgress.init()
10 |
11 | createInertiaApp({
12 | resolve: name => require(`./Pages/${name}`),
13 | title: title => title ? `${title} - Ping CRM` : 'Ping CRM',
14 | setup({ el, app, props, plugin }) {
15 | Vue.use(plugin)
16 | new Vue({ render: h => h(app, props) })
17 | .$mount(el)
18 | },
19 | })
20 |
--------------------------------------------------------------------------------
/app/Providers/AppServiceProvider.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 | $uri = urldecode(
9 | parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
10 | );
11 |
12 | // This file allows us to emulate Apache's "mod_rewrite" functionality from the
13 | // built-in PHP web server. This provides a convenient way to test a Laravel
14 | // application without having installed a "real" web server software here.
15 | if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
16 | return false;
17 | }
18 |
19 | require_once __DIR__.'/public/index.php';
20 |
--------------------------------------------------------------------------------
/resources/js/Pages/Dashboard/Index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Dashboard
5 | Hey there! Welcome to Ping CRM, a demo app designed to help illustrate how Inertia.js works.
6 |
7 |
8 |
9 |
20 |
--------------------------------------------------------------------------------
/resources/lang/en/pagination.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 | 'next' => 'Next »',
18 |
19 | ];
20 |
--------------------------------------------------------------------------------
/routes/channels.php:
--------------------------------------------------------------------------------
1 | id === (int) $id;
18 | });
19 |
--------------------------------------------------------------------------------
/routes/api.php:
--------------------------------------------------------------------------------
1 | get('/user', function (Request $request) {
18 | return $request->user();
19 | });
20 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/resources/js/Shared/TrashedMessage.vue:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/app/Providers/AuthServiceProvider.php:
--------------------------------------------------------------------------------
1 |
13 | */
14 | protected $policies = [
15 | // 'App\Models\Model' => 'App\Policies\ModelPolicy',
16 | ];
17 |
18 | /**
19 | * Register any authentication / authorization services.
20 | *
21 | * @return void
22 | */
23 | public function boot()
24 | {
25 | $this->registerPolicies();
26 |
27 | //
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/resources/lang/en/auth.php:
--------------------------------------------------------------------------------
1 | 'These credentials do not match our records.',
17 | 'password' => 'The provided password is incorrect.',
18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
19 |
20 | ];
21 |
--------------------------------------------------------------------------------
/public/favicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/Http/Controllers/ImagesController.php:
--------------------------------------------------------------------------------
1 | new LaravelResponseFactory($request),
16 | 'source' => $filesystem->getDriver(),
17 | 'cache' => $filesystem->getDriver(),
18 | 'cache_path_prefix' => '.glide-cache',
19 | ]);
20 |
21 | return $server->getImageResponse($path, $request->all());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/resources/css/buttons.css:
--------------------------------------------------------------------------------
1 | .btn-indigo {
2 | @apply px-6 py-3 rounded bg-indigo-600 text-white text-sm leading-4 font-bold whitespace-nowrap hover:bg-orange-400 focus:bg-orange-400;
3 | }
4 |
5 | .btn-spinner,
6 | .btn-spinner:after {
7 | border-radius: 50%;
8 | width: 1.5em;
9 | height: 1.5em;
10 | }
11 |
12 | .btn-spinner {
13 | font-size: 10px;
14 | position: relative;
15 | text-indent: -9999em;
16 | border-top: 0.2em solid white;
17 | border-right: 0.2em solid white;
18 | border-bottom: 0.2em solid white;
19 | border-left: 0.2em solid transparent;
20 | transform: translateZ(0);
21 | animation: spinning 1s infinite linear;
22 | }
23 |
24 | @keyframes spinning {
25 | 0% {
26 | transform: rotate(0deg);
27 | }
28 | 100% {
29 | transform: rotate(360deg);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/database/factories/OrganizationFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->company,
18 | 'email' => $this->faker->companyEmail,
19 | 'phone' => $this->faker->tollFreePhoneNumber,
20 | 'address' => $this->faker->streetAddress,
21 | 'city' => $this->faker->city,
22 | 'region' => $this->faker->state,
23 | 'country' => 'US',
24 | 'postal_code' => $this->faker->postcode,
25 | ];
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/database/migrations/2020_01_01_000003_create_accounts_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->string('name', 50);
19 | $table->timestamps();
20 | });
21 | }
22 |
23 | /**
24 | * Reverse the migrations.
25 | *
26 | * @return void
27 | */
28 | public function down()
29 | {
30 | Schema::dropIfExists('accounts');
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/resources/js/Shared/Pagination.vue:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
24 |
--------------------------------------------------------------------------------
/resources/lang/en/passwords.php:
--------------------------------------------------------------------------------
1 | 'Your password has been reset!',
17 | 'sent' => 'We have emailed your password reset link!',
18 | 'throttled' => 'Please wait before retrying.',
19 | 'token' => 'This password reset token is invalid.',
20 | 'user' => "We can't find a user with that email address.",
21 |
22 | ];
23 |
--------------------------------------------------------------------------------
/database/factories/ContactFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->firstName,
18 | 'last_name' => $this->faker->lastName,
19 | 'email' => $this->faker->unique()->safeEmail,
20 | 'phone' => $this->faker->tollFreePhoneNumber,
21 | 'address' => $this->faker->streetAddress,
22 | 'city' => $this->faker->city,
23 | 'region' => $this->faker->state,
24 | 'country' => 'US',
25 | 'postal_code' => $this->faker->postcode,
26 | ];
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/database/migrations/2020_01_01_000001_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/views/app.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | {{-- Inertia --}}
10 |
11 |
12 | {{-- Ping CRM --}}
13 |
14 |
15 |
16 | @inertiaHead
17 |
18 |
19 | @inertia
20 |
21 |
22 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/resources/js/Shared/TextareaInput.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ label }}:
4 |
5 |
{{ error }}
6 |
7 |
8 |
9 |
36 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['eslint:recommended', 'plugin:vue/recommended'],
3 | parserOptions: {
4 | ecmaVersion: 2020,
5 | sourceType: 'module',
6 | },
7 | env: {
8 | amd: true,
9 | browser: true,
10 | es6: true,
11 | },
12 | rules: {
13 | indent: ['error', 2],
14 | quotes: ['warn', 'single'],
15 | semi: ['warn', 'never'],
16 | 'no-unused-vars': ['error', { vars: 'all', args: 'after-used', ignoreRestSiblings: true }],
17 | 'comma-dangle': ['warn', 'always-multiline'],
18 | 'vue/multi-word-component-names': 'off',
19 | 'vue/max-attributes-per-line': 'off',
20 | 'vue/no-v-html': 'off',
21 | 'vue/require-default-prop': 'off',
22 | 'vue/singleline-html-element-content-newline': 'off',
23 | 'vue/html-self-closing': [
24 | 'warn',
25 | {
26 | html: {
27 | void: 'always',
28 | normal: 'always',
29 | component: 'always',
30 | },
31 | },
32 | ],
33 | },
34 | }
35 |
--------------------------------------------------------------------------------
/app/Exceptions/Handler.php:
--------------------------------------------------------------------------------
1 | >
14 | */
15 | protected $dontReport = [
16 | //
17 | ];
18 |
19 | /**
20 | * A list of the inputs that are never flashed for validation exceptions.
21 | *
22 | * @var array
23 | */
24 | protected $dontFlash = [
25 | 'current_password',
26 | 'password',
27 | 'password_confirmation',
28 | ];
29 |
30 | /**
31 | * Register the exception handling callbacks for the application.
32 | *
33 | * @return void
34 | */
35 | public function register()
36 | {
37 | $this->reportable(function (Throwable $e) {
38 | //
39 | });
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/database/migrations/2020_01_01_000002_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 |
--------------------------------------------------------------------------------
/webpack.mix.js:
--------------------------------------------------------------------------------
1 | const process = require('process')
2 | const mix = require('laravel-mix')
3 | const cssImport = require('postcss-import')
4 | const cssNesting = require('postcss-nesting')
5 | const webpackConfig = require('./webpack.config')
6 |
7 | /*
8 | |--------------------------------------------------------------------------
9 | | Mix Asset Management
10 | |--------------------------------------------------------------------------
11 | |
12 | | Mix provides a clean, fluent API for defining some Webpack build steps
13 | | for your Laravel application. By default, we are compiling the Sass
14 | | file for the application as well as bundling up all the JS files.
15 | |
16 | */
17 |
18 | mix
19 | .js('resources/js/app.js', 'public/js')
20 | .vue({ runtimeOnly: (process.env.NODE_ENV || 'production') === 'production' })
21 | .webpackConfig(webpackConfig)
22 | .postCss('resources/css/app.css', 'public/css', [
23 | // prettier-ignore
24 | cssImport(),
25 | cssNesting(),
26 | require('tailwindcss'),
27 | ])
28 | .version()
29 | .sourceMaps()
30 |
--------------------------------------------------------------------------------
/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->timestamps();
24 | });
25 | }
26 |
27 | /**
28 | * Reverse the migrations.
29 | *
30 | * @return void
31 | */
32 | public function down()
33 | {
34 | Schema::dropIfExists('personal_access_tokens');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/config/services.php:
--------------------------------------------------------------------------------
1 | [
18 | 'domain' => env('MAILGUN_DOMAIN'),
19 | 'secret' => env('MAILGUN_SECRET'),
20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
21 | ],
22 |
23 | 'postmark' => [
24 | 'token' => env('POSTMARK_TOKEN'),
25 | ],
26 |
27 | 'ses' => [
28 | 'key' => env('AWS_ACCESS_KEY_ID'),
29 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
30 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
31 | ],
32 |
33 | ];
34 |
--------------------------------------------------------------------------------
/resources/js/Shared/TextInput.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ label }}:
4 |
5 |
{{ error }}
6 |
7 |
8 |
9 |
43 |
--------------------------------------------------------------------------------
/resources/js/Shared/SelectInput.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ label }}:
4 |
5 |
6 |
7 |
{{ error }}
8 |
9 |
10 |
11 |
48 |
--------------------------------------------------------------------------------
/.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=sqlite
12 | #DB_HOST=127.0.0.1
13 | #DB_PORT=3306
14 | #DB_DATABASE=pingcrm
15 | #DB_USERNAME=root
16 | #DB_PASSWORD=
17 |
18 | BROADCAST_DRIVER=log
19 | CACHE_DRIVER=file
20 | FILESYSTEM_DRIVER=local
21 | QUEUE_CONNECTION=sync
22 | SESSION_DRIVER=file
23 | SESSION_LIFETIME=120
24 |
25 | MEMCACHED_HOST=127.0.0.1
26 |
27 | REDIS_HOST=127.0.0.1
28 | REDIS_PASSWORD=null
29 | REDIS_PORT=6379
30 |
31 | MAIL_MAILER=smtp
32 | MAIL_HOST=mailhog
33 | MAIL_PORT=1025
34 | MAIL_USERNAME=null
35 | MAIL_PASSWORD=null
36 | MAIL_ENCRYPTION=null
37 | MAIL_FROM_ADDRESS=null
38 | MAIL_FROM_NAME="${APP_NAME}"
39 |
40 | AWS_ACCESS_KEY_ID=
41 | AWS_SECRET_ACCESS_KEY=
42 | AWS_DEFAULT_REGION=us-east-1
43 | AWS_BUCKET=
44 | AWS_USE_PATH_STYLE_ENDPOINT=false
45 |
46 | PUSHER_APP_ID=
47 | PUSHER_APP_KEY=
48 | PUSHER_APP_SECRET=
49 | PUSHER_APP_CLUSTER=mt1
50 |
51 | MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
52 | MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
53 |
--------------------------------------------------------------------------------
/app/Models/Organization.php:
--------------------------------------------------------------------------------
1 | where($field ?? 'id', $value)->withTrashed()->firstOrFail();
17 | }
18 |
19 | public function contacts()
20 | {
21 | return $this->hasMany(Contact::class);
22 | }
23 |
24 | public function scopeFilter($query, array $filters)
25 | {
26 | $query->when($filters['search'] ?? null, function ($query, $search) {
27 | $query->where('name', 'like', '%'.$search.'%');
28 | })->when($filters['trashed'] ?? null, function ($query, $trashed) {
29 | if ($trashed === 'with') {
30 | $query->withTrashed();
31 | } elseif ($trashed === 'only') {
32 | $query->onlyTrashed();
33 | }
34 | });
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Jonathan Reinink
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/config/view.php:
--------------------------------------------------------------------------------
1 | [
17 | resource_path('views'),
18 | ],
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Compiled View Path
23 | |--------------------------------------------------------------------------
24 | |
25 | | This option determines where all the compiled Blade templates will be
26 | | stored for your application. Typically, this is within the storage
27 | | directory. However, as usual, you are free to change this value.
28 | |
29 | */
30 |
31 | 'compiled' => env(
32 | 'VIEW_COMPILED_PATH',
33 | realpath(storage_path('framework/views'))
34 | ),
35 |
36 | ];
37 |
--------------------------------------------------------------------------------
/database/factories/UserFactory.php:
--------------------------------------------------------------------------------
1 | $this->faker->firstName,
19 | 'last_name' => $this->faker->lastName,
20 | 'email' => $this->faker->unique()->safeEmail(),
21 | 'email_verified_at' => now(),
22 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
23 | 'remember_token' => Str::random(10),
24 | 'owner' => false,
25 | ];
26 | }
27 |
28 | /**
29 | * Indicate that the model's email address should be unverified.
30 | *
31 | * @return \Illuminate\Database\Eloquent\Factories\Factory
32 | */
33 | public function unverified()
34 | {
35 | return $this->state(function (array $attributes) {
36 | return [
37 | 'email_verified_at' => null,
38 | ];
39 | });
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/database/seeders/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | 'Acme Corporation']);
21 |
22 | User::factory()->create([
23 | 'account_id' => $account->id,
24 | 'first_name' => 'John',
25 | 'last_name' => 'Doe',
26 | 'email' => 'johndoe@example.com',
27 | 'password' => 'secret',
28 | 'owner' => true,
29 | ]);
30 |
31 | User::factory(5)->create(['account_id' => $account->id]);
32 |
33 | $organizations = Organization::factory(100)
34 | ->create(['account_id' => $account->id]);
35 |
36 | Contact::factory(100)
37 | ->create(['account_id' => $account->id])
38 | ->each(function ($contact) use ($organizations) {
39 | $contact->update(['organization_id' => $organizations->random()->id]);
40 | });
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/public/web.config:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/database/migrations/2020_01_01_000004_create_users_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->integer('account_id')->index();
19 | $table->string('first_name', 25);
20 | $table->string('last_name', 25);
21 | $table->string('email', 50)->unique();
22 | $table->timestamp('email_verified_at')->nullable();
23 | $table->string('password')->nullable();
24 | $table->boolean('owner')->default(false);
25 | $table->string('photo_path', 100)->nullable();
26 | $table->rememberToken();
27 | $table->timestamps();
28 | $table->softDeletes();
29 | });
30 | }
31 |
32 | /**
33 | * Reverse the migrations.
34 | *
35 | * @return void
36 | */
37 | public function down()
38 | {
39 | Schema::dropIfExists('users');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/database/migrations/2020_01_01_000005_create_organizations_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->integer('account_id')->index();
19 | $table->string('name', 100);
20 | $table->string('email', 50)->nullable();
21 | $table->string('phone', 50)->nullable();
22 | $table->string('address', 150)->nullable();
23 | $table->string('city', 50)->nullable();
24 | $table->string('region', 50)->nullable();
25 | $table->string('country', 2)->nullable();
26 | $table->string('postal_code', 25)->nullable();
27 | $table->timestamps();
28 | $table->softDeletes();
29 | });
30 | }
31 |
32 | /**
33 | * Reverse the migrations.
34 | *
35 | * @return void
36 | */
37 | public function down()
38 | {
39 | Schema::dropIfExists('organizations');
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/resources/css/form.css:
--------------------------------------------------------------------------------
1 | .form-label {
2 | @apply mb-2 block text-gray-700 select-none;
3 | }
4 |
5 | .form-input,
6 | .form-textarea,
7 | .form-select {
8 | @apply p-2 leading-normal block w-full border text-gray-700 bg-white font-sans rounded text-left appearance-none relative focus:border-indigo-400 focus:ring;
9 |
10 | &::placeholder {
11 | @apply text-gray-500 opacity-100;
12 | }
13 | }
14 |
15 | .form-select {
16 | @apply pr-6;
17 |
18 | background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAQCAYAAAAMJL+VAAAABGdBTUEAALGPC/xhBQAAAQtJREFUOBG1lEEOgjAQRalbGj2OG9caOACn4ALGtfEuHACiazceR1PWOH/CNA3aMiTaBDpt/7zPdBKy7M/DCL9pGkvxxVp7KsvyJftL5rZt1865M+Ucq6pyyF3hNcI7Cuu+728QYn/JQA5yKaempxuZmQngOwEaYx55nu+1lQh8GIatMGi+01NwBcEmhxBqK4nAPZJ78K0KKFAJmR3oPp8+Iwgob0Oa6+TLoeCvRx+mTUYf/FVBGTPRwDkfLxnaSrRwcH0FWhNOmrkWYbE2XEicqgSa1J0LQ+aPCuQgZiLnwewbGuz5MGoAhcIkCQcjaTBjMgtXGURMVHC1wcQEy0J+Zlj8bKAnY1/UzDe2dbAVqfXn6wAAAABJRU5ErkJggg==');
19 | background-size: 0.7rem;
20 | background-repeat: no-repeat;
21 | background-position: right 0.7rem center;
22 |
23 | &::-ms-expand {
24 | @apply opacity-0;
25 | }
26 | }
27 |
28 | .form-input.error,
29 | .form-textarea.error,
30 | .form-select.error {
31 | @apply border-red-500 focus:ring focus:ring-red-200;
32 | }
33 |
34 | .form-error {
35 | @apply text-red-700 mt-2 text-sm;
36 | }
37 |
--------------------------------------------------------------------------------
/app/Http/Controllers/Auth/AuthenticatedSessionController.php:
--------------------------------------------------------------------------------
1 | authenticate();
32 |
33 | $request->session()->regenerate();
34 |
35 | return redirect()->intended(RouteServiceProvider::HOME);
36 | }
37 |
38 | /**
39 | * Destroy an authenticated session.
40 | *
41 | * @return \Illuminate\Http\RedirectResponse
42 | */
43 | public function destroy(Request $request)
44 | {
45 | Auth::guard('web')->logout();
46 |
47 | $request->session()->invalidate();
48 |
49 | $request->session()->regenerateToken();
50 |
51 | return redirect('/');
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/database/migrations/2020_01_01_000006_create_contacts_table.php:
--------------------------------------------------------------------------------
1 | increments('id');
18 | $table->integer('account_id')->index();
19 | $table->integer('organization_id')->nullable()->index();
20 | $table->string('first_name', 25);
21 | $table->string('last_name', 25);
22 | $table->string('email', 50)->nullable();
23 | $table->string('phone', 50)->nullable();
24 | $table->string('address', 150)->nullable();
25 | $table->string('city', 50)->nullable();
26 | $table->string('region', 50)->nullable();
27 | $table->string('country', 2)->nullable();
28 | $table->string('postal_code', 25)->nullable();
29 | $table->timestamps();
30 | $table->softDeletes();
31 | });
32 | }
33 |
34 | /**
35 | * Reverse the migrations.
36 | *
37 | * @return void
38 | */
39 | public function down()
40 | {
41 | Schema::dropIfExists('contacts');
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | const colors = require('tailwindcss/colors')
2 | const defaultTheme = require('tailwindcss/defaultTheme')
3 |
4 | module.exports = {
5 | purge: [
6 | // prettier-ignore
7 | './resources/**/*.blade.php',
8 | './resources/**/*.js',
9 | './resources/**/*.vue',
10 | ],
11 | darkMode: false, // or 'media' or 'class'
12 | theme: {
13 | colors: {
14 | transparent: 'transparent',
15 | current: 'currentColor',
16 | black: colors.black,
17 | white: colors.white,
18 | red: colors.red,
19 | orange: colors.orange,
20 | yellow: colors.yellow,
21 | green: colors.green,
22 | gray: colors.blueGray,
23 | indigo: {
24 | 100: '#e6e8ff',
25 | 300: '#b2b7ff',
26 | 400: '#7886d7',
27 | 500: '#6574cd',
28 | 600: '#5661b3',
29 | 800: '#2f365f',
30 | 900: '#191e38',
31 | },
32 | },
33 | extend: {
34 | borderColor: theme => ({
35 | DEFAULT: theme('colors.gray.200', 'currentColor'),
36 | }),
37 | fontFamily: {
38 | sans: ['Cerebri Sans', ...defaultTheme.fontFamily.sans],
39 | },
40 | boxShadow: theme => ({
41 | outline: '0 0 0 2px ' + theme('colors.indigo.500'),
42 | }),
43 | fill: theme => theme('colors'),
44 | },
45 | },
46 | variants: {
47 | extend: {
48 | fill: ['focus', 'group-hover'],
49 | },
50 | },
51 | plugins: [],
52 | }
53 |
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # Ping CRM (Vue 2 version)
2 |
3 | A demo application to illustrate how Inertia.js works.
4 |
5 | 
6 |
7 | ## Installation
8 |
9 | Clone the repo locally:
10 |
11 | ```sh
12 | git clone https://github.com/inertiajs/pingcrm-vue2.git pingcrm-vue2
13 | cd pingcrm-vue2
14 | ```
15 |
16 | Install PHP dependencies:
17 |
18 | ```sh
19 | composer install
20 | ```
21 |
22 | Install NPM dependencies:
23 |
24 | ```sh
25 | npm ci
26 | ```
27 |
28 | Build assets:
29 |
30 | ```sh
31 | npm run dev
32 | ```
33 |
34 | Setup configuration:
35 |
36 | ```sh
37 | cp .env.example .env
38 | ```
39 |
40 | Generate application key:
41 |
42 | ```sh
43 | php artisan key:generate
44 | ```
45 |
46 | Create an SQLite database. You can also use another database (MySQL, Postgres), simply update your configuration accordingly.
47 |
48 | ```sh
49 | touch database/database.sqlite
50 | ```
51 |
52 | Run database migrations:
53 |
54 | ```sh
55 | php artisan migrate
56 | ```
57 |
58 | Run database seeder:
59 |
60 | ```sh
61 | php artisan db:seed
62 | ```
63 |
64 | Run the dev server (the output will give the address):
65 |
66 | ```sh
67 | php artisan serve
68 | ```
69 |
70 | You're ready to go! Visit Ping CRM in your browser, and login with:
71 |
72 | - **Username:** johndoe@example.com
73 | - **Password:** secret
74 |
75 | ## Running tests
76 |
77 | To run the Ping CRM tests, run:
78 |
79 | ```
80 | phpunit
81 | ```
82 |
--------------------------------------------------------------------------------
/resources/js/Shared/Dropdown.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
11 |
12 |
13 |
14 |
15 |
64 |
--------------------------------------------------------------------------------
/resources/js/Shared/SearchFilter.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
Filter
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
Reset
22 |
23 |
24 |
25 |
42 |
--------------------------------------------------------------------------------
/config/inertia.php:
--------------------------------------------------------------------------------
1 | [
20 |
21 | 'enabled' => true,
22 |
23 | 'url' => 'http://127.0.0.1:13714/render',
24 |
25 | ],
26 |
27 | /*
28 | |--------------------------------------------------------------------------
29 | | Testing
30 | |--------------------------------------------------------------------------
31 | |
32 | | The values described here are used to locate Inertia components on the
33 | | filesystem. For instance, when using `assertInertia`, the assertion
34 | | attempts to locate the component as a file relative to any of the
35 | | paths AND with any of the extensions specified here.
36 | |
37 | */
38 |
39 | 'testing' => [
40 |
41 | 'ensure_pages_exist' => true,
42 |
43 | 'page_paths' => [
44 |
45 | resource_path('js/Pages'),
46 |
47 | ],
48 |
49 | 'page_extensions' => [
50 |
51 | 'js',
52 | 'jsx',
53 | 'svelte',
54 | 'ts',
55 | 'tsx',
56 | 'vue',
57 |
58 | ],
59 |
60 | ],
61 |
62 | ];
63 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "scripts": {
4 | "dev": "npm run development",
5 | "development": "mix && npm run ssr:build",
6 | "fix:eslint": "eslint --ext .js,.vue resources/js/ --fix",
7 | "fix:prettier": "prettier --write --loglevel warn 'resources/js/**/*.vue'",
8 | "fix-code-style": "npm run fix:prettier && npm run fix:eslint",
9 | "watch": "mix watch",
10 | "watch-poll": "mix watch -- --watch-options-poll=1000",
11 | "hot": "mix watch --hot",
12 | "prod": "npm run production",
13 | "production": "mix --production && npm run ssr:build",
14 | "heroku-postbuild": "npm run prod",
15 | "ssr:build": "mix --production --mix-config=webpack.ssr.mix.js",
16 | "ssr:serve": "node public/js/ssr.js"
17 | },
18 | "dependencies": {
19 | "@inertiajs/inertia": "^0.11.0",
20 | "@inertiajs/inertia-vue": "^0.8.0",
21 | "@inertiajs/progress": "^0.2.7",
22 | "@inertiajs/server": "^0.1.0",
23 | "@popperjs/core": "^2.11.0",
24 | "autoprefixer": "^10.4.0",
25 | "eslint": "^8.4.1",
26 | "eslint-plugin-vue": "^8.2.0",
27 | "laravel-mix": "^6.0.41",
28 | "lodash": "^4.17.21",
29 | "portal-vue": "^2.1.7",
30 | "postcss": "^8.4.4",
31 | "postcss-import": "^12.0.1",
32 | "postcss-nesting": "^7.0.1",
33 | "prettier": "^2.5.1",
34 | "prettier-plugin-tailwind": "^2.2.12",
35 | "tailwindcss": "^2.0.3",
36 | "uuid": "^8.3.2",
37 | "vue": "^2.6.14",
38 | "vue-loader": "^15.9.7",
39 | "vue-server-renderer": "^2.6.14",
40 | "vue-template-compiler": "^2.6.14",
41 | "webpack-node-externals": "^3.0.0"
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/config/hashing.php:
--------------------------------------------------------------------------------
1 | 'bcrypt',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Bcrypt Options
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may specify the configuration options that should be used when
26 | | passwords are hashed using the Bcrypt algorithm. This will allow you
27 | | to control the amount of time it takes to hash the given password.
28 | |
29 | */
30 |
31 | 'bcrypt' => [
32 | 'rounds' => env('BCRYPT_ROUNDS', 10),
33 | ],
34 |
35 | /*
36 | |--------------------------------------------------------------------------
37 | | Argon Options
38 | |--------------------------------------------------------------------------
39 | |
40 | | Here you may specify the configuration options that should be used when
41 | | passwords are hashed using the Argon algorithm. These will allow you
42 | | to control the amount of time it takes to hash the given password.
43 | |
44 | */
45 |
46 | 'argon' => [
47 | 'memory' => 1024,
48 | 'threads' => 2,
49 | 'time' => 2,
50 | ],
51 |
52 | ];
53 |
--------------------------------------------------------------------------------
/app/Models/Contact.php:
--------------------------------------------------------------------------------
1 | where($field ?? 'id', $value)->withTrashed()->firstOrFail();
17 | }
18 |
19 | public function organization()
20 | {
21 | return $this->belongsTo(Organization::class);
22 | }
23 |
24 | public function getNameAttribute()
25 | {
26 | return $this->first_name.' '.$this->last_name;
27 | }
28 |
29 | public function scopeOrderByName($query)
30 | {
31 | $query->orderBy('last_name')->orderBy('first_name');
32 | }
33 |
34 | public function scopeFilter($query, array $filters)
35 | {
36 | $query->when($filters['search'] ?? null, function ($query, $search) {
37 | $query->where(function ($query) use ($search) {
38 | $query->where('first_name', 'like', '%'.$search.'%')
39 | ->orWhere('last_name', 'like', '%'.$search.'%')
40 | ->orWhere('email', 'like', '%'.$search.'%')
41 | ->orWhereHas('organization', function ($query) use ($search) {
42 | $query->where('name', 'like', '%'.$search.'%');
43 | });
44 | });
45 | })->when($filters['trashed'] ?? null, function ($query, $trashed) {
46 | if ($trashed === 'with') {
47 | $query->withTrashed();
48 | } elseif ($trashed === 'only') {
49 | $query->onlyTrashed();
50 | }
51 | });
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/resources/js/Shared/FileInput.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
{{ label }}:
4 |
16 |
{{ errors[0] }}
17 |
18 |
19 |
20 |
56 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/Providers/RouteServiceProvider.php:
--------------------------------------------------------------------------------
1 | configureRateLimiting();
39 |
40 | $this->routes(function () {
41 | Route::prefix('api')
42 | ->middleware('api')
43 | ->namespace($this->namespace)
44 | ->group(base_path('routes/api.php'));
45 |
46 | Route::middleware('web')
47 | ->namespace($this->namespace)
48 | ->group(base_path('routes/web.php'));
49 | });
50 | }
51 |
52 | /**
53 | * Configure the rate limiters for the application.
54 | *
55 | * @return void
56 | */
57 | protected function configureRateLimiting()
58 | {
59 | RateLimiter::for('api', function (Request $request) {
60 | return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
61 | });
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/config/broadcasting.php:
--------------------------------------------------------------------------------
1 | env('BROADCAST_DRIVER', 'null'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Broadcast Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may define all of the broadcast connections that will be used
26 | | to broadcast events to other systems or over websockets. Samples of
27 | | each available type of connection are provided inside this array.
28 | |
29 | */
30 |
31 | 'connections' => [
32 |
33 | 'pusher' => [
34 | 'driver' => 'pusher',
35 | 'key' => env('PUSHER_APP_KEY'),
36 | 'secret' => env('PUSHER_APP_SECRET'),
37 | 'app_id' => env('PUSHER_APP_ID'),
38 | 'options' => [
39 | 'cluster' => env('PUSHER_APP_CLUSTER'),
40 | 'useTLS' => true,
41 | ],
42 | ],
43 |
44 | 'ably' => [
45 | 'driver' => 'ably',
46 | 'key' => env('ABLY_KEY'),
47 | ],
48 |
49 | 'redis' => [
50 | 'driver' => 'redis',
51 | 'connection' => 'default',
52 | ],
53 |
54 | 'log' => [
55 | 'driver' => 'log',
56 | ],
57 |
58 | 'null' => [
59 | 'driver' => 'null',
60 | ],
61 |
62 | ],
63 |
64 | ];
65 |
--------------------------------------------------------------------------------
/resources/js/Shared/Icon.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
18 |
--------------------------------------------------------------------------------
/resources/js/Pages/Auth/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
24 |
25 |
54 |
--------------------------------------------------------------------------------
/resources/js/Shared/MainMenu.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
Dashboard
7 |
8 |
9 |
10 |
11 |
12 |
Organizations
13 |
14 |
15 |
16 |
17 |
18 |
Contacts
19 |
20 |
21 |
22 |
23 |
24 |
Reports
25 |
26 |
27 |
28 |
29 |
30 |
50 |
--------------------------------------------------------------------------------
/app/Http/Middleware/HandleInertiaRequests.php:
--------------------------------------------------------------------------------
1 | function () use ($request) {
41 | return [
42 | 'user' => $request->user() ? [
43 | 'id' => $request->user()->id,
44 | 'first_name' => $request->user()->first_name,
45 | 'last_name' => $request->user()->last_name,
46 | 'email' => $request->user()->email,
47 | 'owner' => $request->user()->owner,
48 | 'account' => [
49 | 'id' => $request->user()->account->id,
50 | 'name' => $request->user()->account->name,
51 | ],
52 | ] : null,
53 | ];
54 | },
55 | 'flash' => function () use ($request) {
56 | return [
57 | 'success' => $request->session()->get('success'),
58 | 'error' => $request->session()->get('error'),
59 | ];
60 | },
61 | ]);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "laravel/laravel",
3 | "type": "project",
4 | "description": "The Laravel Framework.",
5 | "keywords": ["framework", "laravel"],
6 | "license": "MIT",
7 | "require": {
8 | "php": "^7.4|^8.0",
9 | "ext-exif": "*",
10 | "ext-gd": "*",
11 | "fruitcake/laravel-cors": "^2.0",
12 | "guzzlehttp/guzzle": "^7.0.1",
13 | "inertiajs/inertia-laravel": "^0.5.3",
14 | "laravel/framework": "^8.65",
15 | "laravel/sanctum": "^2.11",
16 | "laravel/tinker": "^2.5",
17 | "league/glide-laravel": "^1.0"
18 | },
19 | "require-dev": {
20 | "roave/security-advisories": "dev-latest",
21 | "facade/ignition": "^2.5",
22 | "fakerphp/faker": "^1.9.1",
23 | "laravel/sail": "^1.0.1",
24 | "mockery/mockery": "^1.4.4",
25 | "nunomaduro/collision": "^5.10",
26 | "phpunit/phpunit": "^9.5.10"
27 | },
28 | "autoload": {
29 | "psr-4": {
30 | "App\\": "app/",
31 | "Database\\Factories\\": "database/factories/",
32 | "Database\\Seeders\\": "database/seeders/"
33 | }
34 | },
35 | "autoload-dev": {
36 | "psr-4": {
37 | "Tests\\": "tests/"
38 | }
39 | },
40 | "scripts": {
41 | "post-autoload-dump": [
42 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
43 | "@php artisan package:discover --ansi"
44 | ],
45 | "post-update-cmd": [
46 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
47 | ],
48 | "post-root-package-install": [
49 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
50 | ],
51 | "post-create-project-cmd": [
52 | "@php artisan key:generate --ansi"
53 | ],
54 | "compile": [
55 | "@php artisan migrate:fresh --seed"
56 | ]
57 | },
58 | "extra": {
59 | "laravel": {
60 | "dont-discover": []
61 | }
62 | },
63 | "config": {
64 | "optimize-autoloader": true,
65 | "preferred-install": "dist",
66 | "sort-packages": true
67 | },
68 | "minimum-stability": "dev",
69 | "prefer-stable": true
70 | }
71 |
--------------------------------------------------------------------------------
/config/sanctum.php:
--------------------------------------------------------------------------------
1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
17 | '%s%s',
18 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
19 | env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : ''
20 | ))),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Sanctum Guards
25 | |--------------------------------------------------------------------------
26 | |
27 | | This array contains the authentication guards that will be checked when
28 | | Sanctum is trying to authenticate a request. If none of these guards
29 | | are able to authenticate the request, Sanctum will use the bearer
30 | | token that's present on an incoming request for authentication.
31 | |
32 | */
33 |
34 | 'guard' => ['web'],
35 |
36 | /*
37 | |--------------------------------------------------------------------------
38 | | Expiration Minutes
39 | |--------------------------------------------------------------------------
40 | |
41 | | This value controls the number of minutes until an issued token will be
42 | | considered expired. If this value is null, personal access tokens do
43 | | not expire. This won't tweak the lifetime of first-party sessions.
44 | |
45 | */
46 |
47 | 'expiration' => null,
48 |
49 | /*
50 | |--------------------------------------------------------------------------
51 | | Sanctum Middleware
52 | |--------------------------------------------------------------------------
53 | |
54 | | When authenticating your first-party SPA with Sanctum you may need to
55 | | customize some of the middleware Sanctum uses while processing the
56 | | request. You may change the middleware listed below as required.
57 | |
58 | */
59 |
60 | 'middleware' => [
61 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
62 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
63 | ],
64 |
65 | ];
66 |
--------------------------------------------------------------------------------
/resources/js/Shared/Logo.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/config/filesystems.php:
--------------------------------------------------------------------------------
1 | env('FILESYSTEM_DRIVER', 'local'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Filesystem Disks
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure as many filesystem "disks" as you wish, and you
24 | | may even configure multiple disks of the same driver. Defaults have
25 | | been setup for each driver as an example of the required options.
26 | |
27 | | Supported Drivers: "local", "ftp", "sftp", "s3"
28 | |
29 | */
30 |
31 | 'disks' => [
32 |
33 | 'local' => [
34 | 'driver' => 'local',
35 | 'root' => storage_path('app'),
36 | ],
37 |
38 | 'public' => [
39 | 'driver' => 'local',
40 | 'root' => storage_path('app/public'),
41 | 'url' => env('APP_URL').'/storage',
42 | 'visibility' => 'public',
43 | ],
44 |
45 | 's3' => [
46 | 'driver' => 's3',
47 | 'key' => env('AWS_ACCESS_KEY_ID'),
48 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
49 | 'region' => env('AWS_DEFAULT_REGION'),
50 | 'bucket' => env('AWS_BUCKET'),
51 | 'url' => env('AWS_URL'),
52 | 'endpoint' => env('AWS_ENDPOINT'),
53 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
54 | ],
55 |
56 | ],
57 |
58 | /*
59 | |--------------------------------------------------------------------------
60 | | Symbolic Links
61 | |--------------------------------------------------------------------------
62 | |
63 | | Here you may configure the symbolic links that will be created when the
64 | | `storage:link` Artisan command is executed. The array keys should be
65 | | the locations of the links and the values should be their targets.
66 | |
67 | */
68 |
69 | 'links' => [
70 | public_path('storage') => storage_path('app/public'),
71 | ],
72 |
73 | ];
74 |
--------------------------------------------------------------------------------
/app/Http/Requests/Auth/LoginRequest.php:
--------------------------------------------------------------------------------
1 | 'required|string|email',
33 | 'password' => 'required|string',
34 | ];
35 | }
36 |
37 | /**
38 | * Attempt to authenticate the request's credentials.
39 | *
40 | * @return void
41 | *
42 | * @throws \Illuminate\Validation\ValidationException
43 | */
44 | public function authenticate()
45 | {
46 | $this->ensureIsNotRateLimited();
47 |
48 | if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) {
49 | RateLimiter::hit($this->throttleKey());
50 |
51 | throw ValidationException::withMessages([
52 | 'email' => __('auth.failed'),
53 | ]);
54 | }
55 |
56 | RateLimiter::clear($this->throttleKey());
57 | }
58 |
59 | /**
60 | * Ensure the login request is not rate limited.
61 | *
62 | * @return void
63 | *
64 | * @throws \Illuminate\Validation\ValidationException
65 | */
66 | public function ensureIsNotRateLimited()
67 | {
68 | if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) {
69 | return;
70 | }
71 |
72 | event(new Lockout($this));
73 |
74 | $seconds = RateLimiter::availableIn($this->throttleKey());
75 |
76 | throw ValidationException::withMessages([
77 | 'email' => trans('auth.throttle', [
78 | 'seconds' => $seconds,
79 | 'minutes' => ceil($seconds / 60),
80 | ]),
81 | ]);
82 | }
83 |
84 | /**
85 | * Get the rate limiting throttle key for the request.
86 | *
87 | * @return string
88 | */
89 | public function throttleKey()
90 | {
91 | return Str::lower($this->input('email')).'|'.$this->ip();
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/resources/js/Pages/Users/Create.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Users
6 | / Create
7 |
8 |
26 |
27 |
28 |
29 |
67 |
--------------------------------------------------------------------------------
/app/Http/Kernel.php:
--------------------------------------------------------------------------------
1 |
15 | */
16 | protected $middleware = [
17 | // \App\Http\Middleware\TrustHosts::class,
18 | \App\Http\Middleware\TrustProxies::class,
19 | \Fruitcake\Cors\HandleCors::class,
20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class,
21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
22 | \App\Http\Middleware\TrimStrings::class,
23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
24 | ];
25 |
26 | /**
27 | * The application's route middleware groups.
28 | *
29 | * @var array>
30 | */
31 | protected $middlewareGroups = [
32 | 'web' => [
33 | \App\Http\Middleware\EncryptCookies::class,
34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
35 | \Illuminate\Session\Middleware\StartSession::class,
36 | // \Illuminate\Session\Middleware\AuthenticateSession::class,
37 | \Illuminate\View\Middleware\ShareErrorsFromSession::class,
38 | \App\Http\Middleware\VerifyCsrfToken::class,
39 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
40 | \App\Http\Middleware\HandleInertiaRequests::class,
41 | ],
42 |
43 | 'api' => [
44 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
45 | 'throttle:api',
46 | \Illuminate\Routing\Middleware\SubstituteBindings::class,
47 | ],
48 | ];
49 |
50 | /**
51 | * The application's route middleware.
52 | *
53 | * These middleware may be assigned to groups or used individually.
54 | *
55 | * @var array
56 | */
57 | protected $routeMiddleware = [
58 | 'auth' => \App\Http\Middleware\Authenticate::class,
59 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
60 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
61 | 'can' => \Illuminate\Auth\Middleware\Authorize::class,
62 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
63 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
64 | 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
65 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
66 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
67 | ];
68 | }
69 |
--------------------------------------------------------------------------------
/resources/js/Pages/Organizations/Create.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Organizations
6 | / Create
7 |
8 |
29 |
30 |
31 |
32 |
70 |
--------------------------------------------------------------------------------
/resources/js/Shared/FlashMessages.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
{{ $page.props.flash.success }}
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
{{ $page.props.flash.error }}
16 |
17 | There is one form error.
18 | There are {{ Object.keys($page.props.errors).length }} form errors.
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
45 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | 'owner' => 'boolean',
44 | 'email_verified_at' => 'datetime',
45 | ];
46 |
47 | public function resolveRouteBinding($value, $field = null)
48 | {
49 | return $this->where($field ?? 'id', $value)->withTrashed()->firstOrFail();
50 | }
51 |
52 | public function account()
53 | {
54 | return $this->belongsTo(Account::class);
55 | }
56 |
57 | public function getNameAttribute()
58 | {
59 | return $this->first_name.' '.$this->last_name;
60 | }
61 |
62 | public function setPasswordAttribute($password)
63 | {
64 | $this->attributes['password'] = Hash::needsRehash($password) ? Hash::make($password) : $password;
65 | }
66 |
67 | public function isDemoUser()
68 | {
69 | return $this->email === 'johndoe@example.com';
70 | }
71 |
72 | public function scopeOrderByName($query)
73 | {
74 | $query->orderBy('last_name')->orderBy('first_name');
75 | }
76 |
77 | public function scopeWhereRole($query, $role)
78 | {
79 | switch ($role) {
80 | case 'user': return $query->where('owner', false);
81 | case 'owner': return $query->where('owner', true);
82 | }
83 | }
84 |
85 | public function scopeFilter($query, array $filters)
86 | {
87 | $query->when($filters['search'] ?? null, function ($query, $search) {
88 | $query->where(function ($query) use ($search) {
89 | $query->where('first_name', 'like', '%'.$search.'%')
90 | ->orWhere('last_name', 'like', '%'.$search.'%')
91 | ->orWhere('email', 'like', '%'.$search.'%');
92 | });
93 | })->when($filters['role'] ?? null, function ($query, $role) {
94 | $query->whereRole($role);
95 | })->when($filters['trashed'] ?? null, function ($query, $trashed) {
96 | if ($trashed === 'with') {
97 | $query->withTrashed();
98 | } elseif ($trashed === 'only') {
99 | $query->onlyTrashed();
100 | }
101 | });
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/resources/js/Pages/Contacts/Create.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Contacts
6 | / Create
7 |
8 |
34 |
35 |
36 |
37 |
80 |
--------------------------------------------------------------------------------
/resources/js/Shared/Layout.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
{{ auth.user.account.name }}
24 |
25 |
26 |
27 |
28 | {{ auth.user.first_name }}
29 | {{ auth.user.last_name }}
30 |
31 |
32 |
33 |
34 |
35 |
36 | My Profile
37 | Manage Users
38 | Logout
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
78 |
--------------------------------------------------------------------------------
/config/cache.php:
--------------------------------------------------------------------------------
1 | env('CACHE_DRIVER', 'file'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Cache Stores
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may define all of the cache "stores" for your application as
26 | | well as their drivers. You may even define multiple stores for the
27 | | same cache driver to group types of items stored in your caches.
28 | |
29 | | Supported drivers: "apc", "array", "database", "file",
30 | | "memcached", "redis", "dynamodb", "octane", "null"
31 | |
32 | */
33 |
34 | 'stores' => [
35 |
36 | 'apc' => [
37 | 'driver' => 'apc',
38 | ],
39 |
40 | 'array' => [
41 | 'driver' => 'array',
42 | 'serialize' => false,
43 | ],
44 |
45 | 'database' => [
46 | 'driver' => 'database',
47 | 'table' => 'cache',
48 | 'connection' => null,
49 | 'lock_connection' => null,
50 | ],
51 |
52 | 'file' => [
53 | 'driver' => 'file',
54 | 'path' => storage_path('framework/cache/data'),
55 | ],
56 |
57 | 'memcached' => [
58 | 'driver' => 'memcached',
59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
60 | 'sasl' => [
61 | env('MEMCACHED_USERNAME'),
62 | env('MEMCACHED_PASSWORD'),
63 | ],
64 | 'options' => [
65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000,
66 | ],
67 | 'servers' => [
68 | [
69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'),
70 | 'port' => env('MEMCACHED_PORT', 11211),
71 | 'weight' => 100,
72 | ],
73 | ],
74 | ],
75 |
76 | 'redis' => [
77 | 'driver' => 'redis',
78 | 'connection' => 'cache',
79 | 'lock_connection' => 'default',
80 | ],
81 |
82 | 'dynamodb' => [
83 | 'driver' => 'dynamodb',
84 | 'key' => env('AWS_ACCESS_KEY_ID'),
85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'),
86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
88 | 'endpoint' => env('DYNAMODB_ENDPOINT'),
89 | ],
90 |
91 | 'octane' => [
92 | 'driver' => 'octane',
93 | ],
94 |
95 | ],
96 |
97 | /*
98 | |--------------------------------------------------------------------------
99 | | Cache Key Prefix
100 | |--------------------------------------------------------------------------
101 | |
102 | | When utilizing a RAM based store such as APC or Memcached, there might
103 | | be other applications utilizing the same cache. So, we'll specify a
104 | | value to get prefixed to all our keys so we can avoid collisions.
105 | |
106 | */
107 |
108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'),
109 |
110 | ];
111 |
--------------------------------------------------------------------------------
/resources/js/Pages/Users/Edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Users
7 | /
8 | {{ form.first_name }} {{ form.last_name }}
9 |
10 |
11 |
12 | This user has been deleted.
13 |
32 |
33 |
34 |
35 |
91 |
--------------------------------------------------------------------------------
/app/Http/Controllers/OrganizationsController.php:
--------------------------------------------------------------------------------
1 | Request::all('search', 'trashed'),
17 | 'organizations' => Auth::user()->account->organizations()
18 | ->orderBy('name')
19 | ->filter(Request::only('search', 'trashed'))
20 | ->paginate(10)
21 | ->withQueryString()
22 | ->through(fn ($organization) => [
23 | 'id' => $organization->id,
24 | 'name' => $organization->name,
25 | 'phone' => $organization->phone,
26 | 'city' => $organization->city,
27 | 'deleted_at' => $organization->deleted_at,
28 | ]),
29 | ]);
30 | }
31 |
32 | public function create()
33 | {
34 | return Inertia::render('Organizations/Create');
35 | }
36 |
37 | public function store()
38 | {
39 | Auth::user()->account->organizations()->create(
40 | Request::validate([
41 | 'name' => ['required', 'max:100'],
42 | 'email' => ['nullable', 'max:50', 'email'],
43 | 'phone' => ['nullable', 'max:50'],
44 | 'address' => ['nullable', 'max:150'],
45 | 'city' => ['nullable', 'max:50'],
46 | 'region' => ['nullable', 'max:50'],
47 | 'country' => ['nullable', 'max:2'],
48 | 'postal_code' => ['nullable', 'max:25'],
49 | ])
50 | );
51 |
52 | return Redirect::route('organizations')->with('success', 'Organization created.');
53 | }
54 |
55 | public function edit(Organization $organization)
56 | {
57 | return Inertia::render('Organizations/Edit', [
58 | 'organization' => [
59 | 'id' => $organization->id,
60 | 'name' => $organization->name,
61 | 'email' => $organization->email,
62 | 'phone' => $organization->phone,
63 | 'address' => $organization->address,
64 | 'city' => $organization->city,
65 | 'region' => $organization->region,
66 | 'country' => $organization->country,
67 | 'postal_code' => $organization->postal_code,
68 | 'deleted_at' => $organization->deleted_at,
69 | 'contacts' => $organization->contacts()->orderByName()->get()->map->only('id', 'name', 'city', 'phone'),
70 | ],
71 | ]);
72 | }
73 |
74 | public function update(Organization $organization)
75 | {
76 | $organization->update(
77 | Request::validate([
78 | 'name' => ['required', 'max:100'],
79 | 'email' => ['nullable', 'max:50', 'email'],
80 | 'phone' => ['nullable', 'max:50'],
81 | 'address' => ['nullable', 'max:150'],
82 | 'city' => ['nullable', 'max:50'],
83 | 'region' => ['nullable', 'max:50'],
84 | 'country' => ['nullable', 'max:2'],
85 | 'postal_code' => ['nullable', 'max:25'],
86 | ])
87 | );
88 |
89 | return Redirect::back()->with('success', 'Organization updated.');
90 | }
91 |
92 | public function destroy(Organization $organization)
93 | {
94 | $organization->delete();
95 |
96 | return Redirect::back()->with('success', 'Organization deleted.');
97 | }
98 |
99 | public function restore(Organization $organization)
100 | {
101 | $organization->restore();
102 |
103 | return Redirect::back()->with('success', 'Organization restored.');
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/resources/js/Pages/Users/Index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Users
5 |
6 |
7 | Role:
8 |
9 |
10 | User
11 | Owner
12 |
13 | Trashed:
14 |
15 |
16 | With Trashed
17 | Only Trashed
18 |
19 |
20 |
21 | Create
22 | User
23 |
24 |
25 |
26 |
27 |
28 | Name
29 | Email
30 | Role
31 |
32 |
33 |
34 |
35 |
36 | {{ user.name }}
37 |
38 |
39 |
40 |
41 |
42 | {{ user.email }}
43 |
44 |
45 |
46 |
47 | {{ user.owner ? 'Owner' : 'User' }}
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | No users found.
58 |
59 |
60 |
61 |
62 |
63 |
64 |
109 |
--------------------------------------------------------------------------------
/config/logging.php:
--------------------------------------------------------------------------------
1 | env('LOG_CHANNEL', 'stack'),
21 |
22 | /*
23 | |--------------------------------------------------------------------------
24 | | Deprecations Log Channel
25 | |--------------------------------------------------------------------------
26 | |
27 | | This option controls the log channel that should be used to log warnings
28 | | regarding deprecated PHP and library features. This allows you to get
29 | | your application ready for upcoming major versions of dependencies.
30 | |
31 | */
32 |
33 | 'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
34 |
35 | /*
36 | |--------------------------------------------------------------------------
37 | | Log Channels
38 | |--------------------------------------------------------------------------
39 | |
40 | | Here you may configure the log channels for your application. Out of
41 | | the box, Laravel uses the Monolog PHP logging library. This gives
42 | | you a variety of powerful log handlers / formatters to utilize.
43 | |
44 | | Available Drivers: "single", "daily", "slack", "syslog",
45 | | "errorlog", "monolog",
46 | | "custom", "stack"
47 | |
48 | */
49 |
50 | 'channels' => [
51 | 'stack' => [
52 | 'driver' => 'stack',
53 | 'channels' => ['single'],
54 | 'ignore_exceptions' => false,
55 | ],
56 |
57 | 'single' => [
58 | 'driver' => 'single',
59 | 'path' => storage_path('logs/laravel.log'),
60 | 'level' => env('LOG_LEVEL', 'debug'),
61 | ],
62 |
63 | 'daily' => [
64 | 'driver' => 'daily',
65 | 'path' => storage_path('logs/laravel.log'),
66 | 'level' => env('LOG_LEVEL', 'debug'),
67 | 'days' => 14,
68 | ],
69 |
70 | 'slack' => [
71 | 'driver' => 'slack',
72 | 'url' => env('LOG_SLACK_WEBHOOK_URL'),
73 | 'username' => 'Laravel Log',
74 | 'emoji' => ':boom:',
75 | 'level' => env('LOG_LEVEL', 'critical'),
76 | ],
77 |
78 | 'papertrail' => [
79 | 'driver' => 'monolog',
80 | 'level' => env('LOG_LEVEL', 'debug'),
81 | 'handler' => SyslogUdpHandler::class,
82 | 'handler_with' => [
83 | 'host' => env('PAPERTRAIL_URL'),
84 | 'port' => env('PAPERTRAIL_PORT'),
85 | ],
86 | ],
87 |
88 | 'stderr' => [
89 | 'driver' => 'monolog',
90 | 'level' => env('LOG_LEVEL', 'debug'),
91 | 'handler' => StreamHandler::class,
92 | 'formatter' => env('LOG_STDERR_FORMATTER'),
93 | 'with' => [
94 | 'stream' => 'php://stderr',
95 | ],
96 | ],
97 |
98 | 'syslog' => [
99 | 'driver' => 'syslog',
100 | 'level' => env('LOG_LEVEL', 'debug'),
101 | ],
102 |
103 | 'errorlog' => [
104 | 'driver' => 'errorlog',
105 | 'level' => env('LOG_LEVEL', 'debug'),
106 | ],
107 |
108 | 'null' => [
109 | 'driver' => 'monolog',
110 | 'handler' => NullHandler::class,
111 | ],
112 |
113 | 'emergency' => [
114 | 'path' => storage_path('logs/laravel.log'),
115 | ],
116 | ],
117 |
118 | ];
119 |
--------------------------------------------------------------------------------
/config/mail.php:
--------------------------------------------------------------------------------
1 | env('MAIL_MAILER', 'smtp'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Mailer Configurations
21 | |--------------------------------------------------------------------------
22 | |
23 | | Here you may configure all of the mailers used by your application plus
24 | | their respective settings. Several examples have been configured for
25 | | you and you are free to add your own as your application requires.
26 | |
27 | | Laravel supports a variety of mail "transport" drivers to be used while
28 | | sending an e-mail. You will specify which one you are using for your
29 | | mailers below. You are free to add additional mailers as required.
30 | |
31 | | Supported: "smtp", "sendmail", "mailgun", "ses",
32 | | "postmark", "log", "array", "failover"
33 | |
34 | */
35 |
36 | 'mailers' => [
37 | 'smtp' => [
38 | 'transport' => 'smtp',
39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
40 | 'port' => env('MAIL_PORT', 587),
41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'),
42 | 'username' => env('MAIL_USERNAME'),
43 | 'password' => env('MAIL_PASSWORD'),
44 | 'timeout' => null,
45 | 'auth_mode' => null,
46 | ],
47 |
48 | 'ses' => [
49 | 'transport' => 'ses',
50 | ],
51 |
52 | 'mailgun' => [
53 | 'transport' => 'mailgun',
54 | ],
55 |
56 | 'postmark' => [
57 | 'transport' => 'postmark',
58 | ],
59 |
60 | 'sendmail' => [
61 | 'transport' => 'sendmail',
62 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -t -i'),
63 | ],
64 |
65 | 'log' => [
66 | 'transport' => 'log',
67 | 'channel' => env('MAIL_LOG_CHANNEL'),
68 | ],
69 |
70 | 'array' => [
71 | 'transport' => 'array',
72 | ],
73 |
74 | 'failover' => [
75 | 'transport' => 'failover',
76 | 'mailers' => [
77 | 'smtp',
78 | 'log',
79 | ],
80 | ],
81 | ],
82 |
83 | /*
84 | |--------------------------------------------------------------------------
85 | | Global "From" Address
86 | |--------------------------------------------------------------------------
87 | |
88 | | You may wish for all e-mails sent by your application to be sent from
89 | | the same address. Here, you may specify a name and address that is
90 | | used globally for all e-mails that are sent by your application.
91 | |
92 | */
93 |
94 | 'from' => [
95 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
96 | 'name' => env('MAIL_FROM_NAME', 'Example'),
97 | ],
98 |
99 | /*
100 | |--------------------------------------------------------------------------
101 | | Markdown Mail Settings
102 | |--------------------------------------------------------------------------
103 | |
104 | | If you are using Markdown based email rendering, you may configure your
105 | | theme and component paths here, allowing you to customize the design
106 | | of the emails. Or, you may simply stick with the Laravel defaults!
107 | |
108 | */
109 |
110 | 'markdown' => [
111 | 'theme' => 'default',
112 |
113 | 'paths' => [
114 | resource_path('views/vendor/mail'),
115 | ],
116 | ],
117 |
118 | ];
119 |
--------------------------------------------------------------------------------
/resources/js/Pages/Organizations/Index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Organizations
5 |
6 |
7 | Trashed:
8 |
9 |
10 | With Trashed
11 | Only Trashed
12 |
13 |
14 |
15 | Create
16 | Organization
17 |
18 |
19 |
20 |
21 |
22 |
23 | Name
24 | City
25 | Phone
26 |
27 |
28 |
29 |
30 |
31 |
32 | {{ organization.name }}
33 |
34 |
35 |
36 |
37 |
38 | {{ organization.city }}
39 |
40 |
41 |
42 |
43 | {{ organization.phone }}
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | No organizations found.
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
108 |
--------------------------------------------------------------------------------
/config/auth.php:
--------------------------------------------------------------------------------
1 | [
17 | 'guard' => 'web',
18 | 'passwords' => 'users',
19 | ],
20 |
21 | /*
22 | |--------------------------------------------------------------------------
23 | | Authentication Guards
24 | |--------------------------------------------------------------------------
25 | |
26 | | Next, you may define every authentication guard for your application.
27 | | Of course, a great default configuration has been defined for you
28 | | here which uses session storage and the Eloquent user provider.
29 | |
30 | | All authentication drivers have a user provider. This defines how the
31 | | users are actually retrieved out of your database or other storage
32 | | mechanisms used by this application to persist your user's data.
33 | |
34 | | Supported: "session"
35 | |
36 | */
37 |
38 | 'guards' => [
39 | 'web' => [
40 | 'driver' => 'session',
41 | 'provider' => 'users',
42 | ],
43 | ],
44 |
45 | /*
46 | |--------------------------------------------------------------------------
47 | | User Providers
48 | |--------------------------------------------------------------------------
49 | |
50 | | All authentication drivers have a user provider. This defines how the
51 | | users are actually retrieved out of your database or other storage
52 | | mechanisms used by this application to persist your user's data.
53 | |
54 | | If you have multiple user tables or models you may configure multiple
55 | | sources which represent each model / table. These sources may then
56 | | be assigned to any extra authentication guards you have defined.
57 | |
58 | | Supported: "database", "eloquent"
59 | |
60 | */
61 |
62 | 'providers' => [
63 | 'users' => [
64 | 'driver' => 'eloquent',
65 | 'model' => App\Models\User::class,
66 | ],
67 |
68 | // 'users' => [
69 | // 'driver' => 'database',
70 | // 'table' => 'users',
71 | // ],
72 | ],
73 |
74 | /*
75 | |--------------------------------------------------------------------------
76 | | Resetting Passwords
77 | |--------------------------------------------------------------------------
78 | |
79 | | You may specify multiple password reset configurations if you have more
80 | | than one user table or model in the application and you want to have
81 | | separate password reset settings based on the specific user types.
82 | |
83 | | The expire time is the number of minutes that the reset token should be
84 | | considered valid. This security feature keeps tokens short-lived so
85 | | they have less time to be guessed. You may change this as needed.
86 | |
87 | */
88 |
89 | 'passwords' => [
90 | 'users' => [
91 | 'provider' => 'users',
92 | 'table' => 'password_resets',
93 | 'expire' => 60,
94 | 'throttle' => 60,
95 | ],
96 | ],
97 |
98 | /*
99 | |--------------------------------------------------------------------------
100 | | Password Confirmation Timeout
101 | |--------------------------------------------------------------------------
102 | |
103 | | Here you may define the amount of seconds before a password confirmation
104 | | times out and the user is prompted to re-enter their password via the
105 | | confirmation screen. By default, the timeout lasts for three hours.
106 | |
107 | */
108 |
109 | 'password_timeout' => 10800,
110 |
111 | ];
112 |
--------------------------------------------------------------------------------
/resources/js/Pages/Contacts/Index.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Contacts
5 |
6 |
7 | Trashed:
8 |
9 |
10 | With Trashed
11 | Only Trashed
12 |
13 |
14 |
15 | Create
16 | Contact
17 |
18 |
19 |
20 |
21 |
22 | Name
23 | Organization
24 | City
25 | Phone
26 |
27 |
28 |
29 |
30 | {{ contact.name }}
31 |
32 |
33 |
34 |
35 |
36 |
37 | {{ contact.organization.name }}
38 |
39 |
40 |
41 |
42 |
43 | {{ contact.city }}
44 |
45 |
46 |
47 |
48 | {{ contact.phone }}
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | No contacts found.
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
112 |
--------------------------------------------------------------------------------
/resources/js/Pages/Contacts/Edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Contacts
6 | /
7 | {{ form.first_name }} {{ form.last_name }}
8 |
9 | This contact has been deleted.
10 |
37 |
38 |
39 |
40 |
96 |
--------------------------------------------------------------------------------
/tests/Feature/OrganizationsTest.php:
--------------------------------------------------------------------------------
1 | user = User::factory()->create([
20 | 'account_id' => Account::create(['name' => 'Acme Corporation'])->id,
21 | 'first_name' => 'John',
22 | 'last_name' => 'Doe',
23 | 'email' => 'johndoe@example.com',
24 | 'owner' => true,
25 | ]);
26 |
27 | $this->user->account->organizations()->createMany([
28 | [
29 | 'name' => 'Apple',
30 | 'email' => 'info@apple.com',
31 | 'phone' => '647-943-4400',
32 | 'address' => '1600-120 Bremner Blvd',
33 | 'city' => 'Toronto',
34 | 'region' => 'ON',
35 | 'country' => 'CA',
36 | 'postal_code' => 'M5J 0A8',
37 | ], [
38 | 'name' => 'Microsoft',
39 | 'email' => 'info@microsoft.com',
40 | 'phone' => '877-568-2495',
41 | 'address' => 'One Microsoft Way',
42 | 'city' => 'Redmond',
43 | 'region' => 'WA',
44 | 'country' => 'US',
45 | 'postal_code' => '98052',
46 | ],
47 | ]);
48 | }
49 |
50 | public function test_can_view_organizations()
51 | {
52 | $this->actingAs($this->user)
53 | ->get('/organizations')
54 | ->assertInertia(fn (Assert $assert) => $assert
55 | ->component('Organizations/Index')
56 | ->has('organizations.data', 2)
57 | ->has('organizations.data.0', fn (Assert $assert) => $assert
58 | ->where('id', 1)
59 | ->where('name', 'Apple')
60 | ->where('phone', '647-943-4400')
61 | ->where('city', 'Toronto')
62 | ->where('deleted_at', null)
63 | )
64 | ->has('organizations.data.1', fn (Assert $assert) => $assert
65 | ->where('id', 2)
66 | ->where('name', 'Microsoft')
67 | ->where('phone', '877-568-2495')
68 | ->where('city', 'Redmond')
69 | ->where('deleted_at', null)
70 | )
71 | );
72 | }
73 |
74 | public function test_can_search_for_organizations()
75 | {
76 | $this->actingAs($this->user)
77 | ->get('/organizations?search=Apple')
78 | ->assertInertia(fn (Assert $assert) => $assert
79 | ->component('Organizations/Index')
80 | ->where('filters.search', 'Apple')
81 | ->has('organizations.data', 1)
82 | ->has('organizations.data.0', fn (Assert $assert) => $assert
83 | ->where('id', 1)
84 | ->where('name', 'Apple')
85 | ->where('phone', '647-943-4400')
86 | ->where('city', 'Toronto')
87 | ->where('deleted_at', null)
88 | )
89 | );
90 | }
91 |
92 | public function test_cannot_view_deleted_organizations()
93 | {
94 | $this->user->account->organizations()->firstWhere('name', 'Microsoft')->delete();
95 |
96 | $this->actingAs($this->user)
97 | ->get('/organizations')
98 | ->assertInertia(fn (Assert $assert) => $assert
99 | ->component('Organizations/Index')
100 | ->has('organizations.data', 1)
101 | ->where('organizations.data.0.name', 'Apple')
102 | );
103 | }
104 |
105 | public function test_can_filter_to_view_deleted_organizations()
106 | {
107 | $this->user->account->organizations()->firstWhere('name', 'Microsoft')->delete();
108 |
109 | $this->actingAs($this->user)
110 | ->get('/organizations?trashed=with')
111 | ->assertInertia(fn (Assert $assert) => $assert
112 | ->component('Organizations/Index')
113 | ->has('organizations.data', 2)
114 | ->where('organizations.data.0.name', 'Apple')
115 | ->where('organizations.data.1.name', 'Microsoft')
116 | );
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/app/Http/Controllers/UsersController.php:
--------------------------------------------------------------------------------
1 | Request::all('search', 'role', 'trashed'),
20 | 'users' => Auth::user()->account->users()
21 | ->orderByName()
22 | ->filter(Request::only('search', 'role', 'trashed'))
23 | ->get()
24 | ->transform(fn ($user) => [
25 | 'id' => $user->id,
26 | 'name' => $user->name,
27 | 'email' => $user->email,
28 | 'owner' => $user->owner,
29 | 'photo' => $user->photo_path ? URL::route('image', ['path' => $user->photo_path, 'w' => 40, 'h' => 40, 'fit' => 'crop']) : null,
30 | 'deleted_at' => $user->deleted_at,
31 | ]),
32 | ]);
33 | }
34 |
35 | public function create()
36 | {
37 | return Inertia::render('Users/Create');
38 | }
39 |
40 | public function store()
41 | {
42 | Request::validate([
43 | 'first_name' => ['required', 'max:50'],
44 | 'last_name' => ['required', 'max:50'],
45 | 'email' => ['required', 'max:50', 'email', Rule::unique('users')],
46 | 'password' => ['nullable'],
47 | 'owner' => ['required', 'boolean'],
48 | 'photo' => ['nullable', 'image'],
49 | ]);
50 |
51 | Auth::user()->account->users()->create([
52 | 'first_name' => Request::get('first_name'),
53 | 'last_name' => Request::get('last_name'),
54 | 'email' => Request::get('email'),
55 | 'password' => Request::get('password'),
56 | 'owner' => Request::get('owner'),
57 | 'photo_path' => Request::file('photo') ? Request::file('photo')->store('users') : null,
58 | ]);
59 |
60 | return Redirect::route('users')->with('success', 'User created.');
61 | }
62 |
63 | public function edit(User $user)
64 | {
65 | return Inertia::render('Users/Edit', [
66 | 'user' => [
67 | 'id' => $user->id,
68 | 'first_name' => $user->first_name,
69 | 'last_name' => $user->last_name,
70 | 'email' => $user->email,
71 | 'owner' => $user->owner,
72 | 'photo' => $user->photo_path ? URL::route('image', ['path' => $user->photo_path, 'w' => 60, 'h' => 60, 'fit' => 'crop']) : null,
73 | 'deleted_at' => $user->deleted_at,
74 | ],
75 | ]);
76 | }
77 |
78 | public function update(User $user)
79 | {
80 | if (App::environment('demo') && $user->isDemoUser()) {
81 | return Redirect::back()->with('error', 'Updating the demo user is not allowed.');
82 | }
83 |
84 | Request::validate([
85 | 'first_name' => ['required', 'max:50'],
86 | 'last_name' => ['required', 'max:50'],
87 | 'email' => ['required', 'max:50', 'email', Rule::unique('users')->ignore($user->id)],
88 | 'password' => ['nullable'],
89 | 'owner' => ['required', 'boolean'],
90 | 'photo' => ['nullable', 'image'],
91 | ]);
92 |
93 | $user->update(Request::only('first_name', 'last_name', 'email', 'owner'));
94 |
95 | if (Request::file('photo')) {
96 | $user->update(['photo_path' => Request::file('photo')->store('users')]);
97 | }
98 |
99 | if (Request::get('password')) {
100 | $user->update(['password' => Request::get('password')]);
101 | }
102 |
103 | return Redirect::back()->with('success', 'User updated.');
104 | }
105 |
106 | public function destroy(User $user)
107 | {
108 | if (App::environment('demo') && $user->isDemoUser()) {
109 | return Redirect::back()->with('error', 'Deleting the demo user is not allowed.');
110 | }
111 |
112 | $user->delete();
113 |
114 | return Redirect::back()->with('success', 'User deleted.');
115 | }
116 |
117 | public function restore(User $user)
118 | {
119 | $user->restore();
120 |
121 | return Redirect::back()->with('success', 'User restored.');
122 | }
123 | }
124 |
--------------------------------------------------------------------------------
/routes/web.php:
--------------------------------------------------------------------------------
1 | name('login')
27 | ->middleware('guest');
28 |
29 | Route::post('login', [AuthenticatedSessionController::class, 'store'])
30 | ->name('login.store')
31 | ->middleware('guest');
32 |
33 | Route::delete('logout', [AuthenticatedSessionController::class, 'destroy'])
34 | ->name('logout');
35 |
36 | // Dashboard
37 |
38 | Route::get('/', [DashboardController::class, 'index'])
39 | ->name('dashboard')
40 | ->middleware('auth');
41 |
42 | // Users
43 |
44 | Route::get('users', [UsersController::class, 'index'])
45 | ->name('users')
46 | ->middleware('auth');
47 |
48 | Route::get('users/create', [UsersController::class, 'create'])
49 | ->name('users.create')
50 | ->middleware('auth');
51 |
52 | Route::post('users', [UsersController::class, 'store'])
53 | ->name('users.store')
54 | ->middleware('auth');
55 |
56 | Route::get('users/{user}/edit', [UsersController::class, 'edit'])
57 | ->name('users.edit')
58 | ->middleware('auth');
59 |
60 | Route::put('users/{user}', [UsersController::class, 'update'])
61 | ->name('users.update')
62 | ->middleware('auth');
63 |
64 | Route::delete('users/{user}', [UsersController::class, 'destroy'])
65 | ->name('users.destroy')
66 | ->middleware('auth');
67 |
68 | Route::put('users/{user}/restore', [UsersController::class, 'restore'])
69 | ->name('users.restore')
70 | ->middleware('auth');
71 |
72 | // Organizations
73 |
74 | Route::get('organizations', [OrganizationsController::class, 'index'])
75 | ->name('organizations')
76 | ->middleware('auth');
77 |
78 | Route::get('organizations/create', [OrganizationsController::class, 'create'])
79 | ->name('organizations.create')
80 | ->middleware('auth');
81 |
82 | Route::post('organizations', [OrganizationsController::class, 'store'])
83 | ->name('organizations.store')
84 | ->middleware('auth');
85 |
86 | Route::get('organizations/{organization}/edit', [OrganizationsController::class, 'edit'])
87 | ->name('organizations.edit')
88 | ->middleware('auth');
89 |
90 | Route::put('organizations/{organization}', [OrganizationsController::class, 'update'])
91 | ->name('organizations.update')
92 | ->middleware('auth');
93 |
94 | Route::delete('organizations/{organization}', [OrganizationsController::class, 'destroy'])
95 | ->name('organizations.destroy')
96 | ->middleware('auth');
97 |
98 | Route::put('organizations/{organization}/restore', [OrganizationsController::class, 'restore'])
99 | ->name('organizations.restore')
100 | ->middleware('auth');
101 |
102 | // Contacts
103 |
104 | Route::get('contacts', [ContactsController::class, 'index'])
105 | ->name('contacts')
106 | ->middleware('auth');
107 |
108 | Route::get('contacts/create', [ContactsController::class, 'create'])
109 | ->name('contacts.create')
110 | ->middleware('auth');
111 |
112 | Route::post('contacts', [ContactsController::class, 'store'])
113 | ->name('contacts.store')
114 | ->middleware('auth');
115 |
116 | Route::get('contacts/{contact}/edit', [ContactsController::class, 'edit'])
117 | ->name('contacts.edit')
118 | ->middleware('auth');
119 |
120 | Route::put('contacts/{contact}', [ContactsController::class, 'update'])
121 | ->name('contacts.update')
122 | ->middleware('auth');
123 |
124 | Route::delete('contacts/{contact}', [ContactsController::class, 'destroy'])
125 | ->name('contacts.destroy')
126 | ->middleware('auth');
127 |
128 | Route::put('contacts/{contact}/restore', [ContactsController::class, 'restore'])
129 | ->name('contacts.restore')
130 | ->middleware('auth');
131 |
132 | // Reports
133 |
134 | Route::get('reports', [ReportsController::class, 'index'])
135 | ->name('reports')
136 | ->middleware('auth');
137 |
138 | // Images
139 |
140 | Route::get('/img/{path}', [ImagesController::class, 'show'])
141 | ->where('path', '.*')
142 | ->name('image');
143 |
--------------------------------------------------------------------------------
/app/Http/Controllers/ContactsController.php:
--------------------------------------------------------------------------------
1 | Request::all('search', 'trashed'),
18 | 'contacts' => Auth::user()->account->contacts()
19 | ->with('organization')
20 | ->orderByName()
21 | ->filter(Request::only('search', 'trashed'))
22 | ->paginate(10)
23 | ->withQueryString()
24 | ->through(fn ($contact) => [
25 | 'id' => $contact->id,
26 | 'name' => $contact->name,
27 | 'phone' => $contact->phone,
28 | 'city' => $contact->city,
29 | 'deleted_at' => $contact->deleted_at,
30 | 'organization' => $contact->organization ? $contact->organization->only('name') : null,
31 | ]),
32 | ]);
33 | }
34 |
35 | public function create()
36 | {
37 | return Inertia::render('Contacts/Create', [
38 | 'organizations' => Auth::user()->account
39 | ->organizations()
40 | ->orderBy('name')
41 | ->get()
42 | ->map
43 | ->only('id', 'name'),
44 | ]);
45 | }
46 |
47 | public function store()
48 | {
49 | Auth::user()->account->contacts()->create(
50 | Request::validate([
51 | 'first_name' => ['required', 'max:50'],
52 | 'last_name' => ['required', 'max:50'],
53 | 'organization_id' => ['nullable', Rule::exists('organizations', 'id')->where(function ($query) {
54 | $query->where('account_id', Auth::user()->account_id);
55 | })],
56 | 'email' => ['nullable', 'max:50', 'email'],
57 | 'phone' => ['nullable', 'max:50'],
58 | 'address' => ['nullable', 'max:150'],
59 | 'city' => ['nullable', 'max:50'],
60 | 'region' => ['nullable', 'max:50'],
61 | 'country' => ['nullable', 'max:2'],
62 | 'postal_code' => ['nullable', 'max:25'],
63 | ])
64 | );
65 |
66 | return Redirect::route('contacts')->with('success', 'Contact created.');
67 | }
68 |
69 | public function edit(Contact $contact)
70 | {
71 | return Inertia::render('Contacts/Edit', [
72 | 'contact' => [
73 | 'id' => $contact->id,
74 | 'first_name' => $contact->first_name,
75 | 'last_name' => $contact->last_name,
76 | 'organization_id' => $contact->organization_id,
77 | 'email' => $contact->email,
78 | 'phone' => $contact->phone,
79 | 'address' => $contact->address,
80 | 'city' => $contact->city,
81 | 'region' => $contact->region,
82 | 'country' => $contact->country,
83 | 'postal_code' => $contact->postal_code,
84 | 'deleted_at' => $contact->deleted_at,
85 | ],
86 | 'organizations' => Auth::user()->account->organizations()
87 | ->orderBy('name')
88 | ->get()
89 | ->map
90 | ->only('id', 'name'),
91 | ]);
92 | }
93 |
94 | public function update(Contact $contact)
95 | {
96 | $contact->update(
97 | Request::validate([
98 | 'first_name' => ['required', 'max:50'],
99 | 'last_name' => ['required', 'max:50'],
100 | 'organization_id' => [
101 | 'nullable',
102 | Rule::exists('organizations', 'id')->where(fn ($query) => $query->where('account_id', Auth::user()->account_id)),
103 | ],
104 | 'email' => ['nullable', 'max:50', 'email'],
105 | 'phone' => ['nullable', 'max:50'],
106 | 'address' => ['nullable', 'max:150'],
107 | 'city' => ['nullable', 'max:50'],
108 | 'region' => ['nullable', 'max:50'],
109 | 'country' => ['nullable', 'max:2'],
110 | 'postal_code' => ['nullable', 'max:25'],
111 | ])
112 | );
113 |
114 | return Redirect::back()->with('success', 'Contact updated.');
115 | }
116 |
117 | public function destroy(Contact $contact)
118 | {
119 | $contact->delete();
120 |
121 | return Redirect::back()->with('success', 'Contact deleted.');
122 | }
123 |
124 | public function restore(Contact $contact)
125 | {
126 | $contact->restore();
127 |
128 | return Redirect::back()->with('success', 'Contact restored.');
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/tests/Feature/ContactsTest.php:
--------------------------------------------------------------------------------
1 | user = User::factory()->create([
20 | 'account_id' => Account::create(['name' => 'Acme Corporation'])->id,
21 | 'first_name' => 'John',
22 | 'last_name' => 'Doe',
23 | 'email' => 'johndoe@example.com',
24 | 'owner' => true,
25 | ]);
26 |
27 | $organization = $this->user->account->organizations()->create(['name' => 'Example Organization Inc.']);
28 |
29 | $this->user->account->contacts()->createMany([
30 | [
31 | 'organization_id' => $organization->id,
32 | 'first_name' => 'Martin',
33 | 'last_name' => 'Abbott',
34 | 'email' => 'martin.abbott@example.com',
35 | 'phone' => '555-111-2222',
36 | 'address' => '330 Glenda Shore',
37 | 'city' => 'Murphyland',
38 | 'region' => 'Tennessee',
39 | 'country' => 'US',
40 | 'postal_code' => '57851',
41 | ], [
42 | 'organization_id' => $organization->id,
43 | 'first_name' => 'Lynn',
44 | 'last_name' => 'Kub',
45 | 'email' => 'lynn.kub@example.com',
46 | 'phone' => '555-333-4444',
47 | 'address' => '199 Connelly Turnpike',
48 | 'city' => 'Woodstock',
49 | 'region' => 'Colorado',
50 | 'country' => 'US',
51 | 'postal_code' => '11623',
52 | ],
53 | ]);
54 | }
55 |
56 | public function test_can_view_contacts()
57 | {
58 | $this->actingAs($this->user)
59 | ->get('/contacts')
60 | ->assertInertia(fn (Assert $assert) => $assert
61 | ->component('Contacts/Index')
62 | ->has('contacts.data', 2)
63 | ->has('contacts.data.0', fn (Assert $assert) => $assert
64 | ->where('id', 1)
65 | ->where('name', 'Martin Abbott')
66 | ->where('phone', '555-111-2222')
67 | ->where('city', 'Murphyland')
68 | ->where('deleted_at', null)
69 | ->has('organization', fn (Assert $assert) => $assert
70 | ->where('name', 'Example Organization Inc.')
71 | )
72 | )
73 | ->has('contacts.data.1', fn (Assert $assert) => $assert
74 | ->where('id', 2)
75 | ->where('name', 'Lynn Kub')
76 | ->where('phone', '555-333-4444')
77 | ->where('city', 'Woodstock')
78 | ->where('deleted_at', null)
79 | ->has('organization', fn (Assert $assert) => $assert
80 | ->where('name', 'Example Organization Inc.')
81 | )
82 | )
83 | );
84 | }
85 |
86 | public function test_can_search_for_contacts()
87 | {
88 | $this->actingAs($this->user)
89 | ->get('/contacts?search=Martin')
90 | ->assertInertia(fn (Assert $assert) => $assert
91 | ->component('Contacts/Index')
92 | ->where('filters.search', 'Martin')
93 | ->has('contacts.data', 1)
94 | ->has('contacts.data.0', fn (Assert $assert) => $assert
95 | ->where('id', 1)
96 | ->where('name', 'Martin Abbott')
97 | ->where('phone', '555-111-2222')
98 | ->where('city', 'Murphyland')
99 | ->where('deleted_at', null)
100 | ->has('organization', fn (Assert $assert) => $assert
101 | ->where('name', 'Example Organization Inc.')
102 | )
103 | )
104 | );
105 | }
106 |
107 | public function test_cannot_view_deleted_contacts()
108 | {
109 | $this->user->account->contacts()->firstWhere('first_name', 'Martin')->delete();
110 |
111 | $this->actingAs($this->user)
112 | ->get('/contacts')
113 | ->assertInertia(fn (Assert $assert) => $assert
114 | ->component('Contacts/Index')
115 | ->has('contacts.data', 1)
116 | ->where('contacts.data.0.name', 'Lynn Kub')
117 | );
118 | }
119 |
120 | public function test_can_filter_to_view_deleted_contacts()
121 | {
122 | $this->user->account->contacts()->firstWhere('first_name', 'Martin')->delete();
123 |
124 | $this->actingAs($this->user)
125 | ->get('/contacts?trashed=with')
126 | ->assertInertia(fn (Assert $assert) => $assert
127 | ->component('Contacts/Index')
128 | ->has('contacts.data', 2)
129 | ->where('contacts.data.0.name', 'Martin Abbott')
130 | ->where('contacts.data.1.name', 'Lynn Kub')
131 | );
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/config/database.php:
--------------------------------------------------------------------------------
1 | env('DB_CONNECTION', 'mysql'),
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Database Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here are each of the database connections setup for your application.
26 | | Of course, examples of configuring each database platform that is
27 | | supported by Laravel is shown below to make development simple.
28 | |
29 | |
30 | | All database work in Laravel is done through the PHP PDO facilities
31 | | so make sure you have the driver for your particular database of
32 | | choice installed on your machine before you begin development.
33 | |
34 | */
35 |
36 | 'connections' => [
37 |
38 | 'sqlite' => [
39 | 'driver' => 'sqlite',
40 | 'url' => env('DATABASE_URL'),
41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')),
42 | 'prefix' => '',
43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
44 | ],
45 |
46 | 'mysql' => [
47 | 'driver' => 'mysql',
48 | 'url' => env('DATABASE_URL'),
49 | 'host' => env('DB_HOST', '127.0.0.1'),
50 | 'port' => env('DB_PORT', '3306'),
51 | 'database' => env('DB_DATABASE', 'forge'),
52 | 'username' => env('DB_USERNAME', 'forge'),
53 | 'password' => env('DB_PASSWORD', ''),
54 | 'unix_socket' => env('DB_SOCKET', ''),
55 | 'charset' => 'utf8mb4',
56 | 'collation' => 'utf8mb4_unicode_ci',
57 | 'prefix' => '',
58 | 'prefix_indexes' => true,
59 | 'strict' => true,
60 | 'engine' => null,
61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([
62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
63 | ]) : [],
64 | ],
65 |
66 | 'pgsql' => [
67 | 'driver' => 'pgsql',
68 | 'url' => env('DATABASE_URL'),
69 | 'host' => env('DB_HOST', '127.0.0.1'),
70 | 'port' => env('DB_PORT', '5432'),
71 | 'database' => env('DB_DATABASE', 'forge'),
72 | 'username' => env('DB_USERNAME', 'forge'),
73 | 'password' => env('DB_PASSWORD', ''),
74 | 'charset' => 'utf8',
75 | 'prefix' => '',
76 | 'prefix_indexes' => true,
77 | 'schema' => 'public',
78 | 'sslmode' => 'prefer',
79 | ],
80 |
81 | 'sqlsrv' => [
82 | 'driver' => 'sqlsrv',
83 | 'url' => env('DATABASE_URL'),
84 | 'host' => env('DB_HOST', 'localhost'),
85 | 'port' => env('DB_PORT', '1433'),
86 | 'database' => env('DB_DATABASE', 'forge'),
87 | 'username' => env('DB_USERNAME', 'forge'),
88 | 'password' => env('DB_PASSWORD', ''),
89 | 'charset' => 'utf8',
90 | 'prefix' => '',
91 | 'prefix_indexes' => true,
92 | ],
93 |
94 | ],
95 |
96 | /*
97 | |--------------------------------------------------------------------------
98 | | Migration Repository Table
99 | |--------------------------------------------------------------------------
100 | |
101 | | This table keeps track of all the migrations that have already run for
102 | | your application. Using this information, we can determine which of
103 | | the migrations on disk haven't actually been run in the database.
104 | |
105 | */
106 |
107 | 'migrations' => 'migrations',
108 |
109 | /*
110 | |--------------------------------------------------------------------------
111 | | Redis Databases
112 | |--------------------------------------------------------------------------
113 | |
114 | | Redis is an open source, fast, and advanced key-value store that also
115 | | provides a richer body of commands than a typical key-value system
116 | | such as APC or Memcached. Laravel makes it easy to dig right in.
117 | |
118 | */
119 |
120 | 'redis' => [
121 |
122 | 'client' => env('REDIS_CLIENT', 'phpredis'),
123 |
124 | 'options' => [
125 | 'cluster' => env('REDIS_CLUSTER', 'redis'),
126 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
127 | ],
128 |
129 | 'default' => [
130 | 'url' => env('REDIS_URL'),
131 | 'host' => env('REDIS_HOST', '127.0.0.1'),
132 | 'password' => env('REDIS_PASSWORD', null),
133 | 'port' => env('REDIS_PORT', '6379'),
134 | 'database' => env('REDIS_DB', '0'),
135 | ],
136 |
137 | 'cache' => [
138 | 'url' => env('REDIS_URL'),
139 | 'host' => env('REDIS_HOST', '127.0.0.1'),
140 | 'password' => env('REDIS_PASSWORD', null),
141 | 'port' => env('REDIS_PORT', '6379'),
142 | 'database' => env('REDIS_CACHE_DB', '1'),
143 | ],
144 |
145 | ],
146 |
147 | ];
148 |
--------------------------------------------------------------------------------
/resources/js/Pages/Organizations/Edit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Organizations
6 | /
7 | {{ form.name }}
8 |
9 | This organization has been deleted.
10 |
32 | Contacts
33 |
34 |
35 |
36 | Name
37 | City
38 | Phone
39 |
40 |
41 |
42 |
43 | {{ contact.name }}
44 |
45 |
46 |
47 |
48 |
49 | {{ contact.city }}
50 |
51 |
52 |
53 |
54 | {{ contact.phone }}
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 | No contacts found.
65 |
66 |
67 |
68 |
69 |
70 |
71 |
126 |
--------------------------------------------------------------------------------
/.php-cs-fixer.dist.php:
--------------------------------------------------------------------------------
1 | notPath('bootstrap')
5 | ->notPath('node_modules')
6 | ->notPath('storage')
7 | ->notPath('vendor')
8 | ->in(__DIR__)
9 | ->name('*.php')
10 | ->notName('*.blade.php');
11 |
12 | return (new PhpCsFixer\Config())
13 | ->setRiskyAllowed(true)
14 | ->setRules([
15 | '@PSR2' => true,
16 | 'align_multiline_comment' => [
17 | 'comment_type' => 'phpdocs_like',
18 | ],
19 | 'array_indentation' => true,
20 | 'array_syntax' => [
21 | 'syntax' => 'short',
22 | ],
23 | 'binary_operator_spaces' => [
24 | 'operators' => [
25 | '=>' => null,
26 | '=' => 'single_space',
27 | ],
28 | ],
29 | 'blank_line_after_namespace' => true,
30 | 'blank_line_after_opening_tag' => true,
31 | 'blank_line_before_statement' => [
32 | 'statements' => [
33 | 'return',
34 | ],
35 | ],
36 | 'braces' => false,
37 | 'cast_spaces' => true,
38 | 'class_attributes_separation' => [
39 | 'elements' => [
40 | 'method' => 'one',
41 | ],
42 | ],
43 | 'class_definition' => false,
44 | 'clean_namespace' => true,
45 | 'compact_nullable_typehint' => true,
46 | 'concat_space' => [
47 | 'spacing' => 'none',
48 | ],
49 | 'constant_case' => [
50 | 'case' => 'lower',
51 | ],
52 | 'declare_equal_normalize' => true,
53 | 'elseif' => true,
54 | 'encoding' => true,
55 | 'full_opening_tag' => true,
56 | 'function_declaration' => true,
57 | 'function_typehint_space' => true,
58 | 'heredoc_to_nowdoc' => true,
59 | 'include' => true,
60 | 'increment_style' => [
61 | 'style' => 'post',
62 | ],
63 | 'indentation_type' => true,
64 | 'integer_literal_case' => true,
65 | 'lambda_not_used_import' => true,
66 | 'line_ending' => true,
67 | 'list_syntax' => [
68 | 'syntax' => 'short',
69 | ],
70 | 'lowercase_cast' => true,
71 | 'lowercase_keywords' => true,
72 | 'lowercase_static_reference' => true,
73 | 'magic_constant_casing' => true,
74 | 'magic_method_casing' => true,
75 | 'method_argument_space' => [
76 | 'on_multiline' => 'ignore',
77 | ],
78 | 'multiline_whitespace_before_semicolons' => true,
79 | 'native_function_casing' => true,
80 | 'native_function_type_declaration_casing' => true,
81 | 'no_alias_language_construct_call' => true,
82 | 'no_alternative_syntax' => true,
83 | 'no_binary_string' => true,
84 | 'no_blank_lines_after_class_opening' => true,
85 | 'no_blank_lines_after_phpdoc' => true,
86 | 'no_closing_tag' => true,
87 | 'no_empty_phpdoc' => true,
88 | 'no_empty_statement' => true,
89 | 'no_extra_blank_lines' => [
90 | 'tokens' => [
91 | 'extra',
92 | 'throw',
93 | 'use',
94 | ],
95 | ],
96 | 'no_space_around_double_colon' => true,
97 | 'no_leading_import_slash' => true,
98 | 'no_leading_namespace_whitespace' => true,
99 | 'no_mixed_echo_print' => [
100 | 'use' => 'echo',
101 | ],
102 | 'no_multiline_whitespace_around_double_arrow' => true,
103 | 'no_short_bool_cast' => true,
104 | 'no_singleline_whitespace_before_semicolons' => true,
105 | 'no_spaces_after_function_name' => true,
106 | 'no_spaces_around_offset' => [
107 | 'positions' => [
108 | 'inside',
109 | ],
110 | ],
111 | 'no_spaces_inside_parenthesis' => true,
112 | 'no_trailing_comma_in_list_call' => true,
113 | 'no_trailing_comma_in_singleline_array' => true,
114 | 'no_trailing_whitespace' => true,
115 | 'no_trailing_whitespace_in_comment' => true,
116 | 'no_unneeded_control_parentheses' => true,
117 | 'no_unneeded_curly_braces' => true,
118 | 'no_unset_cast' => true,
119 | 'no_unused_imports' => true,
120 | 'no_useless_return' => true,
121 | 'no_whitespace_before_comma_in_array' => true,
122 | 'no_whitespace_in_blank_line' => true,
123 | 'normalize_index_brace' => true,
124 | 'not_operator_with_successor_space' => true,
125 | 'object_operator_without_whitespace' => true,
126 | 'ordered_imports' => [
127 | 'sort_algorithm' => 'alpha',
128 | ],
129 | 'phpdoc_indent' => true,
130 | 'phpdoc_inline_tag_normalizer' => true,
131 | 'phpdoc_no_alias_tag' => [
132 | 'replacements' => [
133 | 'type' => 'var',
134 | ],
135 | ],
136 | 'phpdoc_no_access' => true,
137 | 'phpdoc_no_package' => true,
138 | 'phpdoc_no_useless_inheritdoc' => true,
139 | 'phpdoc_return_self_reference' => true,
140 | 'phpdoc_scalar' => true,
141 | 'phpdoc_single_line_var_spacing' => true,
142 | 'phpdoc_summary' => true,
143 | 'phpdoc_trim' => true,
144 | 'phpdoc_types' => true,
145 | 'phpdoc_var_without_name' => true,
146 | 'return_type_declaration' => [
147 | 'space_before' => 'none',
148 | ],
149 | 'short_scalar_cast' => true,
150 | 'single_blank_line_at_eof' => true,
151 | 'single_blank_line_before_namespace' => true,
152 | 'single_class_element_per_statement' => true,
153 | 'single_import_per_statement' => true,
154 | 'single_line_after_imports' => true,
155 | 'single_line_comment_style' => [
156 | 'comment_types' => [
157 | 'hash',
158 | ],
159 | ],
160 | 'single_quote' => true,
161 | 'space_after_semicolon' => true,
162 | 'standardize_not_equals' => true,
163 | 'switch_case_semicolon_to_colon' => true,
164 | 'switch_case_space' => true,
165 | 'switch_continue_to_break' => true,
166 | 'ternary_operator_spaces' => true,
167 | 'trailing_comma_in_multiline' => [
168 | 'elements' => [
169 | 'arrays',
170 | ],
171 | ],
172 | 'trim_array_spaces' => true,
173 | 'types_spaces' => [
174 | 'space' => 'none',
175 | ],
176 | 'unary_operator_spaces' => true,
177 | 'visibility_required' => [
178 | 'elements' => [
179 | 'method',
180 | 'property',
181 | ],
182 | ],
183 | 'whitespace_after_comma_in_array' => true,
184 | // Risky
185 | 'no_alias_functions' => true,
186 | 'no_unreachable_default_argument_value' => true,
187 | 'self_accessor' => true,
188 | 'psr_autoloading' => true,
189 | ])
190 | ->setFinder($finder);
191 |
--------------------------------------------------------------------------------