├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── LICENSE.md ├── README.md ├── app ├── Console │ └── Kernel.php ├── Enums │ ├── DealStatus.php │ ├── LeadDisqualificationReason.php │ ├── LeadSource.php │ ├── LeadStatus.php │ └── ProductType.php ├── Events │ └── DealQualified.php ├── Exceptions │ └── Handler.php ├── Filament │ ├── Pages │ │ ├── Auth │ │ │ └── Login.php │ │ └── Dashboard.php │ ├── Resources │ │ ├── AccountResource.php │ │ ├── AccountResource │ │ │ ├── Pages │ │ │ │ ├── CreateAccount.php │ │ │ │ ├── EditAccount.php │ │ │ │ └── ListAccounts.php │ │ │ └── RelationManagers │ │ │ │ ├── ContactsRelationManager.php │ │ │ │ ├── DealsRelationManager.php │ │ │ │ └── LeadsRelationManager.php │ │ ├── ContactResource.php │ │ ├── ContactResource │ │ │ └── Pages │ │ │ │ ├── CreateContact.php │ │ │ │ ├── EditContact.php │ │ │ │ └── ListContacts.php │ │ ├── DealResource.php │ │ ├── DealResource │ │ │ ├── Pages │ │ │ │ ├── CreateDeal.php │ │ │ │ ├── EditDeal.php │ │ │ │ └── ListDeals.php │ │ │ ├── RelationManagers │ │ │ │ └── ProductsRelationManager.php │ │ │ └── Widgets │ │ │ │ ├── DealStats.php │ │ │ │ ├── DealsWon.php │ │ │ │ └── Revenue.php │ │ ├── LeadResource.php │ │ ├── LeadResource │ │ │ ├── Pages │ │ │ │ ├── CreateLead.php │ │ │ │ ├── EditLead.php │ │ │ │ └── ListLeads.php │ │ │ └── Widgets │ │ │ │ └── LeadStats.php │ │ ├── ProductResource.php │ │ ├── ProductResource │ │ │ └── Pages │ │ │ │ ├── CreateProduct.php │ │ │ │ ├── EditProduct.php │ │ │ │ └── ListProducts.php │ │ ├── UserResource.php │ │ └── UserResource │ │ │ └── Pages │ │ │ ├── CreateUser.php │ │ │ ├── EditUser.php │ │ │ └── ListUsers.php │ └── Widgets │ │ └── StatsOverview.php ├── Http │ ├── Controllers │ │ └── Controller.php │ ├── Kernel.php │ └── Middleware │ │ ├── Authenticate.php │ │ ├── EncryptCookies.php │ │ ├── PreventRequestsDuringMaintenance.php │ │ ├── RedirectIfAuthenticated.php │ │ ├── TrimStrings.php │ │ ├── TrustHosts.php │ │ ├── TrustProxies.php │ │ ├── ValidateSignature.php │ │ └── VerifyCsrfToken.php ├── Listeners │ └── RollupTotalSalesForCustomer.php ├── Models │ ├── Account.php │ ├── Contact.php │ ├── Deal.php │ ├── DealProduct.php │ ├── Lead.php │ ├── Product.php │ └── User.php ├── Observers │ └── DealProductObserver.php └── Providers │ ├── AppServiceProvider.php │ ├── AuthServiceProvider.php │ ├── BroadcastServiceProvider.php │ ├── EventServiceProvider.php │ ├── Filament │ └── AppPanelProvider.php │ └── RouteServiceProvider.php ├── artisan ├── bootstrap ├── app.php └── cache │ └── .gitignore ├── composer.json ├── composer.lock ├── config ├── app.php ├── auth.php ├── broadcasting.php ├── cache.php ├── cors.php ├── database.php ├── debugbar.php ├── filament.php ├── filesystems.php ├── hashing.php ├── logging.php ├── mail.php ├── queue.php ├── sanctum.php ├── services.php ├── session.php └── view.php ├── database ├── .gitignore ├── factories │ ├── AccountFactory.php │ ├── ContactFactory.php │ ├── DealFactory.php │ ├── DealProductFactory.php │ ├── LeadFactory.php │ ├── ProductFactory.php │ └── UserFactory.php ├── migrations │ ├── 2014_10_12_000000_create_users_table.php │ ├── 2014_10_12_100000_create_password_resets_table.php │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ ├── 2019_12_14_000001_create_personal_access_tokens_table.php │ ├── 2023_02_06_054404_create_accounts_table.php │ ├── 2023_02_06_094446_create_contacts_table.php │ ├── 2023_02_06_113654_add_primary_contact_field_to_account.php │ ├── 2023_02_06_120837_create_leads_table.php │ ├── 2023_02_07_115224_create_deals_table.php │ ├── 2023_02_09_055306_create_products_table.php │ ├── 2023_02_09_111021_create_deal_products_table.php │ ├── 2023_02_13_131939_create_jobs_table.php │ └── 2023_08_05_065301_add_foreign_key_constraint_to_deals_table.php └── seeders │ └── DatabaseSeeder.php ├── lang └── en │ ├── auth.php │ ├── pagination.php │ ├── passwords.php │ └── validation.php ├── package-lock.json ├── package.json ├── phpunit.xml ├── postcss.config.js ├── public ├── .htaccess ├── css │ └── filament │ │ ├── filament │ │ └── app.css │ │ ├── forms │ │ └── forms.css │ │ └── support │ │ └── support.css ├── favicon.ico ├── images │ ├── hero-img.png │ └── pipeline-img.png ├── index.php ├── js │ └── filament │ │ ├── filament │ │ ├── app.js │ │ └── echo.js │ │ ├── forms │ │ └── components │ │ │ ├── color-picker.js │ │ │ ├── date-time-picker.js │ │ │ ├── file-upload.js │ │ │ ├── key-value.js │ │ │ ├── markdown-editor.js │ │ │ ├── rich-editor.js │ │ │ ├── select.js │ │ │ ├── tags-input.js │ │ │ └── textarea.js │ │ ├── notifications │ │ └── notifications.js │ │ ├── support │ │ ├── async-alpine.js │ │ └── support.js │ │ ├── tables │ │ └── components │ │ │ └── table.js │ │ └── widgets │ │ └── components │ │ ├── chart.js │ │ └── stats-overview │ │ └── stat │ │ └── chart.js └── robots.txt ├── resources ├── css │ └── app.css ├── js │ ├── app.js │ └── bootstrap.js └── views │ └── welcome.blade.php ├── routes ├── api.php ├── channels.php ├── console.php └── web.php ├── screenshots └── Dashboard Screenshot.png ├── storage ├── app │ ├── .gitignore │ └── public │ │ └── .gitignore ├── debugbar │ └── .gitignore ├── framework │ ├── .gitignore │ ├── cache │ │ ├── .gitignore │ │ └── data │ │ │ └── .gitignore │ ├── sessions │ │ └── .gitignore │ ├── testing │ │ └── .gitignore │ └── views │ │ └── .gitignore └── logs │ └── .gitignore ├── tailwind.config.js ├── tests ├── CreatesApplication.php ├── Feature │ ├── AccountTest.php │ ├── ArchitectureTest.php │ ├── ContactTest.php │ ├── DashboardTest.php │ ├── DealTest.php │ ├── LeadTest.php │ └── ProductTest.php ├── Pest.php ├── TestCase.php └── Unit │ └── .gitkeep └── vite.config.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=TinyCRM 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | FILAMENT_PATH=app 8 | 9 | LOG_CHANNEL=stack 10 | LOG_DEPRECATIONS_CHANNEL=null 11 | LOG_LEVEL=debug 12 | 13 | DB_CONNECTION=mysql 14 | DB_HOST=127.0.0.1 15 | DB_PORT=3306 16 | DB_DATABASE=tiny_crm 17 | DB_USERNAME=root 18 | DB_PASSWORD= 19 | 20 | BROADCAST_DRIVER=log 21 | CACHE_DRIVER=file 22 | FILESYSTEM_DISK=local 23 | QUEUE_CONNECTION=sync 24 | SESSION_DRIVER=file 25 | SESSION_LIFETIME=120 26 | 27 | MEMCACHED_HOST=127.0.0.1 28 | 29 | REDIS_HOST=127.0.0.1 30 | REDIS_PASSWORD=null 31 | REDIS_PORT=6379 32 | 33 | MAIL_MAILER=smtp 34 | MAIL_HOST=mailpit 35 | MAIL_PORT=1025 36 | MAIL_USERNAME=null 37 | MAIL_PASSWORD=null 38 | MAIL_ENCRYPTION=null 39 | MAIL_FROM_ADDRESS="hello@example.com" 40 | MAIL_FROM_NAME="${APP_NAME}" 41 | 42 | AWS_ACCESS_KEY_ID= 43 | AWS_SECRET_ACCESS_KEY= 44 | AWS_DEFAULT_REGION=us-east-1 45 | AWS_BUCKET= 46 | AWS_USE_PATH_STYLE_ENDPOINT=false 47 | 48 | PUSHER_APP_ID= 49 | PUSHER_APP_KEY= 50 | PUSHER_APP_SECRET= 51 | PUSHER_HOST= 52 | PUSHER_PORT=443 53 | PUSHER_SCHEME=https 54 | PUSHER_APP_CLUSTER=mt1 55 | 56 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 57 | VITE_PUSHER_HOST="${PUSHER_HOST}" 58 | VITE_PUSHER_PORT="${PUSHER_PORT}" 59 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 60 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 61 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/build 3 | /public/hot 4 | /public/storage 5 | /storage/*.key 6 | /vendor 7 | .env 8 | .env.backup 9 | .env.production 10 | .phpunit.result.cache 11 | Homestead.json 12 | Homestead.yaml 13 | auth.json 14 | npm-debug.log 15 | yarn-error.log 16 | /.fleet 17 | /.idea 18 | /.vscode 19 | /.phpunit.cache 20 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2024] [Ishan Sheikh] 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tiny crm 2 | 3 | ![Tiny CRM dashboard screenshot](screenshots/Dashboard%20Screenshot.png "Tiny CRM dashboard screenshot") 4 | 5 | [![Tests](https://github.com/frikishaan/tiny-crm/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/frikishaan/tiny-crm/actions/workflows/run-tests.yml) 6 | 7 | This is a small and Open-source CRM application created using the [Filament PHP](https://filamentphp.com/). 8 | 9 | ## Tech stack 10 | 11 | - PHP (Laravel) 12 | - Filament PHP 13 | 14 | ## Local Installation 15 | 16 | 1. Clone the repository 17 | 2. Run the following commands - 18 | 19 | ```bash 20 | composer install #installing php dependencies 21 | 22 | npm install # installing the JS dependencies 23 | 24 | npm run build # to build the frontend assets 25 | ``` 26 | 27 | 3. Replace the database credentials in the `.env` file. 28 | 29 | ``` 30 | DB_CONNECTION=pgsql 31 | DB_HOST=127.0.0.1 32 | DB_PORT=5432 33 | DB_DATABASE=tiny_crm 34 | DB_USERNAME=postgres 35 | DB_PASSWORD=password 36 | ``` 37 | 38 | 4. Now run the following command to create the required tables in database - 39 | 40 | ```bash 41 | php artisan migrate 42 | ``` 43 | 44 | Optionally, you can create the dummy data by running the seeder as - 45 | 46 | ```bash 47 | php artisan db:seed 48 | ``` 49 | 50 | ## You might also like 51 | If you like tiny-crm, check out my other project [Lynx](https://github.com/frikishaan/lynx), an open-source link shortener. It’s a great tool for creating and managing shortened links, perfect for tracking campaigns and sharing links more efficiently. 52 | 53 | 54 | 57 | -------------------------------------------------------------------------------- /app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Enums/DealStatus.php: -------------------------------------------------------------------------------- 1 | 'Open', 18 | self::Won => 'Won', 19 | self::Lost => 'Lost' 20 | }; 21 | } 22 | 23 | public function getColor(): string | array | null 24 | { 25 | return match ($this) { 26 | self::Open => 'warning', 27 | self::Won => 'success', 28 | self::Lost => 'danger' 29 | }; 30 | } 31 | } -------------------------------------------------------------------------------- /app/Enums/LeadDisqualificationReason.php: -------------------------------------------------------------------------------- 1 | 'Prospect', 19 | self::Open => 'Open', 20 | self::Qualified => 'Qualified', 21 | self::Disqualified => 'Disqualified' 22 | }; 23 | } 24 | 25 | public function getColor(): string | array | null 26 | { 27 | return match ($this) { 28 | self::Prospect => 'info', 29 | self::Open => 'warning', 30 | self::Qualified => 'success', 31 | self::Disqualified => 'danger' 32 | }; 33 | } 34 | } -------------------------------------------------------------------------------- /app/Enums/ProductType.php: -------------------------------------------------------------------------------- 1 | 'Service', 17 | self::Physical => 'Physical', 18 | }; 19 | } 20 | 21 | public function getColor(): string | array | null 22 | { 23 | return match ($this) { 24 | self::Service => 'success', 25 | self::Physical => 'warning' 26 | }; 27 | } 28 | } -------------------------------------------------------------------------------- /app/Events/DealQualified.php: -------------------------------------------------------------------------------- 1 | deal = $deal; 28 | } 29 | 30 | /** 31 | * Get the channels the event should broadcast on. 32 | * 33 | * @return \Illuminate\Broadcasting\Channel|array 34 | */ 35 | public function broadcastOn() 36 | { 37 | return new PrivateChannel('channel-name'); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/Filament/Pages/Auth/Login.php: -------------------------------------------------------------------------------- 1 | form->fill([ 14 | 'email' => 'admin@tinycrm.com', 15 | 'password' => 'password', 16 | 'remember' => true, 17 | ]); 18 | } 19 | } -------------------------------------------------------------------------------- /app/Filament/Pages/Dashboard.php: -------------------------------------------------------------------------------- 1 | schema([ 35 | Group::make() 36 | ->schema([ 37 | Section::make([ 38 | TextInput::make('name') 39 | ->required(), 40 | TextInput::make('email') 41 | ->email() 42 | ->unique(), 43 | TextInput::make('phone') 44 | ->tel(), 45 | TextInput::make('address') 46 | ]) 47 | ]) 48 | ->columnSpan(['lg' => 2]), 49 | Section::make() 50 | ->schema([ 51 | TextInput::make('total_sales') 52 | ->mask(RawJs::make('$money($input)')) 53 | ->stripCharacters(',') 54 | ->numeric() 55 | ->prefix('$') 56 | ->disabled() 57 | ]) 58 | ->columnSpan(['lg' => 1]) 59 | ]) 60 | ->columns(3); 61 | } 62 | 63 | public static function table(Table $table): Table 64 | { 65 | return $table 66 | ->columns([ 67 | TextColumn::make('name') 68 | ->searchable() 69 | ->sortable(), 70 | TextColumn::make('email') 71 | ->searchable() 72 | ->sortable(), 73 | TextColumn::make('total_sales') 74 | ->money('USD') 75 | ]) 76 | ->filters([ 77 | // 78 | ]) 79 | ->actions([ 80 | Tables\Actions\EditAction::make(), 81 | ]) 82 | ->bulkActions([ 83 | Tables\Actions\DeleteBulkAction::make() 84 | ->action(function(){ 85 | Notification::make() 86 | ->title('Now, now, don\'t be cheeky, leave some records for others to play with!') 87 | ->warning() 88 | ->send(); 89 | }), 90 | ]); 91 | } 92 | 93 | public static function getRelations(): array 94 | { 95 | return [ 96 | ContactsRelationManager::class, 97 | LeadsRelationManager::class, 98 | DealsRelationManager::class 99 | ]; 100 | } 101 | 102 | public static function getPages(): array 103 | { 104 | return [ 105 | 'index' => Pages\ListAccounts::route('/'), 106 | 'create' => Pages\CreateAccount::route('/create'), 107 | 'edit' => Pages\EditAccount::route('/{record}/edit'), 108 | ]; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /app/Filament/Resources/AccountResource/Pages/CreateAccount.php: -------------------------------------------------------------------------------- 1 | schema([ 28 | TextInput::make('name') 29 | ->required() 30 | ->maxLength(255), 31 | TextInput::make('email') 32 | ->email() 33 | ->required() 34 | ]); 35 | } 36 | 37 | public function table(Table $table): Table 38 | { 39 | return $table 40 | ->columns([ 41 | TextColumn::make('name') 42 | ->searchable() 43 | ->sortable(), 44 | TextColumn::make('email') 45 | ->searchable() 46 | ->sortable() 47 | ]) 48 | ->filters([ 49 | // 50 | ]) 51 | ->headerActions([ 52 | Tables\Actions\CreateAction::make(), 53 | ]) 54 | ->actions([ 55 | Tables\Actions\EditAction::make() 56 | ->url(fn(Contact $record) => ContactResource::getUrl('edit', ['record' => $record->id])), 57 | Tables\Actions\DeleteAction::make(), 58 | ]) 59 | ->bulkActions([ 60 | Tables\Actions\DeleteBulkAction::make() 61 | ->action(function(){ 62 | Notification::make() 63 | ->title('Now, now, don\'t be cheeky, leave some records for others to play with!') 64 | ->warning() 65 | ->send(); 66 | }), 67 | ]); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/Filament/Resources/AccountResource/RelationManagers/DealsRelationManager.php: -------------------------------------------------------------------------------- 1 | schema([ 29 | TextInput::make('title') 30 | ->required() 31 | ->maxLength(255) 32 | ]); 33 | } 34 | 35 | public function table(Table $table): Table 36 | { 37 | return $table 38 | ->columns([ 39 | TextColumn::make('title') 40 | ->searchable() 41 | ->sortable(), 42 | TextColumn::make('actual_revenue') 43 | ->sortable() 44 | ->money('USD'), 45 | TextColumn::make('status') 46 | ->badge() 47 | ->colors([ 48 | 'secondary' => 1, 49 | 'success' => 2, 50 | 'danger' => 3 51 | ]) 52 | ]) 53 | ->filters([ 54 | SelectFilter::make('status') 55 | ->options([ 56 | 1 => 'Open', 57 | 2 => 'Won', 58 | 3 => 'Lost' 59 | ]) 60 | ]) 61 | ->headerActions([ 62 | Tables\Actions\CreateAction::make() 63 | ->url(DealResource::getUrl('create')), 64 | ]) 65 | ->actions([ 66 | Tables\Actions\EditAction::make() 67 | ->url(fn(Deal $record) => DealResource::getUrl('edit', ['record' => $record->id])), 68 | Tables\Actions\DeleteAction::make(), 69 | ]) 70 | ->bulkActions([ 71 | Tables\Actions\DeleteBulkAction::make() 72 | ->action(function(){ 73 | Notification::make() 74 | ->title('Now, now, don\'t be cheeky, leave some records for others to play with!') 75 | ->warning() 76 | ->send(); 77 | }), 78 | ]); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/Filament/Resources/AccountResource/RelationManagers/LeadsRelationManager.php: -------------------------------------------------------------------------------- 1 | schema([ 30 | TextInput::make('title') 31 | ->required() 32 | ->maxLength(255), 33 | TextInput::make('estimated_revenue') 34 | ->label('Estimated revenue') 35 | ->mask(RawJs::make('$money($input)')) 36 | ->stripCharacters(',') 37 | ->numeric() 38 | ]); 39 | } 40 | 41 | public function table(Table $table): Table 42 | { 43 | return $table 44 | ->columns([ 45 | TextColumn::make('title') 46 | ->searchable() 47 | ->sortable(), 48 | TextColumn::make('estimated_revenue') 49 | ->sortable() 50 | ->money('USD'), 51 | TextColumn::make('status') 52 | ->badge() 53 | ->colors([ 54 | 'secondary' => 1, 55 | 'warning' => 2, 56 | 'success' => 3, 57 | 'danger' => 4 58 | ]) 59 | ]) 60 | ->filters([ 61 | SelectFilter::make('status') 62 | ->options([ 63 | 1 => 'Prospect', 64 | 2 => 'Open', 65 | 3 => 'Qualified', 66 | 4 => 'Disqualified' 67 | ]) 68 | ]) 69 | ->headerActions([ 70 | Tables\Actions\CreateAction::make(), 71 | ]) 72 | ->actions([ 73 | Tables\Actions\Action::make('edit') 74 | ->label('Edit') 75 | ->icon('heroicon-o-pencil-square') 76 | ->url(fn(Lead $record) => LeadResource::getUrl('edit', ['record' => $record->id])), 77 | Tables\Actions\DeleteAction::make(), 78 | ]) 79 | ->bulkActions([ 80 | Tables\Actions\DeleteBulkAction::make() 81 | ->action(function(){ 82 | Notification::make() 83 | ->title('Now, now, don\'t be cheeky, leave some records for others to play with!') 84 | ->warning() 85 | ->send(); 86 | }), 87 | ]); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /app/Filament/Resources/ContactResource.php: -------------------------------------------------------------------------------- 1 | schema([ 35 | Section::make() 36 | ->schema([ 37 | TextInput::make('name') 38 | ->required(), 39 | TextInput::make('email') 40 | ->required() 41 | ->email(), 42 | TextInput::make('phone') 43 | ->tel(), 44 | Select::make('account_id') 45 | ->label('Account') 46 | ->options(Account::all()->pluck('name', 'id')) 47 | ->searchable() 48 | ]) 49 | ->columns(2) 50 | ]); 51 | } 52 | 53 | public static function table(Table $table): Table 54 | { 55 | return $table 56 | ->columns([ 57 | TextColumn::make('name') 58 | ->searchable() 59 | ->sortable(), 60 | TextColumn::make('email') 61 | ->searchable() 62 | ->sortable() 63 | ]) 64 | ->filters([ 65 | // 66 | ]) 67 | ->actions([ 68 | Tables\Actions\EditAction::make(), 69 | ]) 70 | ->bulkActions([ 71 | Tables\Actions\DeleteBulkAction::make() 72 | ->action(function(){ 73 | Notification::make() 74 | ->title('Now, now, don\'t be cheeky, leave some records for others to play with!') 75 | ->warning() 76 | ->send(); 77 | }), 78 | ]); 79 | } 80 | 81 | public static function getRelations(): array 82 | { 83 | return [ 84 | // 85 | ]; 86 | } 87 | 88 | public static function getPages(): array 89 | { 90 | return [ 91 | 'index' => Pages\ListContacts::route('/'), 92 | 'create' => Pages\CreateContact::route('/create'), 93 | 'edit' => Pages\EditContact::route('/{record}/edit'), 94 | ]; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /app/Filament/Resources/ContactResource/Pages/CreateContact.php: -------------------------------------------------------------------------------- 1 | schema([ 41 | Section::make() 42 | ->schema([ 43 | TextInput::make('title') 44 | ->required() 45 | ->disabled(fn(?Deal $record) => in_array($record?->status, [2, 3])), 46 | Select::make('customer_id') 47 | ->label('Customer') 48 | ->options(Account::all()->pluck('name', 'id')) 49 | ->searchable() 50 | ->disabled(fn(?Deal $record) => in_array($record?->status, [2, 3])) 51 | ->required(), 52 | Select::make('lead_id') 53 | ->label('Originating lead') 54 | ->options(Lead::all()->pluck('title', 'id')) 55 | ->searchable() 56 | ->disabled(fn(?Deal $record) => in_array($record?->status, [2, 3])), 57 | RichEditor::make('description') 58 | ->disableToolbarButtons([ 59 | 'attachFiles', 60 | 'codeBlock' 61 | ]) 62 | ]) 63 | ->columnSpan(2), 64 | 65 | Section::make() 66 | ->schema([ 67 | Select::make('status') 68 | ->options([ 69 | 1 => 'Open', 70 | 2 => 'Won', 71 | 3 => 'Lost' 72 | ]) 73 | ->visible(fn(?Deal $record) => $record != null) 74 | ->disabled(), 75 | TextInput::make('estimated_revenue') 76 | ->label('Estimated revenue') 77 | ->mask(RawJs::make('$money($input)')) 78 | ->stripCharacters(',') 79 | ->numeric() 80 | ->disabled(fn(?Deal $record) => in_array($record?->status, [2, 3])), 81 | TextInput::make('actual_revenue') 82 | ->label('Actual revenue') 83 | ->mask(RawJs::make('$money($input)')) 84 | ->stripCharacters(',') 85 | ->numeric() 86 | ->disabled(fn(?Deal $record) => in_array($record?->status, [2, 3])) 87 | ]) 88 | ->columnSpan(1) 89 | ]) 90 | ->columns(3); 91 | } 92 | 93 | public static function table(Table $table): Table 94 | { 95 | return $table 96 | ->columns([ 97 | TextColumn::make('title') 98 | ->searchable() 99 | ->sortable(), 100 | TextColumn::make('customer.name') 101 | ->searchable(), 102 | TextColumn::make('status') 103 | ->badge() 104 | ]) 105 | ->actions([ 106 | Tables\Actions\EditAction::make(), 107 | ]) 108 | ->bulkActions([ 109 | Tables\Actions\DeleteBulkAction::make() 110 | ->action(function(){ 111 | Notification::make() 112 | ->title('Now, now, don\'t be cheeky, leave some records for others to play with!') 113 | ->warning() 114 | ->send(); 115 | }), 116 | ]); 117 | } 118 | 119 | public static function getRelations(): array 120 | { 121 | return [ 122 | ProductsRelationManager::class 123 | ]; 124 | } 125 | 126 | public static function getPages(): array 127 | { 128 | return [ 129 | 'index' => Pages\ListDeals::route('/'), 130 | 'create' => Pages\CreateDeal::route('/create'), 131 | 'edit' => Pages\EditDeal::route('/{record}/edit'), 132 | ]; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /app/Filament/Resources/DealResource/Pages/CreateDeal.php: -------------------------------------------------------------------------------- 1 | label('Close As Won') 21 | ->icon('heroicon-o-check-badge') 22 | ->action(function() { 23 | $this->record->closeAsWon(); 24 | $this->refreshFormData(['status']); 25 | Notification::make() 26 | ->title('Deal has been closed as won') 27 | ->success(); 28 | }) 29 | ->visible(!in_array($this->record->status, [DealStatus::Won, DealStatus::Lost])), 30 | Action::make('close_as_lost') 31 | ->label('Close As Lost') 32 | ->icon('heroicon-o-x-circle') 33 | ->color('warning') 34 | ->action(function() { 35 | $this->record->closeAsLost(); 36 | $this->refreshFormData(['status']); 37 | Notification::make() 38 | ->title('Deal has been closed as lost') 39 | ->success(); 40 | }) 41 | ->visible(!in_array($this->record->status, [DealStatus::Won, DealStatus::Lost])), 42 | DeleteAction::make() 43 | ->visible(!in_array($this->record->status, [DealStatus::Won, DealStatus::Lost])), 44 | ]; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/Filament/Resources/DealResource/Pages/ListDeals.php: -------------------------------------------------------------------------------- 1 | Tab::make('All'), 36 | 'open' => Tab::make('Open') 37 | ->modifyQueryUsing(fn (Builder $query) => $query->where('status', DealStatus::Open->value)) 38 | ->badge(Deal::query()->where('status', DealStatus::Open->value)->count()), 39 | 'won' => Tab::make('Won') 40 | ->modifyQueryUsing(fn (Builder $query) => $query->where('status', DealStatus::Won->value)), 41 | 'lost' => Tab::make('Lost') 42 | ->modifyQueryUsing(fn (Builder $query) => $query->where('status', DealStatus::Lost->value)), 43 | ]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/Filament/Resources/DealResource/RelationManagers/ProductsRelationManager.php: -------------------------------------------------------------------------------- 1 | schema([ 28 | Select::make('product_id') 29 | ->label('Product') 30 | ->options(Product::all()->pluck('name', 'id')) 31 | ->searchable() 32 | ->required() 33 | ->reactive() 34 | ->afterStateUpdated(function($state, callable $set){ 35 | $price = Product::where('id', $state) 36 | ->pluck('price') 37 | ->first(); 38 | // dd($product); 39 | $set('price_per_unit', (string)($price)); 40 | }), 41 | TextInput::make('quantity') 42 | ->numeric() 43 | ->required() 44 | ->default(1) 45 | ->reactive() 46 | ->afterStateUpdated(fn($state, callable $set, callable $get) => 47 | $set('total_amount', (string)($get('price_per_unit') * $state))), 48 | TextInput::make('price_per_unit') 49 | ->mask(RawJs::make('$money($input)')) 50 | ->stripCharacters(',') 51 | ->numeric() 52 | ->required() 53 | ->helperText('Price per unit of product') 54 | ->reactive() 55 | ->afterStateUpdated(fn($state, callable $set, callable $get) => 56 | $set('total_amount', (string)($get('quantity') * $state))), 57 | TextInput::make('total_amount') 58 | ->label('Total amount') 59 | ->mask(RawJs::make('$money($input)')) 60 | ->stripCharacters(',') 61 | ->numeric() 62 | ->disabled() 63 | ->default(0) 64 | ]); 65 | } 66 | 67 | public function table(Table $table): Table 68 | { 69 | return $table 70 | ->columns([ 71 | TextColumn::make('product.product_id') 72 | ->searchable() 73 | ->sortable(), 74 | TextColumn::make('product.name') 75 | ->searchable() 76 | ->sortable(), 77 | TextColumn::make('price_per_unit') 78 | ->money('USD') 79 | ->sortable(), 80 | TextColumn::make('quantity') 81 | ->sortable(), 82 | TextColumn::make('total_amount') 83 | ->money('USD') 84 | ->sortable() 85 | ]) 86 | ->filters([ 87 | // 88 | ]) 89 | ->headerActions([ 90 | Tables\Actions\CreateAction::make() 91 | ->label('Add product'), 92 | ]) 93 | ->actions([ 94 | Tables\Actions\EditAction::make(), 95 | Tables\Actions\DeleteAction::make() 96 | ->label('Remove') 97 | ->modalHeading('Remove product'), 98 | ]) 99 | ->bulkActions([ 100 | Tables\Actions\DeleteBulkAction::make() 101 | ->label('Remove all') 102 | ->modalHeading('Remove all products'), 103 | ]); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /app/Filament/Resources/DealResource/Widgets/DealStats.php: -------------------------------------------------------------------------------- 1 | count()), 18 | Stat::make('Deals won', Deal::where('status', 2)->count()), 19 | Stat::make('Avg Revenue (per deal)', 20 | Money::USD(Deal::all()->avg('actual_revenue') ?? 0, true)), 21 | Stat::make('Total revenue', 22 | Money::USD(Deal::where('status', 2)->sum('actual_revenue'), true) 23 | ), 24 | ]; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/Filament/Resources/DealResource/Widgets/DealsWon.php: -------------------------------------------------------------------------------- 1 | [ 20 | 'legend' => [ 21 | 'display' => false, 22 | ], 23 | ], 24 | ]; 25 | 26 | protected function getType(): string 27 | { 28 | return 'line'; 29 | } 30 | 31 | protected function getData(): array 32 | { 33 | $data = Trend::query( 34 | Deal::where('status', 2) 35 | ) 36 | ->between( 37 | start: now()->subYear(1), 38 | end: now() 39 | ) 40 | ->perMonth() 41 | ->count(); 42 | 43 | return [ 44 | 'datasets' => [ 45 | [ 46 | 'label' => 'Deals per month', 47 | 'data' => $data->map(fn (TrendValue $value) => $value->aggregate), 48 | ], 49 | ], 50 | 'labels' => $data->map(fn (TrendValue $value) => $value->date), 51 | ]; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/Filament/Resources/DealResource/Widgets/Revenue.php: -------------------------------------------------------------------------------- 1 | [ 20 | 'legend' => [ 21 | 'display' => false, 22 | ], 23 | ], 24 | ]; 25 | 26 | protected function getType(): string 27 | { 28 | return 'line'; 29 | } 30 | 31 | protected function getData(): array 32 | { 33 | $data = Trend::model(Deal::class) 34 | ->between( 35 | start: now()->subYear(1), 36 | end: now() 37 | ) 38 | ->perMonth() 39 | ->sum('actual_revenue'); 40 | 41 | return [ 42 | 'datasets' => [ 43 | [ 44 | 'label' => 'Revenue per month', 45 | 'data' => $data->map(fn (TrendValue $value) => $value->aggregate), 46 | ], 47 | ], 48 | 'labels' => $data->map(fn (TrendValue $value) => $value->date), 49 | ]; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/Filament/Resources/LeadResource/Pages/CreateLead.php: -------------------------------------------------------------------------------- 1 | action(function() { 27 | $deal = $this->record->qualify(); 28 | 29 | Notification::make() 30 | ->title('Lead Qualified') 31 | ->success(); 32 | 33 | $this->redirect(DealResource::getUrl('edit', ['record' => $deal->id])); 34 | }) 35 | ->icon('heroicon-o-check-badge') 36 | ->visible(!in_array($this->record->status, [LeadStatus::Qualified, LeadStatus::Disqualified])), 37 | Action::make('disqualify') 38 | ->icon('heroicon-o-x-circle') 39 | ->color('warning') 40 | ->form([ 41 | Select::make('disqualification_reason') 42 | ->label('Reason for disqualification') 43 | ->options([ 44 | 1 => 'Budget', 45 | 2 => 'Bad/fake data', 46 | 3 => 'Not responsive', 47 | 4 => 'Lost to Competitor', 48 | 5 => 'Timeline' 49 | ]), 50 | Textarea::make('disqualification_description') 51 | ->label('Description') 52 | ]) 53 | ->action(function (array $data, Lead $record): void { 54 | $record->disqualify( 55 | $data['disqualification_reason'], 56 | $data['disqualification_description'] 57 | ); 58 | 59 | Notification::make() 60 | ->title('Lead has been disqualified') 61 | ->success(); 62 | }) 63 | ->modalHeading('Disqualify lead') 64 | ->visible(!in_array($this->record->status, [LeadStatus::Qualified, LeadStatus::Disqualified])), 65 | Action::make('open-deal') 66 | ->action('openDeal') 67 | ->icon('heroicon-o-arrow-right-circle') 68 | ->visible(in_array($this->record->status, [LeadStatus::Qualified])), 69 | DeleteAction::make() 70 | ->visible(!in_array($this->record->status, [LeadStatus::Qualified, LeadStatus::Disqualified])), 71 | ]; 72 | } 73 | 74 | public function openDeal() 75 | { 76 | $deal = Deal::where('lead_id', $this->record->id)->first(); 77 | 78 | if($deal) 79 | $this->redirect(DealResource::getUrl('edit', ['record' => $deal->id])); 80 | else 81 | $this->notify('danger', 'Deal does not exists'); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /app/Filament/Resources/LeadResource/Pages/ListLeads.php: -------------------------------------------------------------------------------- 1 | Tab::make('All'), 36 | 'prospect' => Tab::make('Prospect') 37 | ->modifyQueryUsing(fn (Builder $query) => $query->where('status', LeadStatus::Prospect->value)) 38 | ->badge(Lead::query()->where('status', LeadStatus::Prospect->value)->count()), 39 | 'open' => Tab::make('Open') 40 | ->modifyQueryUsing(fn (Builder $query) => $query->where('status', LeadStatus::Open->value)) 41 | ->badge(Lead::query()->where('status', LeadStatus::Open->value)->count()), 42 | 'qualified' => Tab::make('Qualified') 43 | ->modifyQueryUsing(fn (Builder $query) => $query->where('status', LeadStatus::Qualified->value)), 44 | 'disqualified' => Tab::make('Disqualified') 45 | ->modifyQueryUsing(fn (Builder $query) => $query->where('status', LeadStatus::Disqualified->value)), 46 | ]; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/Filament/Resources/LeadResource/Widgets/LeadStats.php: -------------------------------------------------------------------------------- 1 | count()), 18 | Stat::make('Qualified leads', Lead::where('status', 2)->count()), 19 | Stat::make('Disqualified leads', Lead::where('status', 3)->count()), 20 | Stat::make('Avg Estimated Revenue', 21 | Money::USD( 22 | Lead::whereIn('status', [2, 3]) 23 | ->avg('estimated_revenue') ?? 0, 24 | true) 25 | ), 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/Filament/Resources/ProductResource.php: -------------------------------------------------------------------------------- 1 | name . ' ('. $record->product_id .')'; 35 | } 36 | 37 | public static function getGloballySearchableAttributes(): array 38 | { 39 | return ['name', 'product_id']; 40 | } 41 | 42 | public static function form(Form $form): Form 43 | { 44 | return $form 45 | ->schema([ 46 | Section::make() 47 | ->schema([ 48 | TextInput::make('product_id') 49 | ->label('Product ID') 50 | ->required() 51 | ->maxLength(255) 52 | ->unique(column: 'product_id', ignoreRecord: true) 53 | ->helperText('A unique product identifier, for ex SKU-1234'), 54 | TextInput::make('name') 55 | ->required() 56 | ->maxLength(255), 57 | Select::make('type') 58 | ->options([ 59 | 1 => 'Service', 60 | 2 => 'Physical' 61 | ]) 62 | ->required() 63 | ->helperText('Type of product'), 64 | TextInput::make('price') 65 | ->required() 66 | ->mask(RawJs::make('$money($input)')) 67 | ->stripCharacters(',') 68 | ->numeric(), 69 | Toggle::make('is_available') 70 | ->label('Is available for purchase?') 71 | ->inline() 72 | ]) 73 | ->columns(2) 74 | ]); 75 | } 76 | 77 | public static function table(Table $table): Table 78 | { 79 | return $table 80 | ->columns([ 81 | TextColumn::make('product_id') 82 | ->label('ID') 83 | ->searchable() 84 | ->sortable(), 85 | TextColumn::make('name') 86 | ->searchable() 87 | ->sortable(), 88 | TextColumn::make('price') 89 | ->money('USD') 90 | ->sortable(), 91 | TextColumn::make('type') 92 | ->badge() 93 | ->colors([ 94 | 'secondary' => 1, 95 | 'warning' => 2 96 | ]) 97 | ]) 98 | ->filters([ 99 | SelectFilter::make('type') 100 | ->options([ 101 | 1 => 'Service', 102 | 2 => 'Physical' 103 | ]) 104 | ]) 105 | ->actions([ 106 | Tables\Actions\EditAction::make(), 107 | ]) 108 | ->bulkActions([ 109 | Tables\Actions\DeleteBulkAction::make() 110 | ->action(function(){ 111 | Notification::make() 112 | ->title('Now, now, don\'t be cheeky, leave some records for others to play with!') 113 | ->warning() 114 | ->send(); 115 | }), 116 | ]); 117 | } 118 | 119 | public static function getRelations(): array 120 | { 121 | return [ 122 | // 123 | ]; 124 | } 125 | 126 | public static function getPages(): array 127 | { 128 | return [ 129 | 'index' => Pages\ListProducts::route('/'), 130 | 'create' => Pages\CreateProduct::route('/create'), 131 | 'edit' => Pages\EditProduct::route('/{record}/edit'), 132 | ]; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /app/Filament/Resources/ProductResource/Pages/CreateProduct.php: -------------------------------------------------------------------------------- 1 | schema([ 35 | TextInput::make('name') 36 | ->required() 37 | ->maxLength(255), 38 | TextInput::make('email') 39 | ->unique(ignoreRecord: true) 40 | ->required() 41 | ->maxLength(255) 42 | ->email(), 43 | TextInput::make('password') 44 | ->password() 45 | ->reactive() 46 | ->confirmed() 47 | ->autocomplete(false) 48 | ->dehydrateStateUsing(fn ($state) => Hash::make($state)) 49 | ->visible(fn(?User $record) => $record == null), 50 | 51 | TextInput::make('password_confirmation') 52 | ->password() 53 | ->visible(fn(?User $record) => $record == null) 54 | ]); 55 | } 56 | 57 | public static function table(Table $table): Table 58 | { 59 | return $table 60 | ->columns([ 61 | TextColumn::make('name'), 62 | TextColumn::make('email') 63 | ]) 64 | ->filters([ 65 | // 66 | ]) 67 | ->actions([ 68 | Tables\Actions\EditAction::make(), 69 | ]) 70 | ->bulkActions([ 71 | Tables\Actions\DeleteBulkAction::make() 72 | ->action(function(){ 73 | Notification::make() 74 | ->title('Now, now, don\'t be cheeky, leave some records for others to play with!') 75 | ->warning() 76 | ->send(); 77 | }), 78 | ]); 79 | } 80 | 81 | public static function getRelations(): array 82 | { 83 | return [ 84 | // 85 | ]; 86 | } 87 | 88 | public static function getPages(): array 89 | { 90 | return [ 91 | 'index' => Pages\ListUsers::route('/'), 92 | 'create' => Pages\CreateUser::route('/create'), 93 | 'edit' => Pages\EditUser::route('/{record}/edit'), 94 | ]; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /app/Filament/Resources/UserResource/Pages/CreateUser.php: -------------------------------------------------------------------------------- 1 | action(function(array $data) { 24 | if($this->record->id != 1){ 25 | $this->record->password = Hash::make($data['password']); 26 | $this->record->save(); 27 | } 28 | 29 | Notification::make() 30 | ->title('Password updated successfully') 31 | ->success(); 32 | }) 33 | ->form([ 34 | TextInput::make('password') 35 | ->label('New password') 36 | ->password() 37 | ->confirmed(), 38 | TextInput::make('password_confirmation') 39 | ->label('Confirm new password') 40 | ->password() 41 | ]), 42 | // Actions\DeleteAction::make(), 43 | ]; 44 | } 45 | 46 | protected function handleRecordUpdate(Model $record, array $data): Model 47 | { 48 | /* 49 | * Remove this logic in production 50 | */ 51 | if($record->id != 1){ 52 | $record->update($data); 53 | } 54 | 55 | return $record; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/Filament/Resources/UserResource/Pages/ListUsers.php: -------------------------------------------------------------------------------- 1 | count() 21 | ) 22 | ->description('This month') 23 | ->chart([2, 4, 5, 7, 9, 90, 4, 5, 7]), 24 | Stat::make('Deals Won', 25 | Deal::where('status', 2) 26 | ->count() 27 | ) 28 | ->description('This month'), 29 | Stat::make('Total revenue', Money::USD(Deal::query()->sum('estimated_revenue'), true)), 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | 'throttle:api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | ]; 47 | 48 | /** 49 | * The application's route middleware. 50 | * 51 | * These middleware may be assigned to groups or used individually. 52 | * 53 | * @var array 54 | */ 55 | protected $routeMiddleware = [ 56 | 'auth' => \App\Http\Middleware\Authenticate::class, 57 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 58 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 63 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 64 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 65 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 66 | ]; 67 | } 68 | -------------------------------------------------------------------------------- /app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /app/Listeners/RollupTotalSalesForCustomer.php: -------------------------------------------------------------------------------- 1 | deal->customer_id); 50 | $customer->total_sales = Deal::where('customer_id', $customer->id) 51 | ->sum('actual_revenue'); 52 | 53 | $customer->save(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/Models/Account.php: -------------------------------------------------------------------------------- 1 | hasMany(Contact::class, 'account_id'); 19 | } 20 | 21 | public function leads() 22 | { 23 | return $this->hasMany(Lead::class, 'customer_id'); 24 | } 25 | 26 | public function deals() 27 | { 28 | return $this->hasMany(Deal::class, 'customer_id'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Models/Contact.php: -------------------------------------------------------------------------------- 1 | belongsTo(Account::class); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/Models/Deal.php: -------------------------------------------------------------------------------- 1 | DealStatus::class 21 | ]; 22 | 23 | public function customer() 24 | { 25 | return $this->belongsTo(Account::class, 'customer_id'); 26 | } 27 | 28 | /** 29 | * Get the products added for the deal 30 | */ 31 | public function products() 32 | { 33 | return $this->hasMany(DealProduct::class, 'deal_id'); 34 | } 35 | 36 | public function closeAsWon() 37 | { 38 | $this->status = 2; 39 | $this->date_won = now(); 40 | $this->save(); 41 | 42 | DealQualified::dispatch($this); 43 | } 44 | 45 | public function closeAsLost() 46 | { 47 | $this->status = 3; 48 | $this->date_lost = now(); 49 | $this->save(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/Models/DealProduct.php: -------------------------------------------------------------------------------- 1 | belongsTo(Product::class, 'product_id'); 22 | } 23 | 24 | /** 25 | * Get the deal 26 | */ 27 | public function deal() 28 | { 29 | return $this->belongsTo(Deal::class, 'deal_id'); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/Models/Lead.php: -------------------------------------------------------------------------------- 1 | LeadStatus::class 20 | ]; 21 | 22 | public function customer() 23 | { 24 | return $this->belongsTo(Account::class, 'customer_id'); 25 | } 26 | 27 | public function qualify(): Deal 28 | { 29 | // Create Deal 30 | $deal = Deal::create([ 31 | 'lead_id' => $this->id, 32 | 'title' => $this->title, 33 | 'customer_id' => $this->customer_id, 34 | 'estimated_revenue' => $this->estimated_revenue 35 | ]); 36 | 37 | $this->status = LeadStatus::Qualified->value; 38 | $this->date_qualified = now(); 39 | $this->update(); 40 | 41 | return $deal; 42 | } 43 | 44 | public function disqualify(?int $reason, ?string $description): void 45 | { 46 | $this->status = LeadStatus::Disqualified->value; 47 | $this->date_disqualified = now(); 48 | $this->disqualification_reason = $reason; 49 | $this->disqualification_description = $description; 50 | $this->update(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Models/Product.php: -------------------------------------------------------------------------------- 1 | ProductType::class 19 | ]; 20 | } 21 | -------------------------------------------------------------------------------- /app/Models/User.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | protected $fillable = [ 24 | 'name', 25 | 'email', 26 | 'password', 27 | ]; 28 | 29 | /** 30 | * The attributes that should be hidden for serialization. 31 | * 32 | * @var array 33 | */ 34 | protected $hidden = [ 35 | 'password', 36 | 'remember_token', 37 | ]; 38 | 39 | /** 40 | * The attributes that should be cast. 41 | * 42 | * @var array 43 | */ 44 | protected $casts = [ 45 | 'email_verified_at' => 'datetime', 46 | ]; 47 | 48 | public function canAccessPanel(Panel $panel): bool 49 | { 50 | return $this->email == "admin@tinycrm.com"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Observers/DealProductObserver.php: -------------------------------------------------------------------------------- 1 | calculateRevenue($dealProduct); 26 | } 27 | 28 | /** 29 | * Handle the DealProduct "deleted" event. 30 | * 31 | * @param \App\Models\DealProduct $dealProduct 32 | * @return void 33 | */ 34 | public function deleted(DealProduct $dealProduct) 35 | { 36 | $this->calculateRevenue($dealProduct); 37 | } 38 | 39 | private function calculateRevenue(DealProduct $dealProduct) 40 | { 41 | $amount = DealProduct::where('deal_id', $dealProduct->deal_id) 42 | ->sum('total_amount'); 43 | 44 | $deal = Deal::find($dealProduct->deal_id); 45 | $deal->actual_revenue = $amount; 46 | $deal->update(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 20 | */ 21 | protected $listen = [ 22 | Registered::class => [ 23 | SendEmailVerificationNotification::class, 24 | ], 25 | DealQualified::class => [ 26 | RollupTotalSalesForCustomer::class 27 | ] 28 | ]; 29 | 30 | /** 31 | * The model observers in the application. 32 | * 33 | * @var array 34 | */ 35 | protected $observers = [ 36 | DealProduct::class => [DealProductObserver::class], 37 | ]; 38 | 39 | /** 40 | * Register any events for your application. 41 | * 42 | * @return void 43 | */ 44 | public function boot() 45 | { 46 | // 47 | } 48 | 49 | /** 50 | * Determine if events and listeners should be automatically discovered. 51 | * 52 | * @return bool 53 | */ 54 | public function shouldDiscoverEvents() 55 | { 56 | return false; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/Providers/Filament/AppPanelProvider.php: -------------------------------------------------------------------------------- 1 | default() 26 | ->id('app') 27 | ->path('app') 28 | ->login() 29 | ->colors([ 30 | 'primary' => Color::Yellow, 31 | ]) 32 | ->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources') 33 | ->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages') 34 | ->pages([ 35 | Dashboard::class, 36 | ]) 37 | ->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets') 38 | ->widgets([ 39 | // 40 | ]) 41 | ->middleware([ 42 | EncryptCookies::class, 43 | AddQueuedCookiesToResponse::class, 44 | StartSession::class, 45 | AuthenticateSession::class, 46 | ShareErrorsFromSession::class, 47 | VerifyCsrfToken::class, 48 | SubstituteBindings::class, 49 | DisableBladeIconComponents::class, 50 | DispatchServingFilamentEvent::class, 51 | ]) 52 | ->authMiddleware([ 53 | Authenticate::class, 54 | ]); 55 | } 56 | } -------------------------------------------------------------------------------- /app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | 55 | return $app; 56 | -------------------------------------------------------------------------------- /bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": [ 6 | "framework", 7 | "laravel" 8 | ], 9 | "license": "MIT", 10 | "require": { 11 | "php": "^8.1|^8.2", 12 | "akaunting/laravel-money": "^5.1", 13 | "filament/filament": "^3.1", 14 | "flowframe/laravel-trend": "^0.1.1", 15 | "guzzlehttp/guzzle": "^7.2", 16 | "laravel/framework": "^10.8", 17 | "laravel/sanctum": "^3.2", 18 | "laravel/tinker": "^2.8" 19 | }, 20 | "require-dev": { 21 | "barryvdh/laravel-debugbar": "^3.13", 22 | "fakerphp/faker": "^1.9.1", 23 | "filament/upgrade": "^3.1", 24 | "laravel/pint": "^1.0", 25 | "laravel/sail": "^1.18", 26 | "mockery/mockery": "^1.4.4", 27 | "nunomaduro/collision": "^7.0", 28 | "pestphp/pest": "^2.11", 29 | "pestphp/pest-plugin-laravel": "^2.1", 30 | "pestphp/pest-plugin-livewire": "^2.1", 31 | "phpunit/phpunit": "^10.1", 32 | "spatie/laravel-ignition": "^2.0" 33 | }, 34 | "autoload": { 35 | "psr-4": { 36 | "App\\": "app/", 37 | "Database\\Factories\\": "database/factories/", 38 | "Database\\Seeders\\": "database/seeders/" 39 | } 40 | }, 41 | "autoload-dev": { 42 | "psr-4": { 43 | "Tests\\": "tests/" 44 | } 45 | }, 46 | "scripts": { 47 | "post-autoload-dump": [ 48 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 49 | "@php artisan package:discover --ansi" 50 | ], 51 | "post-update-cmd": [ 52 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 53 | ], 54 | "post-root-package-install": [ 55 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 56 | ], 57 | "post-create-project-cmd": [ 58 | "@php artisan key:generate --ansi" 59 | ] 60 | }, 61 | "extra": { 62 | "laravel": { 63 | "dont-discover": [] 64 | } 65 | }, 66 | "config": { 67 | "optimize-autoloader": true, 68 | "preferred-install": "dist", 69 | "sort-packages": true, 70 | "allow-plugins": { 71 | "pestphp/pest-plugin": true 72 | } 73 | }, 74 | "minimum-stability": "stable", 75 | "prefer-stable": true 76 | } 77 | -------------------------------------------------------------------------------- /config/auth.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'guard' => 'web', 18 | 'passwords' => 'users', 19 | ], 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Authentication Guards 24 | |-------------------------------------------------------------------------- 25 | | 26 | | Next, you may define every authentication guard for your application. 27 | | Of course, a great default configuration has been defined for you 28 | | here which uses session storage and the Eloquent user provider. 29 | | 30 | | All authentication drivers have a user provider. This defines how the 31 | | users are actually retrieved out of your database or other storage 32 | | mechanisms used by this application to persist your user's data. 33 | | 34 | | Supported: "session" 35 | | 36 | */ 37 | 38 | 'guards' => [ 39 | 'web' => [ 40 | 'driver' => 'session', 41 | 'provider' => 'users', 42 | ], 43 | ], 44 | 45 | /* 46 | |-------------------------------------------------------------------------- 47 | | User Providers 48 | |-------------------------------------------------------------------------- 49 | | 50 | | All authentication drivers have a user provider. This defines how the 51 | | users are actually retrieved out of your database or other storage 52 | | mechanisms used by this application to persist your user's data. 53 | | 54 | | If you have multiple user tables or models you may configure multiple 55 | | sources which represent each model / table. These sources may then 56 | | be assigned to any extra authentication guards you have defined. 57 | | 58 | | Supported: "database", "eloquent" 59 | | 60 | */ 61 | 62 | 'providers' => [ 63 | 'users' => [ 64 | 'driver' => 'eloquent', 65 | 'model' => App\Models\User::class, 66 | ], 67 | 68 | // 'users' => [ 69 | // 'driver' => 'database', 70 | // 'table' => 'users', 71 | // ], 72 | ], 73 | 74 | /* 75 | |-------------------------------------------------------------------------- 76 | | Resetting Passwords 77 | |-------------------------------------------------------------------------- 78 | | 79 | | You may specify multiple password reset configurations if you have more 80 | | than one user table or model in the application and you want to have 81 | | separate password reset settings based on the specific user types. 82 | | 83 | | The expire time is the number of minutes that each reset token will be 84 | | considered valid. This security feature keeps tokens short-lived so 85 | | they have less time to be guessed. You may change this as needed. 86 | | 87 | */ 88 | 89 | 'passwords' => [ 90 | 'users' => [ 91 | 'provider' => 'users', 92 | 'table' => 'password_resets', 93 | 'expire' => 60, 94 | 'throttle' => 60, 95 | ], 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Password Confirmation Timeout 101 | |-------------------------------------------------------------------------- 102 | | 103 | | Here you may define the amount of seconds before a password confirmation 104 | | times out and the user is prompted to re-enter their password via the 105 | | confirmation screen. By default, the timeout lasts for three hours. 106 | | 107 | */ 108 | 109 | 'password_timeout' => 10800, 110 | 111 | ]; 112 | -------------------------------------------------------------------------------- /config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /config/cache.php: -------------------------------------------------------------------------------- 1 | env('CACHE_DRIVER', 'file'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Cache Stores 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the cache "stores" for your application as 26 | | well as their drivers. You may even define multiple stores for the 27 | | same cache driver to group types of items stored in your caches. 28 | | 29 | | Supported drivers: "apc", "array", "database", "file", 30 | | "memcached", "redis", "dynamodb", "octane", "null" 31 | | 32 | */ 33 | 34 | 'stores' => [ 35 | 36 | 'apc' => [ 37 | 'driver' => 'apc', 38 | ], 39 | 40 | 'array' => [ 41 | 'driver' => 'array', 42 | 'serialize' => false, 43 | ], 44 | 45 | 'database' => [ 46 | 'driver' => 'database', 47 | 'table' => 'cache', 48 | 'connection' => null, 49 | 'lock_connection' => null, 50 | ], 51 | 52 | 'file' => [ 53 | 'driver' => 'file', 54 | 'path' => storage_path('framework/cache/data'), 55 | ], 56 | 57 | 'memcached' => [ 58 | 'driver' => 'memcached', 59 | 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), 60 | 'sasl' => [ 61 | env('MEMCACHED_USERNAME'), 62 | env('MEMCACHED_PASSWORD'), 63 | ], 64 | 'options' => [ 65 | // Memcached::OPT_CONNECT_TIMEOUT => 2000, 66 | ], 67 | 'servers' => [ 68 | [ 69 | 'host' => env('MEMCACHED_HOST', '127.0.0.1'), 70 | 'port' => env('MEMCACHED_PORT', 11211), 71 | 'weight' => 100, 72 | ], 73 | ], 74 | ], 75 | 76 | 'redis' => [ 77 | 'driver' => 'redis', 78 | 'connection' => 'cache', 79 | 'lock_connection' => 'default', 80 | ], 81 | 82 | 'dynamodb' => [ 83 | 'driver' => 'dynamodb', 84 | 'key' => env('AWS_ACCESS_KEY_ID'), 85 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 86 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 87 | 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 88 | 'endpoint' => env('DYNAMODB_ENDPOINT'), 89 | ], 90 | 91 | 'octane' => [ 92 | 'driver' => 'octane', 93 | ], 94 | 95 | ], 96 | 97 | /* 98 | |-------------------------------------------------------------------------- 99 | | Cache Key Prefix 100 | |-------------------------------------------------------------------------- 101 | | 102 | | When utilizing the APC, database, memcached, Redis, or DynamoDB cache 103 | | stores there might be other applications using the same cache. For 104 | | that reason, you may prefix every cache key to avoid collisions. 105 | | 106 | */ 107 | 108 | 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), 109 | 110 | ]; 111 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/database.php: -------------------------------------------------------------------------------- 1 | env('DB_CONNECTION', 'mysql'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Database Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here are each of the database connections setup for your application. 26 | | Of course, examples of configuring each database platform that is 27 | | supported by Laravel is shown below to make development simple. 28 | | 29 | | 30 | | All database work in Laravel is done through the PHP PDO facilities 31 | | so make sure you have the driver for your particular database of 32 | | choice installed on your machine before you begin development. 33 | | 34 | */ 35 | 36 | 'connections' => [ 37 | 38 | 'sqlite' => [ 39 | 'driver' => 'sqlite', 40 | 'url' => env('DATABASE_URL'), 41 | 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 | 'prefix' => '', 43 | 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 | ], 45 | 46 | 'mysql' => [ 47 | 'driver' => 'mysql', 48 | 'url' => env('DATABASE_URL'), 49 | 'host' => env('DB_HOST', '127.0.0.1'), 50 | 'port' => env('DB_PORT', '3306'), 51 | 'database' => env('DB_DATABASE', 'forge'), 52 | 'username' => env('DB_USERNAME', 'forge'), 53 | 'password' => env('DB_PASSWORD', ''), 54 | 'unix_socket' => env('DB_SOCKET', ''), 55 | 'charset' => 'utf8mb4', 56 | 'collation' => 'utf8mb4_unicode_ci', 57 | 'prefix' => '', 58 | 'prefix_indexes' => true, 59 | 'strict' => true, 60 | 'engine' => null, 61 | 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 | PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 | ]) : [], 64 | ], 65 | 66 | 'pgsql' => [ 67 | 'driver' => 'pgsql', 68 | 'url' => env('DATABASE_URL'), 69 | 'host' => env('DB_HOST', '127.0.0.1'), 70 | 'port' => env('DB_PORT', '5432'), 71 | 'database' => env('DB_DATABASE', 'forge'), 72 | 'username' => env('DB_USERNAME', 'forge'), 73 | 'password' => env('DB_PASSWORD', ''), 74 | 'charset' => 'utf8', 75 | 'prefix' => '', 76 | 'prefix_indexes' => true, 77 | 'search_path' => 'public', 78 | 'sslmode' => 'prefer', 79 | ], 80 | 81 | 'sqlsrv' => [ 82 | 'driver' => 'sqlsrv', 83 | 'url' => env('DATABASE_URL'), 84 | 'host' => env('DB_HOST', 'localhost'), 85 | 'port' => env('DB_PORT', '1433'), 86 | 'database' => env('DB_DATABASE', 'forge'), 87 | 'username' => env('DB_USERNAME', 'forge'), 88 | 'password' => env('DB_PASSWORD', ''), 89 | 'charset' => 'utf8', 90 | 'prefix' => '', 91 | 'prefix_indexes' => true, 92 | // 'encrypt' => env('DB_ENCRYPT', 'yes'), 93 | // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 94 | ], 95 | 96 | ], 97 | 98 | /* 99 | |-------------------------------------------------------------------------- 100 | | Migration Repository Table 101 | |-------------------------------------------------------------------------- 102 | | 103 | | This table keeps track of all the migrations that have already run for 104 | | your application. Using this information, we can determine which of 105 | | the migrations on disk haven't actually been run in the database. 106 | | 107 | */ 108 | 109 | 'migrations' => 'migrations', 110 | 111 | /* 112 | |-------------------------------------------------------------------------- 113 | | Redis Databases 114 | |-------------------------------------------------------------------------- 115 | | 116 | | Redis is an open source, fast, and advanced key-value store that also 117 | | provides a richer body of commands than a typical key-value system 118 | | such as APC or Memcached. Laravel makes it easy to dig right in. 119 | | 120 | */ 121 | 122 | 'redis' => [ 123 | 124 | 'client' => env('REDIS_CLIENT', 'phpredis'), 125 | 126 | 'options' => [ 127 | 'cluster' => env('REDIS_CLUSTER', 'redis'), 128 | 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), 129 | ], 130 | 131 | 'default' => [ 132 | 'url' => env('REDIS_URL'), 133 | 'host' => env('REDIS_HOST', '127.0.0.1'), 134 | 'username' => env('REDIS_USERNAME'), 135 | 'password' => env('REDIS_PASSWORD'), 136 | 'port' => env('REDIS_PORT', '6379'), 137 | 'database' => env('REDIS_DB', '0'), 138 | ], 139 | 140 | 'cache' => [ 141 | 'url' => env('REDIS_URL'), 142 | 'host' => env('REDIS_HOST', '127.0.0.1'), 143 | 'username' => env('REDIS_USERNAME'), 144 | 'password' => env('REDIS_PASSWORD'), 145 | 'port' => env('REDIS_PORT', '6379'), 146 | 'database' => env('REDIS_CACHE_DB', '1'), 147 | ], 148 | 149 | ], 150 | 151 | ]; 152 | -------------------------------------------------------------------------------- /config/filament.php: -------------------------------------------------------------------------------- 1 | [ 18 | 19 | // 'echo' => [ 20 | // 'broadcaster' => 'pusher', 21 | // 'key' => env('VITE_PUSHER_APP_KEY'), 22 | // 'cluster' => env('VITE_PUSHER_APP_CLUSTER'), 23 | // 'forceTLS' => true, 24 | // ], 25 | 26 | ], 27 | 28 | /* 29 | |-------------------------------------------------------------------------- 30 | | Default Filesystem Disk 31 | |-------------------------------------------------------------------------- 32 | | 33 | | This is the storage disk Filament will use to put media. You may use any 34 | | of the disks defined in the `config/filesystems.php`. 35 | | 36 | */ 37 | 38 | 'default_filesystem_disk' => env('FILAMENT_FILESYSTEM_DISK', 'public'), 39 | 40 | ]; -------------------------------------------------------------------------------- /config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /config/logging.php: -------------------------------------------------------------------------------- 1 | env('LOG_CHANNEL', 'stack'), 21 | 22 | /* 23 | |-------------------------------------------------------------------------- 24 | | Deprecations Log Channel 25 | |-------------------------------------------------------------------------- 26 | | 27 | | This option controls the log channel that should be used to log warnings 28 | | regarding deprecated PHP and library features. This allows you to get 29 | | your application ready for upcoming major versions of dependencies. 30 | | 31 | */ 32 | 33 | 'deprecations' => [ 34 | 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), 35 | 'trace' => false, 36 | ], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Log Channels 41 | |-------------------------------------------------------------------------- 42 | | 43 | | Here you may configure the log channels for your application. Out of 44 | | the box, Laravel uses the Monolog PHP logging library. This gives 45 | | you a variety of powerful log handlers / formatters to utilize. 46 | | 47 | | Available Drivers: "single", "daily", "slack", "syslog", 48 | | "errorlog", "monolog", 49 | | "custom", "stack" 50 | | 51 | */ 52 | 53 | 'channels' => [ 54 | 'stack' => [ 55 | 'driver' => 'stack', 56 | 'channels' => ['single'], 57 | 'ignore_exceptions' => false, 58 | ], 59 | 60 | 'single' => [ 61 | 'driver' => 'single', 62 | 'path' => storage_path('logs/laravel.log'), 63 | 'level' => env('LOG_LEVEL', 'debug'), 64 | ], 65 | 66 | 'daily' => [ 67 | 'driver' => 'daily', 68 | 'path' => storage_path('logs/laravel.log'), 69 | 'level' => env('LOG_LEVEL', 'debug'), 70 | 'days' => 14, 71 | ], 72 | 73 | 'slack' => [ 74 | 'driver' => 'slack', 75 | 'url' => env('LOG_SLACK_WEBHOOK_URL'), 76 | 'username' => 'Laravel Log', 77 | 'emoji' => ':boom:', 78 | 'level' => env('LOG_LEVEL', 'critical'), 79 | ], 80 | 81 | 'papertrail' => [ 82 | 'driver' => 'monolog', 83 | 'level' => env('LOG_LEVEL', 'debug'), 84 | 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), 85 | 'handler_with' => [ 86 | 'host' => env('PAPERTRAIL_URL'), 87 | 'port' => env('PAPERTRAIL_PORT'), 88 | 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), 89 | ], 90 | ], 91 | 92 | 'stderr' => [ 93 | 'driver' => 'monolog', 94 | 'level' => env('LOG_LEVEL', 'debug'), 95 | 'handler' => StreamHandler::class, 96 | 'formatter' => env('LOG_STDERR_FORMATTER'), 97 | 'with' => [ 98 | 'stream' => 'php://stderr', 99 | ], 100 | ], 101 | 102 | 'syslog' => [ 103 | 'driver' => 'syslog', 104 | 'level' => env('LOG_LEVEL', 'debug'), 105 | ], 106 | 107 | 'errorlog' => [ 108 | 'driver' => 'errorlog', 109 | 'level' => env('LOG_LEVEL', 'debug'), 110 | ], 111 | 112 | 'null' => [ 113 | 'driver' => 'monolog', 114 | 'handler' => NullHandler::class, 115 | ], 116 | 117 | 'emergency' => [ 118 | 'path' => storage_path('logs/laravel.log'), 119 | ], 120 | ], 121 | 122 | ]; 123 | -------------------------------------------------------------------------------- /config/mail.php: -------------------------------------------------------------------------------- 1 | env('MAIL_MAILER', 'smtp'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Mailer Configurations 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure all of the mailers used by your application plus 24 | | their respective settings. Several examples have been configured for 25 | | you and you are free to add your own as your application requires. 26 | | 27 | | Laravel supports a variety of mail "transport" drivers to be used while 28 | | sending an e-mail. You will specify which one you are using for your 29 | | mailers below. You are free to add additional mailers as required. 30 | | 31 | | Supported: "smtp", "sendmail", "mailgun", "ses", 32 | | "postmark", "log", "array", "failover" 33 | | 34 | */ 35 | 36 | 'mailers' => [ 37 | 'smtp' => [ 38 | 'transport' => 'smtp', 39 | 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 40 | 'port' => env('MAIL_PORT', 587), 41 | 'encryption' => env('MAIL_ENCRYPTION', 'tls'), 42 | 'username' => env('MAIL_USERNAME'), 43 | 'password' => env('MAIL_PASSWORD'), 44 | 'timeout' => null, 45 | 'local_domain' => env('MAIL_EHLO_DOMAIN'), 46 | ], 47 | 48 | 'ses' => [ 49 | 'transport' => 'ses', 50 | ], 51 | 52 | 'mailgun' => [ 53 | 'transport' => 'mailgun', 54 | ], 55 | 56 | 'postmark' => [ 57 | 'transport' => 'postmark', 58 | ], 59 | 60 | 'sendmail' => [ 61 | 'transport' => 'sendmail', 62 | 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), 63 | ], 64 | 65 | 'log' => [ 66 | 'transport' => 'log', 67 | 'channel' => env('MAIL_LOG_CHANNEL'), 68 | ], 69 | 70 | 'array' => [ 71 | 'transport' => 'array', 72 | ], 73 | 74 | 'failover' => [ 75 | 'transport' => 'failover', 76 | 'mailers' => [ 77 | 'smtp', 78 | 'log', 79 | ], 80 | ], 81 | ], 82 | 83 | /* 84 | |-------------------------------------------------------------------------- 85 | | Global "From" Address 86 | |-------------------------------------------------------------------------- 87 | | 88 | | You may wish for all e-mails sent by your application to be sent from 89 | | the same address. Here, you may specify a name and address that is 90 | | used globally for all e-mails that are sent by your application. 91 | | 92 | */ 93 | 94 | 'from' => [ 95 | 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), 96 | 'name' => env('MAIL_FROM_NAME', 'Example'), 97 | ], 98 | 99 | /* 100 | |-------------------------------------------------------------------------- 101 | | Markdown Mail Settings 102 | |-------------------------------------------------------------------------- 103 | | 104 | | If you are using Markdown based email rendering, you may configure your 105 | | theme and component paths here, allowing you to customize the design 106 | | of the emails. Or, you may simply stick with the Laravel defaults! 107 | | 108 | */ 109 | 110 | 'markdown' => [ 111 | 'theme' => 'default', 112 | 113 | 'paths' => [ 114 | resource_path('views/vendor/mail'), 115 | ], 116 | ], 117 | 118 | ]; 119 | -------------------------------------------------------------------------------- /config/queue.php: -------------------------------------------------------------------------------- 1 | env('QUEUE_CONNECTION', 'sync'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Queue Connections 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure the connection information for each server that 24 | | is used by your application. A default configuration has been added 25 | | for each back-end shipped with Laravel. You are free to add more. 26 | | 27 | | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'sync' => [ 34 | 'driver' => 'sync', 35 | ], 36 | 37 | 'database' => [ 38 | 'driver' => 'database', 39 | 'table' => 'jobs', 40 | 'queue' => 'default', 41 | 'retry_after' => 90, 42 | 'after_commit' => false, 43 | ], 44 | 45 | 'beanstalkd' => [ 46 | 'driver' => 'beanstalkd', 47 | 'host' => 'localhost', 48 | 'queue' => 'default', 49 | 'retry_after' => 90, 50 | 'block_for' => 0, 51 | 'after_commit' => false, 52 | ], 53 | 54 | 'sqs' => [ 55 | 'driver' => 'sqs', 56 | 'key' => env('AWS_ACCESS_KEY_ID'), 57 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 58 | 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), 59 | 'queue' => env('SQS_QUEUE', 'default'), 60 | 'suffix' => env('SQS_SUFFIX'), 61 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 62 | 'after_commit' => false, 63 | ], 64 | 65 | 'redis' => [ 66 | 'driver' => 'redis', 67 | 'connection' => 'default', 68 | 'queue' => env('REDIS_QUEUE', 'default'), 69 | 'retry_after' => 90, 70 | 'block_for' => null, 71 | 'after_commit' => false, 72 | ], 73 | 74 | ], 75 | 76 | /* 77 | |-------------------------------------------------------------------------- 78 | | Failed Queue Jobs 79 | |-------------------------------------------------------------------------- 80 | | 81 | | These options configure the behavior of failed queue job logging so you 82 | | can control which database and table are used to store the jobs that 83 | | have failed. You may change them to any database / table you wish. 84 | | 85 | */ 86 | 87 | 'failed' => [ 88 | 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 89 | 'database' => env('DB_CONNECTION', 'mysql'), 90 | 'table' => 'failed_jobs', 91 | ], 92 | 93 | ]; 94 | -------------------------------------------------------------------------------- /config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /database/factories/AccountFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class AccountFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition() 18 | { 19 | return [ 20 | 'name' => fake()->company(), 21 | 'email' => fake()->safeEmail(), 22 | 23 | // added en_IN locale to avoid brackets in phone number 24 | 'phone' => fake('en_IN')->phoneNumber(), 25 | 'address' => fake()->address(), 26 | 'total_sales' => fake()->numberBetween(0, 1000000) 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /database/factories/ContactFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class ContactFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition() 18 | { 19 | return [ 20 | 'name' => fake()->name(), 21 | 'email' => fake()->safeEmail(), 22 | 23 | // added en_IN locale to avoid brackets in phone number 24 | 'phone' => fake('en_IN')->phoneNumber() 25 | ]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /database/factories/DealFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class DealFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition() 18 | { 19 | return [ 20 | 'title' => fake()->sentence(fake()->numberBetween(2, 4)), 21 | 'customer_id' => fake()->numberBetween(1, 25), 22 | 'estimated_revenue' => fake()->numberBetween(10000, 100000), 23 | 'actual_revenue' => fake()->numberBetween(10000, 100000), 24 | 'status' => fake()->numberBetween(1, 3) 25 | ]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /database/factories/DealProductFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class DealProductFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition() 18 | { 19 | return [ 20 | 'product_id' => fake()->numberBetween(1, 10), 21 | 'quantity' => fake()->numberBetween(1, 100), 22 | 'price_per_unit' => fake()->numberBetween(500, 5000), 23 | 'total_amount' => fake()->numberBetween(500, 5000) 24 | ]; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /database/factories/LeadFactory.php: -------------------------------------------------------------------------------- 1 | 9 | */ 10 | class LeadFactory extends Factory 11 | { 12 | /** 13 | * Define the model's default state. 14 | * 15 | * @return array 16 | */ 17 | public function definition() 18 | { 19 | return [ 20 | 'title' => fake()->sentence(fake()->numberBetween(2, 4)), 21 | 'customer_id' => fake()->numberBetween(1, 25), 22 | 'source' => fake()->numberBetween(1, 5), 23 | 'estimated_revenue' => fake()->numberBetween(10000, 100000), 24 | 'description' => fake()->realText(200), 25 | 'status' => fake()->numberBetween(1, 4), 26 | 'created_at' => fake()->dateTimeBetween('-1 years') 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /database/factories/ProductFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class ProductFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->sentence(rand(2, 3)), 22 | 'product_id' => 'PRO-' . strtoupper(Str::random(8)), 23 | 'type' => rand(1, 2), 24 | 'price' => fake()->numberBetween(500, 5000), 25 | 'is_available' => fake()->boolean(90) 26 | ]; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->unique()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | } 28 | 29 | /** 30 | * Indicate that the model's email address should be unverified. 31 | * 32 | * @return static 33 | */ 34 | public function unverified() 35 | { 36 | return $this->state(fn (array $attributes) => [ 37 | 'email_verified_at' => null, 38 | ]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->primary(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamp('expires_at')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('personal_access_tokens'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /database/migrations/2023_02_06_054404_create_accounts_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('phone')->nullable(); 20 | $table->string('email')->nullable(); 21 | $table->text('address')->nullable(); 22 | $table->float('total_sales')->nullable()->default(0); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('accounts'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2023_02_06_094446_create_contacts_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email'); 20 | $table->string('phone')->nullable(); 21 | $table->unsignedBigInteger('account_id')->nullable(); 22 | $table->timestamps(); 23 | 24 | $table->foreign('account_id')->references('id')->on('accounts')->nullOnDelete(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('contacts'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /database/migrations/2023_02_06_113654_add_primary_contact_field_to_account.php: -------------------------------------------------------------------------------- 1 | unsignedBigInteger('primary_contact_id')->nullable(); 18 | $table->foreign('primary_contact_id')->references('id')->on('contacts'); 19 | }); 20 | } 21 | 22 | /** 23 | * Reverse the migrations. 24 | * 25 | * @return void 26 | */ 27 | public function down() 28 | { 29 | Schema::table('accounts', function (Blueprint $table) { 30 | $table->dropColumn('primary_contact_id'); 31 | }); 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /database/migrations/2023_02_06_120837_create_leads_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('title'); 19 | $table->unsignedBigInteger('customer_id')->nullable(); 20 | $table->integer('source')->nullable(); 21 | $table->double('estimated_revenue', 15, 2)->nullable(); 22 | $table->text('description')->nullable(); 23 | $table->integer('status')->default(1); // Prospect 24 | $table->integer('disqualification_reason')->nullable(); 25 | $table->text('disqualification_description')->nullable(); 26 | $table->dateTime('date_disqualified')->nullable(); 27 | $table->dateTime('date_qualified')->nullable(); 28 | $table->timestamps(); 29 | 30 | $table->foreign('customer_id')->references('id')->on('accounts')->nullOnDelete(); 31 | 32 | $table->index(['status', 'customer_id']); 33 | }); 34 | } 35 | 36 | /** 37 | * Reverse the migrations. 38 | * 39 | * @return void 40 | */ 41 | public function down() 42 | { 43 | Schema::dropIfExists('leads'); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /database/migrations/2023_02_07_115224_create_deals_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('title'); 19 | $table->unsignedBigInteger('customer_id')->nullable(); 20 | $table->unsignedBigInteger('lead_id')->nullable(); 21 | $table->double('estimated_revenue', 15, 2)->nullable(); 22 | $table->double('actual_revenue', 15, 2)->nullable(); 23 | $table->text('description')->nullable(); 24 | $table->integer('status')->default(1); // Open 25 | $table->dateTime('date_won')->nullable(); 26 | $table->dateTime('date_lost')->nullable(); 27 | $table->timestamps(); 28 | 29 | $table->foreign('customer_id')->references('id')->on('accounts')->nullOnDelete(); 30 | $table->foreign('lead_id')->references('id')->on('leads')->nullOnDelete(); 31 | 32 | $table->index(['status', 'customer_id', 'lead_id']); 33 | }); 34 | } 35 | 36 | /** 37 | * Reverse the migrations. 38 | * 39 | * @return void 40 | */ 41 | public function down() 42 | { 43 | Schema::dropIfExists('deals'); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /database/migrations/2023_02_09_055306_create_products_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('product_id')->unique(); 19 | $table->string('name'); 20 | $table->integer('type'); 21 | $table->double('price', 15, 2); 22 | $table->boolean('is_available')->default(true); 23 | $table->timestamps(); 24 | 25 | $table->index(['product_id', 'name']); 26 | }); 27 | } 28 | 29 | /** 30 | * Reverse the migrations. 31 | * 32 | * @return void 33 | */ 34 | public function down() 35 | { 36 | Schema::dropIfExists('products'); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /database/migrations/2023_02_09_111021_create_deal_products_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->unsignedBigInteger('product_id'); 19 | $table->unsignedBigInteger('deal_id'); 20 | $table->integer('quantity'); 21 | $table->double('price_per_unit', 15, 2); 22 | $table->double('total_amount', 15, 2); 23 | $table->timestamps(); 24 | 25 | $table->foreign('product_id')->references('id')->on('products'); 26 | $table->foreign('deal_id')->references('id')->on('deals'); 27 | }); 28 | } 29 | 30 | /** 31 | * Reverse the migrations. 32 | * 33 | * @return void 34 | */ 35 | public function down() 36 | { 37 | Schema::dropIfExists('deal_products'); 38 | } 39 | }; 40 | -------------------------------------------------------------------------------- /database/migrations/2023_02_13_131939_create_jobs_table.php: -------------------------------------------------------------------------------- 1 | bigIncrements('id'); 18 | $table->string('queue')->index(); 19 | $table->longText('payload'); 20 | $table->unsignedTinyInteger('attempts'); 21 | $table->unsignedInteger('reserved_at')->nullable(); 22 | $table->unsignedInteger('available_at'); 23 | $table->unsignedInteger('created_at'); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /database/migrations/2023_08_05_065301_add_foreign_key_constraint_to_deals_table.php: -------------------------------------------------------------------------------- 1 | dropForeign(['lead_id']); 16 | $table->foreign('lead_id') 17 | ->references('id') 18 | ->on('leads') 19 | ->onDelete('set null'); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | */ 26 | public function down(): void 27 | { 28 | Schema::table('deals', function (Blueprint $table) { 29 | // 30 | }); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | create([ 29 | 'name' => 'Admin', 30 | 'email' => 'admin@tinycrm.com', 31 | 'password' => Hash::make('password'), 32 | 'email_verified_at' => now() 33 | ]); 34 | 35 | // Create additional users 36 | \App\Models\User::factory(10)->create(); 37 | 38 | // Create Account & Contacts 39 | Account::factory(25)->create()->each(function ($account){ 40 | Contact::factory(rand(1, 10))->create([ 41 | 'account_id' => $account->id 42 | ]); 43 | }); 44 | 45 | // Create Products 46 | // Product::factory(25)->create(); 47 | $this->create_products(); 48 | 49 | // Create Leads 50 | Lead::factory(100)->create()->each(function ($lead){ 51 | if($lead->status == LeadStatus::Qualified){ 52 | // Create Deal for this lead 53 | $deal = Deal::create([ 54 | 'title' => $lead->title, 55 | 'customer_id' => $lead->customer_id, 56 | 'lead_id' => $lead->id, 57 | 'estimated_revenue' => $lead->estimated_revenue, 58 | 'status' => rand(1, 3), 59 | 'description' => $lead->description, 60 | 'created_at' => $lead->created_at 61 | ]); 62 | 63 | // Add products to deal 64 | DealProduct::factory(rand(1, 5))->create([ 65 | 'deal_id' => $deal->id 66 | ]); 67 | } 68 | }); 69 | } 70 | 71 | private function create_products() 72 | { 73 | Product::insert([ 74 | [ 75 | 'name' => 'Intel i7 Processors', 76 | 'product_id' => 'PRO-JU89JKEW', 77 | 'type' => 2, 78 | 'price' => 1000, 79 | 'created_at' => now(), 80 | 'updated_at' => now() 81 | ], 82 | [ 83 | 'name' => 'AMD Ryzen 5 5500', 84 | 'product_id' => 'PRO-89JDFEW', 85 | 'type' => 2, 86 | 'price' => 800, 87 | 'created_at' => now(), 88 | 'updated_at' => now() 89 | ], 90 | [ 91 | 'name' => 'Web Development', 92 | 'product_id' => 'PRO-OYT71NM', 93 | 'type' => 1, 94 | 'price' => 50, 95 | 'created_at' => now(), 96 | 'updated_at' => now() 97 | ], 98 | [ 99 | 'name' => 'UI Design', 100 | 'product_id' => 'PRO-HAU6HJAS', 101 | 'type' => 1, 102 | 'price' => 60, 103 | 'created_at' => now(), 104 | 'updated_at' => now() 105 | ], 106 | [ 107 | 'name' => 'Corsair RGB RAM - 8 GB', 108 | 'product_id' => 'PRO-5ODAWSNZ', 109 | 'type' => 2, 110 | 'price' => 29, 111 | 'created_at' => now(), 112 | 'updated_at' => now() 113 | ], 114 | [ 115 | 'name' => 'Consultancy', 116 | 'product_id' => 'PRO-SWA8127J', 117 | 'type' => 1, 118 | 'price' => 100, 119 | 'created_at' => now(), 120 | 'updated_at' => now() 121 | ], 122 | [ 123 | 'name' => 'Dedicated Developer (8 hours/day)', 124 | 'product_id' => 'PRO-OUY13B9S', 125 | 'type' => 1, 126 | 'price' => 80, 127 | 'created_at' => now(), 128 | 'updated_at' => now() 129 | ], 130 | [ 131 | 'name' => 'Dell Keyboards', 132 | 'product_id' => 'PRO-EJM71JUI', 133 | 'type' => 2, 134 | 'price' => 49, 135 | 'created_at' => now(), 136 | 'updated_at' => now() 137 | ], 138 | [ 139 | 'name' => 'Nvidia GeForce - 1060 Ti - 8GB', 140 | 'product_id' => 'PRO-NV812DIQ', 141 | 'type' => 2, 142 | 'price' => 1200, 143 | 'created_at' => now(), 144 | 'updated_at' => now() 145 | ], 146 | [ 147 | 'name' => 'Wordpress Development', 148 | 'product_id' => 'PRO-W412MNAK', 149 | 'type' => 1, 150 | 'price' => 45, 151 | 'created_at' => now(), 152 | 'updated_at' => now() 153 | ] 154 | ]); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "@tailwindcss/forms": "^0.5.3", 9 | "@tailwindcss/typography": "^0.5.9", 10 | "autoprefixer": "^10.4.13", 11 | "axios": "^1.8.2", 12 | "laravel-vite-plugin": "^0.7.2", 13 | "lodash": "^4.17.19", 14 | "postcss": "^8.1.14", 15 | "tailwindcss": "^3.2.4", 16 | "tippy.js": "^6.3.7", 17 | "vite": "^4.1.5" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ./tests/Unit 6 | 7 | 8 | ./tests/Feature 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | ./app 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /public/css/filament/support/support.css: -------------------------------------------------------------------------------- 1 | .fi-pagination-items,.fi-pagination-overview,.fi-pagination-records-per-page-select:not(.fi-compact){display:none}@supports (container-type:inline-size){.fi-pagination{container-type:inline-size}@container (min-width: 28rem){.fi-pagination-records-per-page-select.fi-compact{display:none}.fi-pagination-records-per-page-select:not(.fi-compact){display:inline}}@container (min-width: 56rem){.fi-pagination:not(.fi-simple)>.fi-pagination-previous-btn{display:none}.fi-pagination-overview{display:inline}.fi-pagination:not(.fi-simple)>.fi-pagination-next-btn{display:none}.fi-pagination-items{display:flex}}}@supports not (container-type:inline-size){@media (min-width:640px){.fi-pagination-records-per-page-select.fi-compact{display:none}.fi-pagination-records-per-page-select:not(.fi-compact){display:inline}}@media (min-width:768px){.fi-pagination:not(.fi-simple)>.fi-pagination-previous-btn{display:none}.fi-pagination-overview{display:inline}.fi-pagination:not(.fi-simple)>.fi-pagination-next-btn{display:none}.fi-pagination-items{display:flex}}}.tippy-box[data-animation=fade][data-state=hidden]{opacity:0}[data-tippy-root]{max-width:calc(100vw - 10px)}.tippy-box{background-color:#333;border-radius:4px;color:#fff;font-size:14px;line-height:1.4;outline:0;position:relative;transition-property:transform,visibility,opacity;white-space:normal}.tippy-box[data-placement^=top]>.tippy-arrow{bottom:0}.tippy-box[data-placement^=top]>.tippy-arrow:before{border-top-color:initial;border-width:8px 8px 0;bottom:-7px;left:0;transform-origin:center top}.tippy-box[data-placement^=bottom]>.tippy-arrow{top:0}.tippy-box[data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:initial;border-width:0 8px 8px;left:0;top:-7px;transform-origin:center bottom}.tippy-box[data-placement^=left]>.tippy-arrow{right:0}.tippy-box[data-placement^=left]>.tippy-arrow:before{border-left-color:initial;border-width:8px 0 8px 8px;right:-7px;transform-origin:center left}.tippy-box[data-placement^=right]>.tippy-arrow{left:0}.tippy-box[data-placement^=right]>.tippy-arrow:before{border-right-color:initial;border-width:8px 8px 8px 0;left:-7px;transform-origin:center right}.tippy-box[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-arrow{color:#333;height:16px;width:16px}.tippy-arrow:before{border-color:transparent;border-style:solid;content:"";position:absolute}.tippy-content{padding:5px 9px;position:relative;z-index:1}.tippy-box[data-theme~=light]{background-color:#fff;box-shadow:0 0 20px 4px #9aa1b126,0 4px 80px -8px #24282f40,0 4px 4px -2px #5b5e6926;color:#26323d}.tippy-box[data-theme~=light][data-placement^=top]>.tippy-arrow:before{border-top-color:#fff}.tippy-box[data-theme~=light][data-placement^=bottom]>.tippy-arrow:before{border-bottom-color:#fff}.tippy-box[data-theme~=light][data-placement^=left]>.tippy-arrow:before{border-left-color:#fff}.tippy-box[data-theme~=light][data-placement^=right]>.tippy-arrow:before{border-right-color:#fff}.tippy-box[data-theme~=light]>.tippy-backdrop{background-color:#fff}.tippy-box[data-theme~=light]>.tippy-svg-arrow{fill:#fff}.fi-sortable-ghost{opacity:.3} -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frikishaan/tiny-crm/8986a664faf21333ac5ee91ceb2041a0f2d7c465/public/favicon.ico -------------------------------------------------------------------------------- /public/images/hero-img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frikishaan/tiny-crm/8986a664faf21333ac5ee91ceb2041a0f2d7c465/public/images/hero-img.png -------------------------------------------------------------------------------- /public/images/pipeline-img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frikishaan/tiny-crm/8986a664faf21333ac5ee91ceb2041a0f2d7c465/public/images/pipeline-img.png -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 50 | 51 | $response = $kernel->handle( 52 | $request = Request::capture() 53 | )->send(); 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /public/js/filament/forms/components/key-value.js: -------------------------------------------------------------------------------- 1 | function r({state:i}){return{state:i,rows:[],shouldUpdateRows:!0,init:function(){this.updateRows(),this.rows.length<=0?this.rows.push({key:"",value:""}):this.updateState(),this.$watch("state",(t,e)=>{let s=o=>o===null?0:Array.isArray(o)?o.length:typeof o!="object"?0:Object.keys(o).length;s(t)===0&&s(e)===0||this.updateRows()})},addRow:function(){this.rows.push({key:"",value:""}),this.updateState()},deleteRow:function(t){this.rows.splice(t,1),this.rows.length<=0&&this.addRow(),this.updateState()},reorderRows:function(t){let e=Alpine.raw(this.rows),s=e.splice(t.oldIndex,1)[0];e.splice(t.newIndex,0,s),this.rows=e,this.updateState()},updateRows:function(){if(!this.shouldUpdateRows){this.shouldUpdateRows=!0;return}let t=[];for(let[e,s]of Object.entries(this.state??{}))t.push({key:e,value:s});this.rows=t},updateState:function(){let t={};this.rows.forEach(e=>{e.key===""||e.key===null||(t[e.key]=e.value)}),this.shouldUpdateRows=!1,this.state=t}}}export{r as default}; 2 | -------------------------------------------------------------------------------- /public/js/filament/forms/components/tags-input.js: -------------------------------------------------------------------------------- 1 | function i({state:a,splitKeys:n}){return{newTag:"",state:a,createTag:function(){if(this.newTag=this.newTag.trim(),this.newTag!==""){if(this.state.includes(this.newTag)){this.newTag="";return}this.state.push(this.newTag),this.newTag=""}},deleteTag:function(t){this.state=this.state.filter(e=>e!==t)},reorderTags:function(t){let e=this.state.splice(t.oldIndex,1)[0];this.state.splice(t.newIndex,0,e),this.state=[...this.state]},input:{["x-on:blur"]:"createTag()",["x-model"]:"newTag",["x-on:keydown"](t){["Enter",...n].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this.createTag())},["x-on:paste"](){this.$nextTick(()=>{if(n.length===0){this.createTag();return}let t=n.map(e=>e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")).join("|");this.newTag.split(new RegExp(t,"g")).forEach(e=>{this.newTag=e,this.createTag()})})}}}}export{i as default}; 2 | -------------------------------------------------------------------------------- /public/js/filament/forms/components/textarea.js: -------------------------------------------------------------------------------- 1 | function t({initialHeight:e}){return{init:function(){this.render()},render:function(){this.$el.scrollHeight>0&&(this.$el.style.height=e+"rem",this.$el.style.height=this.$el.scrollHeight+"px")}}}export{t as default}; 2 | -------------------------------------------------------------------------------- /public/js/filament/notifications/notifications.js: -------------------------------------------------------------------------------- 1 | (()=>{var O=Object.create;var $=Object.defineProperty;var V=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,W=Object.prototype.hasOwnProperty;var d=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var j=(i,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Y(t))!W.call(i,n)&&n!==e&&$(i,n,{get:()=>t[n],enumerable:!(s=V(t,n))||s.enumerable});return i};var J=(i,t,e)=>(e=i!=null?O(H(i)):{},j(t||!i||!i.__esModule?$(e,"default",{value:i,enumerable:!0}):e,i));var S=d((ut,_)=>{var v,g=typeof global<"u"&&(global.crypto||global.msCrypto);g&&g.getRandomValues&&(y=new Uint8Array(16),v=function(){return g.getRandomValues(y),y});var y;v||(T=new Array(16),v=function(){for(var i=0,t;i<16;i++)i&3||(t=Math.random()*4294967296),T[i]=t>>>((i&3)<<3)&255;return T});var T;_.exports=v});var C=d((ct,U)=>{var P=[];for(f=0;f<256;++f)P[f]=(f+256).toString(16).substr(1);var f;function K(i,t){var e=t||0,s=P;return s[i[e++]]+s[i[e++]]+s[i[e++]]+s[i[e++]]+"-"+s[i[e++]]+s[i[e++]]+"-"+s[i[e++]]+s[i[e++]]+"-"+s[i[e++]]+s[i[e++]]+"-"+s[i[e++]]+s[i[e++]]+s[i[e++]]+s[i[e++]]+s[i[e++]]+s[i[e++]]}U.exports=K});var R=d((lt,F)=>{var Q=S(),X=C(),a=Q(),Z=[a[0]|1,a[1],a[2],a[3],a[4],a[5]],b=(a[6]<<8|a[7])&16383,D=0,A=0;function tt(i,t,e){var s=t&&e||0,n=t||[];i=i||{};var r=i.clockseq!==void 0?i.clockseq:b,o=i.msecs!==void 0?i.msecs:new Date().getTime(),h=i.nsecs!==void 0?i.nsecs:A+1,l=o-D+(h-A)/1e4;if(l<0&&i.clockseq===void 0&&(r=r+1&16383),(l<0||o>D)&&i.nsecs===void 0&&(h=0),h>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");D=o,A=h,b=r,o+=122192928e5;var c=((o&268435455)*1e4+h)%4294967296;n[s++]=c>>>24&255,n[s++]=c>>>16&255,n[s++]=c>>>8&255,n[s++]=c&255;var u=o/4294967296*1e4&268435455;n[s++]=u>>>8&255,n[s++]=u&255,n[s++]=u>>>24&15|16,n[s++]=u>>>16&255,n[s++]=r>>>8|128,n[s++]=r&255;for(var N=i.node||Z,m=0;m<6;++m)n[s+m]=N[m];return t||X(n)}F.exports=tt});var I=d((dt,G)=>{var it=S(),et=C();function st(i,t,e){var s=t&&e||0;typeof i=="string"&&(t=i=="binary"?new Array(16):null,i=null),i=i||{};var n=i.random||(i.rng||it)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t)for(var r=0;r<16;++r)t[s+r]=n[r];return t||et(n)}G.exports=st});var B=d((ft,z)=>{var nt=R(),M=I(),E=M;E.v1=nt;E.v4=M;z.exports=E});function k(i,t=()=>{}){let e=!1;return function(){e?t.apply(this,arguments):(e=!0,i.apply(this,arguments))}}var q=i=>{i.data("notificationComponent",({notification:t})=>({isShown:!1,computedStyle:null,transitionDuration:null,transitionEasing:null,init:function(){this.computedStyle=window.getComputedStyle(this.$el),this.transitionDuration=parseFloat(this.computedStyle.transitionDuration)*1e3,this.transitionEasing=this.computedStyle.transitionTimingFunction,this.configureTransitions(),this.configureAnimations(),t.duration&&t.duration!=="persistent"&&setTimeout(()=>this.close(),t.duration),this.isShown=!0},configureTransitions:function(){let e=this.computedStyle.display,s=()=>{i.mutateDom(()=>{this.$el.style.setProperty("display",e),this.$el.style.setProperty("visibility","visible")}),this.$el._x_isShown=!0},n=()=>{i.mutateDom(()=>{this.$el._x_isShown?this.$el.style.setProperty("visibility","hidden"):this.$el.style.setProperty("display","none")})},r=k(o=>o?s():n(),o=>{this.$el._x_toggleAndCascadeWithTransitions(this.$el,o,s,n)});i.effect(()=>r(this.isShown))},configureAnimations:function(){let e;Livewire.hook("commit",({component:s,commit:n,succeed:r,fail:o,respond:h})=>{if(!s.snapshot.data.isFilamentNotificationsComponent)return;let l=()=>this.$el.getBoundingClientRect().top,c=l();h(()=>{e=()=>{this.isShown&&this.$el.animate([{transform:`translateY(${c-l()}px)`},{transform:"translateY(0px)"}],{duration:this.transitionDuration,easing:this.transitionEasing})},this.$el.getAnimations().forEach(u=>u.finish())}),r(({snapshot:u,effect:N})=>{e()})})},close:function(){this.isShown=!1,setTimeout(()=>window.dispatchEvent(new CustomEvent("notificationClosed",{detail:{id:t.id}})),this.transitionDuration)},markAsRead:function(){window.dispatchEvent(new CustomEvent("markedNotificationAsRead",{detail:{id:t.id}}))},markAsUnread:function(){window.dispatchEvent(new CustomEvent("markedNotificationAsUnread",{detail:{id:t.id}}))}}))};var L=J(B(),1),p=class{constructor(){return this.id((0,L.v4)()),this}id(t){return this.id=t,this}title(t){return this.title=t,this}body(t){return this.body=t,this}actions(t){return this.actions=t,this}status(t){return this.status=t,this}color(t){return this.color=t,this}icon(t){return this.icon=t,this}iconColor(t){return this.iconColor=t,this}duration(t){return this.duration=t,this}seconds(t){return this.duration(t*1e3),this}persistent(){return this.duration("persistent"),this}danger(){return this.status("danger"),this}info(){return this.status("info"),this}success(){return this.status("success"),this}warning(){return this.status("warning"),this}view(t){return this.view=t,this}viewData(t){return this.viewData=t,this}send(){return window.dispatchEvent(new CustomEvent("notificationSent",{detail:{notification:this}})),this}},w=class{constructor(t){return this.name(t),this}name(t){return this.name=t,this}color(t){return this.color=t,this}dispatch(t,e){return this.event(t),this.eventData(e),this}dispatchSelf(t,e){return this.dispatch(t,e),this.dispatchDirection="self",this}dispatchTo(t,e,s){return this.dispatch(e,s),this.dispatchDirection="to",this.dispatchToComponent=t,this}emit(t,e){return this.dispatch(t,e),this}emitSelf(t,e){return this.dispatchSelf(t,e),this}emitTo(t,e,s){return this.dispatchTo(t,e,s),this}dispatchDirection(t){return this.dispatchDirection=t,this}dispatchToComponent(t){return this.dispatchToComponent=t,this}event(t){return this.event=t,this}eventData(t){return this.eventData=t,this}extraAttributes(t){return this.extraAttributes=t,this}icon(t){return this.icon=t,this}iconPosition(t){return this.iconPosition=t,this}outlined(t=!0){return this.isOutlined=t,this}disabled(t=!0){return this.isDisabled=t,this}label(t){return this.label=t,this}close(t=!0){return this.shouldClose=t,this}openUrlInNewTab(t=!0){return this.shouldOpenUrlInNewTab=t,this}size(t){return this.size=t,this}url(t){return this.url=t,this}view(t){return this.view=t,this}button(){return this.view("filament-notifications::actions.button-action"),this}grouped(){return this.view("filament-notifications::actions.grouped-action"),this}link(){return this.view("filament-notifications::actions.link-action"),this}},x=class{constructor(t){return this.actions(t),this}actions(t){return this.actions=t.map(e=>e.grouped()),this}color(t){return this.color=t,this}icon(t){return this.icon=t,this}iconPosition(t){return this.iconPosition=t,this}label(t){return this.label=t,this}tooltip(t){return this.tooltip=t,this}};window.FilamentNotificationAction=w;window.FilamentNotificationActionGroup=x;window.FilamentNotification=p;document.addEventListener("alpine:init",()=>{window.Alpine.plugin(q)});})(); 2 | -------------------------------------------------------------------------------- /public/js/filament/support/async-alpine.js: -------------------------------------------------------------------------------- 1 | (()=>{(()=>{var d=Object.defineProperty,m=t=>d(t,"__esModule",{value:!0}),f=(t,e)=>{m(t);for(var i in e)d(t,i,{get:e[i],enumerable:!0})},o={};f(o,{eager:()=>g,event:()=>w,idle:()=>y,media:()=>b,visible:()=>E});var c=()=>!0,g=c,v=({component:t,argument:e})=>new Promise(i=>{if(e)window.addEventListener(e,()=>i(),{once:!0});else{let n=a=>{a.detail.id===t.id&&(window.removeEventListener("async-alpine:load",n),i())};window.addEventListener("async-alpine:load",n)}}),w=v,x=()=>new Promise(t=>{"requestIdleCallback"in window?window.requestIdleCallback(t):setTimeout(t,200)}),y=x,A=({argument:t})=>new Promise(e=>{if(!t)return console.log("Async Alpine: media strategy requires a media query. Treating as 'eager'"),e();let i=window.matchMedia(`(${t})`);i.matches?e():i.addEventListener("change",e,{once:!0})}),b=A,$=({component:t,argument:e})=>new Promise(i=>{let n=e||"0px 0px 0px 0px",a=new IntersectionObserver(r=>{r[0].isIntersecting&&(a.disconnect(),i())},{rootMargin:n});a.observe(t.el)}),E=$;function P(t){let e=q(t),i=u(e);return i.type==="method"?{type:"expression",operator:"&&",parameters:[i]}:i}function q(t){let e=/\s*([()])\s*|\s*(\|\||&&|\|)\s*|\s*((?:[^()&|]+\([^()]+\))|[^()&|]+)\s*/g,i=[],n;for(;(n=e.exec(t))!==null;){let[,a,r,s]=n;if(a!==void 0)i.push({type:"parenthesis",value:a});else if(r!==void 0)i.push({type:"operator",value:r==="|"?"&&":r});else{let p={type:"method",method:s.trim()};s.includes("(")&&(p.method=s.substring(0,s.indexOf("(")).trim(),p.argument=s.substring(s.indexOf("(")+1,s.indexOf(")"))),s.method==="immediate"&&(s.method="eager"),i.push(p)}}return i}function u(t){let e=h(t);for(;t.length>0&&(t[0].value==="&&"||t[0].value==="|"||t[0].value==="||");){let i=t.shift().value,n=h(t);e.type==="expression"&&e.operator===i?e.parameters.push(n):e={type:"expression",operator:i,parameters:[e,n]}}return e}function h(t){if(t[0].value==="("){t.shift();let e=u(t);return t[0].value===")"&&t.shift(),e}else return t.shift()}var _="__internal_",l={Alpine:null,_options:{prefix:"ax-",alpinePrefix:"x-",root:"load",inline:"load-src",defaultStrategy:"eager"},_alias:!1,_data:{},_realIndex:0,get _index(){return this._realIndex++},init(t,e={}){return this.Alpine=t,this._options={...this._options,...e},this},start(){return this._processInline(),this._setupComponents(),this._mutations(),this},data(t,e=!1){return this._data[t]={loaded:!1,download:e},this},url(t,e){!t||!e||(this._data[t]||this.data(t),this._data[t].download=()=>import(this._parseUrl(e)))},alias(t){this._alias=t},_processInline(){let t=document.querySelectorAll(`[${this._options.prefix}${this._options.inline}]`);for(let e of t)this._inlineElement(e)},_inlineElement(t){let e=t.getAttribute(`${this._options.alpinePrefix}data`),i=t.getAttribute(`${this._options.prefix}${this._options.inline}`);if(!e||!i)return;let n=this._parseName(e);this.url(n,i)},_setupComponents(){let t=document.querySelectorAll(`[${this._options.prefix}${this._options.root}]`);for(let e of t)this._setupComponent(e)},_setupComponent(t){let e=t.getAttribute(`${this._options.alpinePrefix}data`);t.setAttribute(`${this._options.alpinePrefix}ignore`,"");let i=this._parseName(e),n=t.getAttribute(`${this._options.prefix}${this._options.root}`)||this._options.defaultStrategy;this._componentStrategy({name:i,strategy:n,el:t,id:t.id||this._index})},async _componentStrategy(t){let e=P(t.strategy);await this._generateRequirements(t,e),await this._download(t.name),this._activate(t)},_generateRequirements(t,e){if(e.type==="expression"){if(e.operator==="&&")return Promise.all(e.parameters.map(i=>this._generateRequirements(t,i)));if(e.operator==="||")return Promise.any(e.parameters.map(i=>this._generateRequirements(t,i)))}return o[e.method]?o[e.method]({component:t,argument:e.argument}):!1},async _download(t){if(t.startsWith(_)||(this._handleAlias(t),!this._data[t]||this._data[t].loaded))return;let e=await this._getModule(t);this.Alpine.data(t,e),this._data[t].loaded=!0},async _getModule(t){if(!this._data[t])return;let e=await this._data[t].download(t);return typeof e=="function"?e:e[t]||e.default||Object.values(e)[0]||!1},_activate(t){this.Alpine.destroyTree(t.el),t.el.removeAttribute(`${this._options.alpinePrefix}ignore`),t.el._x_ignore=!1,this.Alpine.initTree(t.el)},_mutations(){new MutationObserver(t=>{for(let e of t)if(e.addedNodes)for(let i of e.addedNodes)i.nodeType===1&&(i.hasAttribute(`${this._options.prefix}${this._options.root}`)&&this._mutationEl(i),i.querySelectorAll(`[${this._options.prefix}${this._options.root}]`).forEach(n=>this._mutationEl(n)))}).observe(document,{attributes:!0,childList:!0,subtree:!0})},_mutationEl(t){t.hasAttribute(`${this._options.prefix}${this._options.inline}`)&&this._inlineElement(t),this._setupComponent(t)},_handleAlias(t){if(!(!this._alias||this._data[t])){if(typeof this._alias=="function"){this.data(t,this._alias);return}this.url(t,this._alias.replaceAll("[name]",t))}},_parseName(t){return(t||"").split(/[({]/g)[0]||`${_}${this._index}`},_parseUrl(t){return new RegExp("^(?:[a-z+]+:)?//","i").test(t)?t:new URL(t,document.baseURI).href}};document.addEventListener("alpine:init",()=>{window.AsyncAlpine=l,l.init(Alpine,window.AsyncAlpineOptions||{}),document.dispatchEvent(new CustomEvent("async-alpine:init")),l.start()})})();})(); 2 | -------------------------------------------------------------------------------- /public/js/filament/tables/components/table.js: -------------------------------------------------------------------------------- 1 | function c(){return{collapsedGroups:[],isLoading:!1,selectedRecords:[],shouldCheckUniqueSelection:!0,init:function(){this.$wire.$on("deselectAllTableRecords",()=>this.deselectAllRecords()),this.$watch("selectedRecords",()=>{if(!this.shouldCheckUniqueSelection){this.shouldCheckUniqueSelection=!0;return}this.selectedRecords=[...new Set(this.selectedRecords)],this.shouldCheckUniqueSelection=!1})},mountBulkAction:function(e){this.$wire.set("selectedTableRecords",this.selectedRecords,!1),this.$wire.mountTableBulkAction(e)},toggleSelectRecordsOnPage:function(){let e=this.getRecordsOnPage();if(this.areRecordsSelected(e)){this.deselectRecords(e);return}this.selectRecords(e)},toggleSelectRecordsInGroup:async function(e){if(this.isLoading=!0,this.areRecordsSelected(this.getRecordsInGroupOnPage(e))){this.deselectRecords(await this.$wire.getGroupedSelectableTableRecordKeys(e));return}this.selectRecords(await this.$wire.getGroupedSelectableTableRecordKeys(e)),this.isLoading=!1},getRecordsInGroupOnPage:function(e){let s=[];for(let t of this.$root.getElementsByClassName("fi-ta-record-checkbox"))t.dataset.group===e&&s.push(t.value);return s},getRecordsOnPage:function(){let e=[];for(let s of this.$root.getElementsByClassName("fi-ta-record-checkbox"))e.push(s.value);return e},selectRecords:function(e){for(let s of e)this.isRecordSelected(s)||this.selectedRecords.push(s)},deselectRecords:function(e){for(let s of e){let t=this.selectedRecords.indexOf(s);t!==-1&&this.selectedRecords.splice(t,1)}},selectAllRecords:async function(){this.isLoading=!0,this.selectedRecords=await this.$wire.getAllSelectableTableRecordKeys(),this.isLoading=!1},deselectAllRecords:function(){this.selectedRecords=[]},isRecordSelected:function(e){return this.selectedRecords.includes(e)},areRecordsSelected:function(e){return e.every(s=>this.isRecordSelected(s))},toggleCollapseGroup:function(e){if(this.isGroupCollapsed(e)){this.collapsedGroups.splice(this.collapsedGroups.indexOf(e),1);return}this.collapsedGroups.push(e)},isGroupCollapsed:function(e){return this.collapsedGroups.includes(e)},resetCollapsedGroups:function(){this.collapsedGroups=[]}}}export{c as default}; 2 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /resources/css/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frikishaan/tiny-crm/8986a664faf21333ac5ee91ceb2041a0f2d7c465/resources/css/app.css -------------------------------------------------------------------------------- /resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | window.axios = axios; 12 | 13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 14 | 15 | /** 16 | * Echo exposes an expressive API for subscribing to channels and listening 17 | * for events that are broadcast by Laravel. Echo and event broadcasting 18 | * allows your team to easily build robust real-time web applications. 19 | */ 20 | 21 | // import Echo from 'laravel-echo'; 22 | 23 | // import Pusher from 'pusher-js'; 24 | // window.Pusher = Pusher; 25 | 26 | // window.Echo = new Echo({ 27 | // broadcaster: 'pusher', 28 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 29 | // cluster: import.meta.env.VITE_PUSHER_APP_CLUSTER ?? 'mt1', 30 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 31 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 32 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 33 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 34 | // enabledTransports: ['ws', 'wss'], 35 | // }); 36 | -------------------------------------------------------------------------------- /routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /routes/web.php: -------------------------------------------------------------------------------- 1 | name('login'); 21 | -------------------------------------------------------------------------------- /screenshots/Dashboard Screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frikishaan/tiny-crm/8986a664faf21333ac5ee91ceb2041a0f2d7c465/screenshots/Dashboard Screenshot.png -------------------------------------------------------------------------------- /storage/app/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !public/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/app/public/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/debugbar/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/.gitignore: -------------------------------------------------------------------------------- 1 | compiled.php 2 | config.php 3 | down 4 | events.scanned.php 5 | maintenance.php 6 | routes.php 7 | routes.scanned.php 8 | schedule-* 9 | services.json 10 | -------------------------------------------------------------------------------- /storage/framework/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !data/ 3 | !.gitignore 4 | -------------------------------------------------------------------------------- /storage/framework/cache/data/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/testing/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/framework/views/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | const colors = require('tailwindcss/colors') 3 | 4 | module.exports = { 5 | content: [ 6 | './resources/**/*.blade.php', 7 | './vendor/filament/**/*.blade.php', 8 | ], 9 | darkMode: 'class', 10 | theme: { 11 | extend: { 12 | colors: { 13 | danger: colors.rose, 14 | primary: colors.green, 15 | success: colors.green, 16 | warning: colors.yellow, 17 | }, 18 | }, 19 | }, 20 | plugins: [ 21 | require('@tailwindcss/forms'), 22 | require('@tailwindcss/typography'), 23 | ], 24 | } -------------------------------------------------------------------------------- /tests/CreatesApplication.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/Feature/ArchitectureTest.php: -------------------------------------------------------------------------------- 1 | expect(['dd', 'dump', 'ray']) 5 | ->not->toBeUsed(); 6 | 7 | test('All files are enums') 8 | ->expect('App\Enums') 9 | ->toBeEnums(); 10 | -------------------------------------------------------------------------------- /tests/Feature/ContactTest.php: -------------------------------------------------------------------------------- 1 | get(ContactResource::getUrl('index')); 16 | 17 | $response->assertStatus(200); 18 | 19 | $response->assertSeeText('Contacts'); 20 | 21 | $response->assertSeeText('New contact'); 22 | }); 23 | 24 | it('can list', function () { 25 | $contacts = Contact::factory(10)->create(); 26 | 27 | livewire(ContactResource\Pages\ListContacts::class) 28 | ->assertCanSeeTableRecords($contacts); 29 | }); 30 | 31 | it('can render create page', function () { 32 | $this->get(ContactResource::getUrl('create'))->assertSuccessful(); 33 | }); 34 | 35 | it('can create', function () { 36 | $account = Account::factory()->create(); 37 | 38 | $newData = Contact::factory()->make(); 39 | 40 | livewire(ContactResource\Pages\CreateContact::class) 41 | ->fillForm([ 42 | 'name' => $newData->name, 43 | 'email' => $newData->email, 44 | 'phone' => $newData->phone, 45 | 'account_id' => $account->id, 46 | ]) 47 | ->call('create') 48 | ->assertHasNoFormErrors(); 49 | 50 | $this->assertDatabaseHas(Contact::class, [ 51 | 'name' => $newData->name, 52 | 'email' => $newData->email, 53 | 'phone' => $newData->phone, 54 | 'account_id' => $account->id, 55 | ]); 56 | }); 57 | 58 | it('can validate input', function () { 59 | $newData = Contact::factory()->make(); 60 | 61 | livewire(ContactResource\Pages\CreateContact::class) 62 | ->fillForm([ 63 | 'name' => null, 64 | ]) 65 | ->call('create') 66 | ->assertHasFormErrors(['name' => 'required']); 67 | }); 68 | 69 | it('can render edit page', function () { 70 | $this->get(ContactResource::getUrl('edit', [ 71 | 'record' => Contact::factory()->create(), 72 | ]))->assertSuccessful(); 73 | }); 74 | 75 | it('can retrieve data', function () { 76 | $account = Account::factory()->create(); 77 | $contact = Contact::factory()->create([ 78 | 'account_id' => $account->id 79 | ]); 80 | 81 | livewire(ContactResource\Pages\EditContact::class, [ 82 | 'record' => $contact->getRouteKey(), 83 | ]) 84 | ->assertFormSet([ 85 | 'name' => $contact->name, 86 | 'email' => $contact->email, 87 | 'phone' => $contact->phone, 88 | 'account_id' => $contact->account_id, 89 | ]); 90 | }); 91 | 92 | it('can update', function () { 93 | $account = Account::factory()->create(); 94 | $newAccount = Account::factory()->create(); 95 | $contact = Contact::factory()->create([ 96 | 'account_id' => $account->id 97 | ]); 98 | $newData = Contact::factory()->make(); 99 | 100 | livewire(ContactResource\Pages\EditContact::class, [ 101 | 'record' => $contact->getRouteKey(), 102 | ]) 103 | ->fillForm([ 104 | 'name' => $newData->name, 105 | 'email' => $newData->email, 106 | 'phone' => $newData->phone, 107 | 'account_id' => $newAccount->id, 108 | ]) 109 | ->call('save') 110 | ->assertHasNoFormErrors(); 111 | 112 | expect($contact->refresh()) 113 | ->name->toBe($newData->name) 114 | ->email->toBe($newData->email) 115 | ->phone->toBe($newData->phone) 116 | ->account_id->toBe($newAccount->id); 117 | }); 118 | 119 | it('can validate input on edit form', function () { 120 | $account = Account::factory()->create(); 121 | $contact = Contact::factory()->create([ 122 | 'account_id' => $account->id 123 | ]); 124 | $newData = Contact::factory()->make(); 125 | 126 | livewire(ContactResource\Pages\EditContact::class, [ 127 | 'record' => $contact->getRouteKey(), 128 | ]) 129 | ->fillForm([ 130 | 'name' => null, 131 | ]) 132 | ->call('save') 133 | ->assertHasFormErrors(['name' => 'required']); 134 | }); 135 | 136 | it('can delete', function () { 137 | $contact = Contact::factory()->create([ 138 | 'account_id' => Account::factory()->create()->id 139 | ]); 140 | 141 | livewire(ContactResource\Pages\EditContact::class, [ 142 | 'record' => $contact->getRouteKey(), 143 | ]) 144 | ->callAction(DeleteAction::class); 145 | 146 | $this->assertModelMissing($contact); 147 | }); 148 | -------------------------------------------------------------------------------- /tests/Feature/DashboardTest.php: -------------------------------------------------------------------------------- 1 | get('/app/login')->assertStatus(200); 5 | }); 6 | 7 | test('unauthenticated user cannot access dashboard', function() { 8 | $this->get('/app') 9 | ->assertStatus(302) 10 | ->assertRedirect('/app/login'); 11 | }); 12 | 13 | test('authenticated user can access the dashboard', function () { 14 | 15 | login(); 16 | 17 | $response = $this->get('/app'); 18 | 19 | $response->assertStatus(200); 20 | 21 | $response->assertSeeText(['Dashboard', 'Open Leads']); 22 | }); 23 | 24 | it('can see widgets', function() { 25 | login(); 26 | 27 | $response = $this->get('/app'); 28 | 29 | $response->assertStatus(200); 30 | 31 | $response->assertSeeText([ 32 | 'Dashboard', 'Open Leads', 'Qualified leads', 'Disqualified leads', 33 | 'Avg Estimated Revenue', 'Open deals', 'Deals won', 34 | 'Avg Revenue (per deal)', 'Total revenue' 35 | ]); 36 | }); 37 | 38 | it('can see the charts', function() { 39 | login(); 40 | 41 | $response = $this->get('/app'); 42 | 43 | $response->assertStatus(200); 44 | 45 | $response->assertSeeText([ 46 | 'Deals won per month', 'Revenue per month' 47 | ]); 48 | }); -------------------------------------------------------------------------------- /tests/Feature/ProductTest.php: -------------------------------------------------------------------------------- 1 | get(ProductResource::getUrl('index')); 15 | 16 | $response->assertStatus(200); 17 | 18 | $response->assertSeeText('Products'); 19 | 20 | $response->assertSeeText('New product'); 21 | }); 22 | 23 | it('can list', function () { 24 | $product = Product::factory(10)->create(); 25 | 26 | livewire(ProductResource\Pages\ListProducts::class) 27 | ->assertCanSeeTableRecords($product); 28 | }); 29 | 30 | it('can render create page', function () { 31 | $this->get(ProductResource::getUrl('create'))->assertSuccessful(); 32 | }); 33 | 34 | it('can create', function () { 35 | $newData = Product::factory()->make(); 36 | 37 | livewire(ProductResource\Pages\CreateProduct::class) 38 | ->fillForm([ 39 | 'product_id' => $newData->product_id, 40 | 'name' => $newData->name, 41 | 'price' => $newData->price, 42 | 'type' => $newData->type, 43 | ]) 44 | ->call('create') 45 | ->assertHasNoFormErrors(); 46 | 47 | $this->assertDatabaseHas(Product::class, [ 48 | 'product_id' => $newData->product_id, 49 | 'name' => $newData->name, 50 | 'price' => $newData->price, 51 | 'type' => $newData->type, 52 | ]); 53 | }); 54 | 55 | it('can validate input', function () { 56 | 57 | Product::factory()->create([ 58 | 'product_id' => 'PRO-12345' 59 | ]); 60 | 61 | livewire(ProductResource\Pages\CreateProduct::class) 62 | ->fillForm([ 63 | 'name' => null, 64 | 'product_id' => 'PRO-12345', 65 | 'price' => null, 66 | 'type' => null 67 | ]) 68 | ->call('create') 69 | ->assertHasFormErrors([ 70 | 'product_id' => 'unique', 71 | 'name' => 'required', 72 | 'type' => 'required', 73 | 'price' => 'required', 74 | ]); 75 | }); 76 | 77 | it('can render edit page', function () { 78 | $this->get(ProductResource::getUrl('edit', [ 79 | 'record' => Product::factory()->create(), 80 | ]))->assertSuccessful(); 81 | }); 82 | 83 | it('can retrieve data', function () { 84 | $product = Product::factory()->create(); 85 | 86 | livewire(ProductResource\Pages\EditProduct::class, [ 87 | 'record' => $product->getRouteKey(), 88 | ]) 89 | ->assertFormSet([ 90 | 'product_id' => $product->product_id, 91 | 'name' => $product->name, 92 | 'price' => $product->price, 93 | 'type' => $product->type->value, 94 | ]); 95 | }); 96 | 97 | it('can update', function () { 98 | $product = Product::factory()->create(); 99 | $newData = Product::factory()->make(); 100 | 101 | livewire(ProductResource\Pages\EditProduct::class, [ 102 | 'record' => $product->getRouteKey(), 103 | ]) 104 | ->fillForm([ 105 | 'product_id' => $newData->product_id, 106 | 'name' => $newData->name, 107 | 'price' => $newData->price, 108 | 'type' => $newData->type, 109 | ]) 110 | ->call('save') 111 | ->assertHasNoFormErrors(); 112 | 113 | expect($product->refresh()) 114 | ->name->toBe($newData->name) 115 | ->product_id->toBe($newData->product_id) 116 | /** 117 | * Casting the retruned value to string. 118 | * 119 | * See - https://github.com/laravel/framework/issues/3548 120 | * 121 | */ 122 | ->price->toBe((string)$newData->price) 123 | ->type->toBe($newData->type); 124 | }); 125 | 126 | it('can validate input on edit form', function () { 127 | $product = Product::factory()->create(); 128 | 129 | Product::factory()->create([ 130 | 'product_id' => 'PRO-54321' 131 | ]); 132 | 133 | livewire(ProductResource\Pages\EditProduct::class, [ 134 | 'record' => $product->getRouteKey(), 135 | ]) 136 | ->fillForm([ 137 | 'name' => null, 138 | 'product_id' => 'PRO-54321', 139 | 'price' => null, 140 | 'type' => null 141 | ]) 142 | ->call('save') 143 | ->assertHasFormErrors([ 144 | 'product_id' => 'unique', 145 | 'name' => 'required', 146 | 'type' => 'required', 147 | 'price' => 'required', 148 | ]); 149 | }); 150 | 151 | it('can delete', function () { 152 | $product = Product::factory()->create(); 153 | 154 | livewire(ProductResource\Pages\EditProduct::class, [ 155 | 'record' => $product->getRouteKey(), 156 | ]) 157 | ->callAction(DeleteAction::class); 158 | 159 | $this->assertModelMissing($product); 160 | }); 161 | -------------------------------------------------------------------------------- /tests/Pest.php: -------------------------------------------------------------------------------- 1 | in('Feature'); 11 | 12 | /** 13 | * Function to login user 14 | */ 15 | function login() 16 | { 17 | actingAs(User::find(1)); 18 | } -------------------------------------------------------------------------------- /tests/TestCase.php: -------------------------------------------------------------------------------- 1 | create([ 30 | 'email' => 'admin@tinycrm.com' 31 | ]); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/Unit/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frikishaan/tiny-crm/8986a664faf21333ac5ee91ceb2041a0f2d7c465/tests/Unit/.gitkeep -------------------------------------------------------------------------------- /vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from "vite"; 2 | import laravel from "laravel-vite-plugin"; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | laravel({ 7 | input: ["resources/js/app.js"], 8 | refresh: true, 9 | }), 10 | ], 11 | }); 12 | --------------------------------------------------------------------------------