Compare commits
23 Commits
04ff8df666
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 4911a37cfd | |||
| a04c5b1f00 | |||
| baf23d4124 | |||
| f14defeebd | |||
| 60afe0c441 | |||
| 8a14482c07 | |||
| 39a444685a | |||
| 48593b234e | |||
| 564b609afa | |||
| 6c359828ea | |||
| f54af3890f | |||
| 9014a16ab5 | |||
| 20b3a72dca | |||
| e2173e625d | |||
| 04d507a7fe | |||
| 61d475ef72 | |||
| f1e9d46d4b | |||
| f6b88a66ff | |||
| 4977418756 | |||
| 11f24f73c7 | |||
| 13a5197b07 | |||
| 20e3211719 | |||
| 6121dce8e8 |
129
.ai/guidelines/modular-architecture.blade.php
Normal file
129
.ai/guidelines/modular-architecture.blade.php
Normal file
@@ -0,0 +1,129 @@
|
||||
### Modular Architecture Guidelines
|
||||
|
||||
#### Overview
|
||||
|
||||
This application uses a custom modular architecture to organize features into distinct, self-contained units called "Modules". Each module encapsulates a specific piece of functionality, including its own models, migrations, seeders, controllers, and more. The system is designed to automatically discover and register components from enabled modules.
|
||||
|
||||
The core of this system is the `App\Modules\ModuleRepository`, which is responsible for finding, loading, and managing all the modules in the application. A set of helper functions is provided for easy interaction with the module repository.
|
||||
|
||||
#### Core Concepts
|
||||
|
||||
- **Module**: A directory within `app/Modules` that represents a distinct feature.
|
||||
- **`ModuleRepository`**: A singleton service (`App\Modules\ModuleRepository`) that manages all modules. Accessed via the `modular()` helper.
|
||||
- **`ModuleContract`**: An interface (`App\Modules\ModuleContract`) that every module's main class must implement. It defines the basic contract for a module, such as whether it's enabled.
|
||||
- **Helpers**: Global functions defined in `app/Helpers/helpers.php` to simplify interaction with the modular system.
|
||||
|
||||
#### Module Structure
|
||||
|
||||
Every module is a directory located in `app/Modules/`. For a module named `Example`, the structure would be `app/Modules/Example/`.
|
||||
|
||||
##### Required Structure
|
||||
|
||||
- `app/Modules/Example/ExampleModule.php`: This is the main class for the module. It **must** implement `App\Modules\ModuleContract`.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Example;
|
||||
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class ExampleModule implements ModuleContract
|
||||
{
|
||||
/**
|
||||
* Check if module is enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
// Return true or false based on config, env, or other logic
|
||||
return true;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Automatic Discovery
|
||||
|
||||
The following directories and their contents are automatically discovered and registered by the system for all **enabled** modules:
|
||||
|
||||
- `app/Modules/Example/Database/Migrations/`: Any migration files in this directory will be automatically registered and run with `php artisan migrate`.
|
||||
- `app/Modules/Example/Database/Seeders/`: Any seeder classes in this directory will be automatically run with `php artisan db:seed`.
|
||||
|
||||
##### Conventional Structure
|
||||
|
||||
While not automatically registered in the same way as migrations and seeders, it is best practice to follow standard Laravel application structure within your module:
|
||||
|
||||
```
|
||||
app/Modules/Example/
|
||||
├── Database/
|
||||
│ ├── Migrations/
|
||||
│ │ └── 2025_09_22_000000_create_example_table.php
|
||||
│ └── Seeders/
|
||||
│ └── ExampleSeeder.php
|
||||
├── Http/
|
||||
│ ├── Controllers/
|
||||
│ └── Requests/
|
||||
├── Models/
|
||||
│ └── Example.php
|
||||
├── Repositories/
|
||||
├── Resources/
|
||||
└── ExampleModule.php
|
||||
```
|
||||
|
||||
#### Creating a New Module
|
||||
|
||||
1. **Create the directory**: Create a new folder for your module in `app/Modules/`. For example, `app/Modules/NewFeature`.
|
||||
|
||||
2. **Create the Module Class**: Inside the new directory, create the main module class. The class name should be the module name suffixed with `Module`. For `NewFeature`, it would be `NewFeatureModule.php`.
|
||||
|
||||
```php
|
||||
// app/Modules/NewFeature/NewFeatureModule.php
|
||||
<?php
|
||||
|
||||
namespace App\Modules\NewFeature;
|
||||
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class NewFeatureModule implements ModuleContract
|
||||
{
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return true; // Or use config('modules.new_feature.enabled', false)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Add Components**: Add migrations, seeders, models, controllers, etc., to your module following the structure outlined above.
|
||||
|
||||
4. **Enable the Module**: Ensure the `isEnabled()` method in your module class returns `true`. Only enabled modules will have their migrations and seeders registered.
|
||||
|
||||
#### Usage via Helpers
|
||||
|
||||
Use the global helper functions to interact with modules throughout the application.
|
||||
|
||||
- **Get the Module Repository**:
|
||||
```php
|
||||
$repository = modular();
|
||||
```
|
||||
|
||||
- **Get All Enabled Modules**:
|
||||
```php
|
||||
$enabledModules = modules(); // Returns a Collection of BaseModule objects
|
||||
|
||||
foreach ($enabledModules as $module) {
|
||||
echo $module->name;
|
||||
}
|
||||
```
|
||||
|
||||
- **Get a Specific Module Instance**:
|
||||
```php
|
||||
$invoiceModule = module('Invoice'); // Returns instance of InvoiceModule
|
||||
|
||||
if ($invoiceModule->isEnabled()) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
- **Get the Modules Path**:
|
||||
```php
|
||||
$path = modules_path('Invoice/Database'); // app/Modules/Invoice/Database
|
||||
```
|
||||
11
.cursor/mcp.json
Normal file
11
.cursor/mcp.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"mcpServers": {
|
||||
"laravel-boost": {
|
||||
"command": "php",
|
||||
"args": [
|
||||
"artisan",
|
||||
"boost:mcp"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
567
.cursor/rules/laravel-boost.mdc
Normal file
567
.cursor/rules/laravel-boost.mdc
Normal file
@@ -0,0 +1,567 @@
|
||||
---
|
||||
alwaysApply: true
|
||||
---
|
||||
<laravel-boost-guidelines>
|
||||
=== foundation rules ===
|
||||
|
||||
# Laravel Boost Guidelines
|
||||
|
||||
The Laravel Boost guidelines are specifically curated by Laravel maintainers for this application. These guidelines should be followed closely to enhance the user's satisfaction building Laravel applications.
|
||||
|
||||
## Foundational Context
|
||||
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
|
||||
|
||||
- php - 8.3.12
|
||||
- filament/filament (FILAMENT) - v4
|
||||
- laravel/framework (LARAVEL) - v12
|
||||
- laravel/prompts (PROMPTS) - v0
|
||||
- livewire/livewire (LIVEWIRE) - v3
|
||||
- larastan/larastan (LARASTAN) - v3
|
||||
- laravel/mcp (MCP) - v0
|
||||
- laravel/pint (PINT) - v1
|
||||
- laravel/sail (SAIL) - v1
|
||||
- pestphp/pest (PEST) - v3
|
||||
- phpunit/phpunit (PHPUNIT) - v11
|
||||
- rector/rector (RECTOR) - v2
|
||||
|
||||
|
||||
## Conventions
|
||||
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, naming.
|
||||
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
|
||||
- Check for existing components to reuse before writing a new one.
|
||||
|
||||
## Verification Scripts
|
||||
- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.
|
||||
|
||||
## Application Structure & Architecture
|
||||
- Stick to existing directory structure - don't create new base folders without approval.
|
||||
- Do not change the application's dependencies without approval.
|
||||
|
||||
## Frontend Bundling
|
||||
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `npm run build`, `npm run dev`, or `composer run dev`. Ask them.
|
||||
|
||||
## Replies
|
||||
- Be concise in your explanations - focus on what's important rather than explaining obvious details.
|
||||
|
||||
## Documentation Files
|
||||
- You must only create documentation files if explicitly requested by the user.
|
||||
|
||||
|
||||
=== boost rules ===
|
||||
|
||||
## Laravel Boost
|
||||
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
|
||||
|
||||
## Artisan
|
||||
- Use the `list-artisan-commands` tool when you need to call an Artisan command to double check the available parameters.
|
||||
|
||||
## URLs
|
||||
- Whenever you share a project URL with the user you should use the `get-absolute-url` tool to ensure you're using the correct scheme, domain / IP, and port.
|
||||
|
||||
## Tinker / Debugging
|
||||
- You should use the `tinker` tool when you need to execute PHP to debug code or query Eloquent models directly.
|
||||
- Use the `database-query` tool when you only need to read from the database.
|
||||
|
||||
## Reading Browser Logs With the `browser-logs` Tool
|
||||
- You can read browser logs, errors, and exceptions using the `browser-logs` tool from Boost.
|
||||
- Only recent browser logs will be useful - ignore old logs.
|
||||
|
||||
## Searching Documentation (Critically Important)
|
||||
- Boost comes with a powerful `search-docs` tool you should use before any other approaches. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation specific for the user's circumstance. You should pass an array of packages to filter on if you know you need docs for particular packages.
|
||||
- The 'search-docs' tool is perfect for all Laravel related packages, including Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, Nightwatch, etc.
|
||||
- You must use this tool to search for Laravel-ecosystem documentation before falling back to other approaches.
|
||||
- Search the documentation before making code changes to ensure we are taking the correct approach.
|
||||
- Use multiple, broad, simple, topic based queries to start. For example: `['rate limiting', 'routing rate limiting', 'routing']`.
|
||||
- Do not add package names to queries - package information is already shared. For example, use `test resource table`, not `filament 4 test resource table`.
|
||||
|
||||
### Available Search Syntax
|
||||
- You can and should pass multiple queries at once. The most relevant results will be returned first.
|
||||
|
||||
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'
|
||||
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit"
|
||||
3. Quoted Phrases (Exact Position) - query="infinite scroll" - Words must be adjacent and in that order
|
||||
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit"
|
||||
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms
|
||||
|
||||
|
||||
=== php rules ===
|
||||
|
||||
## PHP
|
||||
|
||||
- Always use curly braces for control structures, even if it has one line.
|
||||
|
||||
### Constructors
|
||||
- Use PHP 8 constructor property promotion in `__construct()`.
|
||||
- <code-snippet>public function __construct(public GitHub $github) { }</code-snippet>
|
||||
- Do not allow empty `__construct()` methods with zero parameters.
|
||||
|
||||
### Type Declarations
|
||||
- Always use explicit return type declarations for methods and functions.
|
||||
- Use appropriate PHP type hints for method parameters.
|
||||
|
||||
<code-snippet name="Explicit Return Types and Method Params" lang="php">
|
||||
protected function isAccessible(User $user, ?string $path = null): bool
|
||||
{
|
||||
...
|
||||
}
|
||||
</code-snippet>
|
||||
|
||||
## Comments
|
||||
- Prefer PHPDoc blocks over comments. Never use comments within the code itself unless there is something _very_ complex going on.
|
||||
|
||||
## PHPDoc Blocks
|
||||
- Add useful array shape type definitions for arrays when appropriate.
|
||||
|
||||
## Enums
|
||||
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
|
||||
|
||||
|
||||
=== filament/core rules ===
|
||||
|
||||
## Filament
|
||||
- Filament is used by this application, check how and where to follow existing application conventions.
|
||||
- Filament is a Server-Driven UI (SDUI) framework for Laravel. It allows developers to define user interfaces in PHP using structured configuration objects. It is built on top of Livewire, Alpine.js, and Tailwind CSS.
|
||||
- You can use the `search-docs` tool to get information from the official Filament documentation when needed. This is very useful for Artisan command arguments, specific code examples, testing functionality, relationship management, and ensuring you're following idiomatic practices.
|
||||
- Utilize static `make()` methods for consistent component initialization.
|
||||
|
||||
### Artisan
|
||||
- You must use the Filament specific Artisan commands to create new files or components for Filament. You can find these with the `list-artisan-commands` tool, or with `php artisan` and the `--help` option.
|
||||
- Inspect the required options, always pass `--no-interaction`, and valid arguments for other options when applicable.
|
||||
|
||||
### Filament's Core Features
|
||||
- Actions: Handle doing something within the application, often with a button or link. Actions encapsulate the UI, the interactive modal window, and the logic that should be executed when the modal window is submitted. They can be used anywhere in the UI and are commonly used to perform one-time actions like deleting a record, sending an email, or updating data in the database based on modal form input.
|
||||
- Forms: Dynamic forms rendered within other features, such as resources, action modals, table filters, and more.
|
||||
- Infolists: Read-only lists of data.
|
||||
- Notifications: Flash notifications displayed to users within the application.
|
||||
- Panels: The top-level container in Filament that can include all other features like pages, resources, forms, tables, notifications, actions, infolists, and widgets.
|
||||
- Resources: Static classes that are used to build CRUD interfaces for Eloquent models. Typically live in `app/Filament/Resources`.
|
||||
- Schemas: Represent components that define the structure and behavior of the UI, such as forms, tables, or lists.
|
||||
- Tables: Interactive tables with filtering, sorting, pagination, and more.
|
||||
- Widgets: Small component included within dashboards, often used for displaying data in charts, tables, or as a stat.
|
||||
|
||||
### Relationships
|
||||
- Determine if you can use the `relationship()` method on form components when you need `options` for a select, checkbox, repeater, or when building a `Fieldset`:
|
||||
|
||||
<code-snippet name="Relationship example for Form Select" lang="php">
|
||||
Forms\Components\Select::make('user_id')
|
||||
->label('Author')
|
||||
->relationship('author')
|
||||
->required(),
|
||||
</code-snippet>
|
||||
|
||||
|
||||
## Testing
|
||||
- It's important to test Filament functionality for user satisfaction.
|
||||
- Ensure that you are authenticated to access the application within the test.
|
||||
- Filament uses Livewire, so start assertions with `livewire()` or `Livewire::test()`.
|
||||
|
||||
### Example Tests
|
||||
|
||||
<code-snippet name="Filament Table Test" lang="php">
|
||||
livewire(ListUsers::class)
|
||||
->assertCanSeeTableRecords($users)
|
||||
->searchTable($users->first()->name)
|
||||
->assertCanSeeTableRecords($users->take(1))
|
||||
->assertCanNotSeeTableRecords($users->skip(1))
|
||||
->searchTable($users->last()->email)
|
||||
->assertCanSeeTableRecords($users->take(-1))
|
||||
->assertCanNotSeeTableRecords($users->take($users->count() - 1));
|
||||
</code-snippet>
|
||||
|
||||
<code-snippet name="Filament Create Resource Test" lang="php">
|
||||
livewire(CreateUser::class)
|
||||
->fillForm([
|
||||
'name' => 'Howdy',
|
||||
'email' => 'howdy@example.com',
|
||||
])
|
||||
->call('create')
|
||||
->assertNotified()
|
||||
->assertRedirect();
|
||||
|
||||
assertDatabaseHas(User::class, [
|
||||
'name' => 'Howdy',
|
||||
'email' => 'howdy@example.com',
|
||||
]);
|
||||
</code-snippet>
|
||||
|
||||
<code-snippet name="Testing Multiple Panels (setup())" lang="php">
|
||||
use Filament\Facades\Filament;
|
||||
|
||||
Filament::setCurrentPanel('app');
|
||||
</code-snippet>
|
||||
|
||||
<code-snippet name="Calling an Action in a Test" lang="php">
|
||||
livewire(EditInvoice::class, [
|
||||
'invoice' => $invoice,
|
||||
])->callAction('send');
|
||||
|
||||
expect($invoice->refresh())->isSent()->toBeTrue();
|
||||
</code-snippet>
|
||||
|
||||
|
||||
=== filament/v4 rules ===
|
||||
|
||||
## Filament 4
|
||||
|
||||
### Important Version 4 Changes
|
||||
- File visibility is now `private` by default.
|
||||
- The `deferFilters` method from Filament v3 is now the default behavior in Filament v4, so users must click a button before the filters are applied to the table. To disable this behavior, you can use the `deferFilters(false)` method.
|
||||
- The `Grid`, `Section`, and `Fieldset` layout components no longer span all columns by default.
|
||||
- The `all` pagination page method is not available for tables by default.
|
||||
- All action classes extend `Filament\Actions\Action`. No action classes exist in `Filament\Tables\Actions`.
|
||||
- The `Form` & `Infolist` layout components have been moved to `Filament\Schemas\Components`, for example `Grid`, `Section`, `Fieldset`, `Tabs`, `Wizard`, etc.
|
||||
- A new `Repeater` component for Forms has been added.
|
||||
- Icons now use the `Filament\Support\Icons\Heroicon` Enum by default. Other options are available and documented.
|
||||
|
||||
### Organize Component Classes Structure
|
||||
- Schema components: `Schemas/Components/`
|
||||
- Table columns: `Tables/Columns/`
|
||||
- Table filters: `Tables/Filters/`
|
||||
- Actions: `Actions/`
|
||||
|
||||
|
||||
=== laravel/core rules ===
|
||||
|
||||
## Do Things the Laravel Way
|
||||
|
||||
- Use `php artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using the `list-artisan-commands` tool.
|
||||
- If you're creating a generic PHP class, use `artisan make:class`.
|
||||
- Pass `--no-interaction` to all Artisan commands to ensure they work without user input. You should also pass the correct `--options` to ensure correct behavior.
|
||||
|
||||
### Database
|
||||
- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
|
||||
- Use Eloquent models and relationships before suggesting raw database queries
|
||||
- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
|
||||
- Generate code that prevents N+1 query problems by using eager loading.
|
||||
- Use Laravel's query builder for very complex database operations.
|
||||
|
||||
### Model Creation
|
||||
- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `list-artisan-commands` to check the available options to `php artisan make:model`.
|
||||
|
||||
### APIs & Eloquent Resources
|
||||
- For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention.
|
||||
|
||||
### Controllers & Validation
|
||||
- Always create Form Request classes for validation rather than inline validation in controllers. Include both validation rules and custom error messages.
|
||||
- Check sibling Form Requests to see if the application uses array or string based validation rules.
|
||||
|
||||
### Queues
|
||||
- Use queued jobs for time-consuming operations with the `ShouldQueue` interface.
|
||||
|
||||
### Authentication & Authorization
|
||||
- Use Laravel's built-in authentication and authorization features (gates, policies, Sanctum, etc.).
|
||||
|
||||
### URL Generation
|
||||
- When generating links to other pages, prefer named routes and the `route()` function.
|
||||
|
||||
### Configuration
|
||||
- Use environment variables only in configuration files - never use the `env()` function directly outside of config files. Always use `config('app.name')`, not `env('APP_NAME')`.
|
||||
|
||||
### Testing
|
||||
- When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model.
|
||||
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
|
||||
- When creating tests, make use of `php artisan make:test [options] <name>` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests.
|
||||
|
||||
### Vite Error
|
||||
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.
|
||||
|
||||
|
||||
=== laravel/v12 rules ===
|
||||
|
||||
## Laravel 12
|
||||
|
||||
- Use the `search-docs` tool to get version specific documentation.
|
||||
- Since Laravel 11, Laravel has a new streamlined file structure which this project uses.
|
||||
|
||||
### Laravel 12 Structure
|
||||
- No middleware files in `app/Http/Middleware/`.
|
||||
- `bootstrap/app.php` is the file to register middleware, exceptions, and routing files.
|
||||
- `bootstrap/providers.php` contains application specific service providers.
|
||||
- **No app\Console\Kernel.php** - use `bootstrap/app.php` or `routes/console.php` for console configuration.
|
||||
- **Commands auto-register** - files in `app/Console/Commands/` are automatically available and do not require manual registration.
|
||||
|
||||
### Database
|
||||
- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.
|
||||
- Laravel 11 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.
|
||||
|
||||
### Models
|
||||
- Casts can and likely should be set in a `casts()` method on a model rather than the `$casts` property. Follow existing conventions from other models.
|
||||
|
||||
|
||||
=== livewire/core rules ===
|
||||
|
||||
## Livewire Core
|
||||
- Use the `search-docs` tool to find exact version specific documentation for how to write Livewire & Livewire tests.
|
||||
- Use the `php artisan make:livewire [Posts\CreatePost]` artisan command to create new components
|
||||
- State should live on the server, with the UI reflecting it.
|
||||
- All Livewire requests hit the Laravel backend, they're like regular HTTP requests. Always validate form data, and run authorization checks in Livewire actions.
|
||||
|
||||
## Livewire Best Practices
|
||||
- Livewire components require a single root element.
|
||||
- Use `wire:loading` and `wire:dirty` for delightful loading states.
|
||||
- Add `wire:key` in loops:
|
||||
|
||||
```blade
|
||||
@foreach ($items as $item)
|
||||
<div wire:key="item-{{ $item->id }}">
|
||||
{{ $item->name }}
|
||||
</div>
|
||||
@endforeach
|
||||
```
|
||||
|
||||
- Prefer lifecycle hooks like `mount()`, `updatedFoo()` for initialization and reactive side effects:
|
||||
|
||||
<code-snippet name="Lifecycle hook examples" lang="php">
|
||||
public function mount(User $user) { $this->user = $user; }
|
||||
public function updatedSearch() { $this->resetPage(); }
|
||||
</code-snippet>
|
||||
|
||||
|
||||
## Testing Livewire
|
||||
|
||||
<code-snippet name="Example Livewire component test" lang="php">
|
||||
Livewire::test(Counter::class)
|
||||
->assertSet('count', 0)
|
||||
->call('increment')
|
||||
->assertSet('count', 1)
|
||||
->assertSee(1)
|
||||
->assertStatus(200);
|
||||
</code-snippet>
|
||||
|
||||
|
||||
<code-snippet name="Testing a Livewire component exists within a page" lang="php">
|
||||
$this->get('/posts/create')
|
||||
->assertSeeLivewire(CreatePost::class);
|
||||
</code-snippet>
|
||||
|
||||
|
||||
=== livewire/v3 rules ===
|
||||
|
||||
## Livewire 3
|
||||
|
||||
### Key Changes From Livewire 2
|
||||
- These things changed in Livewire 2, but may not have been updated in this application. Verify this application's setup to ensure you conform with application conventions.
|
||||
- Use `wire:model.live` for real-time updates, `wire:model` is now deferred by default.
|
||||
- Components now use the `App\Livewire` namespace (not `App\Http\Livewire`).
|
||||
- Use `$this->dispatch()` to dispatch events (not `emit` or `dispatchBrowserEvent`).
|
||||
- Use the `components.layouts.app` view as the typical layout path (not `layouts.app`).
|
||||
|
||||
### New Directives
|
||||
- `wire:show`, `wire:transition`, `wire:cloak`, `wire:offline`, `wire:target` are available for use. Use the documentation to find usage examples.
|
||||
|
||||
### Alpine
|
||||
- Alpine is now included with Livewire, don't manually include Alpine.js.
|
||||
- Plugins included with Alpine: persist, intersect, collapse, and focus.
|
||||
|
||||
### Lifecycle Hooks
|
||||
- You can listen for `livewire:init` to hook into Livewire initialization, and `fail.status === 419` for the page expiring:
|
||||
|
||||
<code-snippet name="livewire:load example" lang="js">
|
||||
document.addEventListener('livewire:init', function () {
|
||||
Livewire.hook('request', ({ fail }) => {
|
||||
if (fail && fail.status === 419) {
|
||||
alert('Your session expired');
|
||||
}
|
||||
});
|
||||
|
||||
Livewire.hook('message.failed', (message, component) => {
|
||||
console.error(message);
|
||||
});
|
||||
});
|
||||
</code-snippet>
|
||||
|
||||
|
||||
=== pint/core rules ===
|
||||
|
||||
## Laravel Pint Code Formatter
|
||||
|
||||
- You must run `vendor/bin/pint --dirty` before finalizing changes to ensure your code matches the project's expected style.
|
||||
- Do not run `vendor/bin/pint --test`, simply run `vendor/bin/pint` to fix any formatting issues.
|
||||
|
||||
|
||||
=== pest/core rules ===
|
||||
|
||||
## Pest
|
||||
|
||||
### Testing
|
||||
- If you need to verify a feature is working, write or update a Unit / Feature test.
|
||||
|
||||
### Pest Tests
|
||||
- All tests must be written using Pest. Use `php artisan make:test --pest <name>`.
|
||||
- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files - these are core to the application.
|
||||
- Tests should test all of the happy paths, failure paths, and weird paths.
|
||||
- Tests live in the `tests/Feature` and `tests/Unit` directories.
|
||||
- Pest tests look and behave like this:
|
||||
<code-snippet name="Basic Pest Test Example" lang="php">
|
||||
it('is true', function () {
|
||||
expect(true)->toBeTrue();
|
||||
});
|
||||
</code-snippet>
|
||||
|
||||
### Running Tests
|
||||
- Run the minimal number of tests using an appropriate filter before finalizing code edits.
|
||||
- To run all tests: `php artisan test`.
|
||||
- To run all tests in a file: `php artisan test tests/Feature/ExampleTest.php`.
|
||||
- To filter on a particular test name: `php artisan test --filter=testName` (recommended after making a change to a related file).
|
||||
- When the tests relating to your changes are passing, ask the user if they would like to run the entire test suite to ensure everything is still passing.
|
||||
|
||||
### Pest Assertions
|
||||
- When asserting status codes on a response, use the specific method like `assertForbidden` and `assertNotFound` instead of using `assertStatus(403)` or similar, e.g.:
|
||||
<code-snippet name="Pest Example Asserting postJson Response" lang="php">
|
||||
it('returns all', function () {
|
||||
$response = $this->postJson('/api/docs', []);
|
||||
|
||||
$response->assertSuccessful();
|
||||
});
|
||||
</code-snippet>
|
||||
|
||||
### Mocking
|
||||
- Mocking can be very helpful when appropriate.
|
||||
- When mocking, you can use the `Pest\Laravel\mock` Pest function, but always import it via `use function Pest\Laravel\mock;` before using it. Alternatively, you can use `$this->mock()` if existing tests do.
|
||||
- You can also create partial mocks using the same import or self method.
|
||||
|
||||
### Datasets
|
||||
- Use datasets in Pest to simplify tests which have a lot of duplicated data. This is often the case when testing validation rules, so consider going with this solution when writing tests for validation rules.
|
||||
|
||||
<code-snippet name="Pest Dataset Example" lang="php">
|
||||
it('has emails', function (string $email) {
|
||||
expect($email)->not->toBeEmpty();
|
||||
})->with([
|
||||
'james' => 'james@laravel.com',
|
||||
'taylor' => 'taylor@laravel.com',
|
||||
]);
|
||||
</code-snippet>
|
||||
|
||||
|
||||
=== .ai/modular-architecture rules ===
|
||||
|
||||
### Modular Architecture Guidelines
|
||||
|
||||
#### Overview
|
||||
|
||||
This application uses a custom modular architecture to organize features into distinct, self-contained units called "Modules". Each module encapsulates a specific piece of functionality, including its own models, migrations, seeders, controllers, and more. The system is designed to automatically discover and register components from enabled modules.
|
||||
|
||||
The core of this system is the `App\Modules\ModuleRepository`, which is responsible for finding, loading, and managing all the modules in the application. A set of helper functions is provided for easy interaction with the module repository.
|
||||
|
||||
#### Core Concepts
|
||||
|
||||
- **Module**: A directory within `app/Modules` that represents a distinct feature.
|
||||
- **`ModuleRepository`**: A singleton service (`App\Modules\ModuleRepository`) that manages all modules. Accessed via the `modular()` helper.
|
||||
- **`ModuleContract`**: An interface (`App\Modules\ModuleContract`) that every module's main class must implement. It defines the basic contract for a module, such as whether it's enabled.
|
||||
- **Helpers**: Global functions defined in `app/Helpers/helpers.php` to simplify interaction with the modular system.
|
||||
|
||||
#### Module Structure
|
||||
|
||||
Every module is a directory located in `app/Modules/`. For a module named `Example`, the structure would be `app/Modules/Example/`.
|
||||
|
||||
##### Required Structure
|
||||
|
||||
- `app/Modules/Example/ExampleModule.php`: This is the main class for the module. It **must** implement `App\Modules\ModuleContract`.
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Example;
|
||||
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class ExampleModule implements ModuleContract
|
||||
{
|
||||
/**
|
||||
* Check if module is enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
// Return true or false based on config, env, or other logic
|
||||
return true;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
##### Automatic Discovery
|
||||
|
||||
The following directories and their contents are automatically discovered and registered by the system for all **enabled** modules:
|
||||
|
||||
- `app/Modules/Example/Database/Migrations/`: Any migration files in this directory will be automatically registered and run with `php artisan migrate`.
|
||||
- `app/Modules/Example/Database/Seeders/`: Any seeder classes in this directory will be automatically run with `php artisan db:seed`.
|
||||
|
||||
##### Conventional Structure
|
||||
|
||||
While not automatically registered in the same way as migrations and seeders, it is best practice to follow standard Laravel application structure within your module:
|
||||
|
||||
```
|
||||
app/Modules/Example/
|
||||
├── Database/
|
||||
│ ├── Migrations/
|
||||
│ │ └── 2025_09_22_000000_create_example_table.php
|
||||
│ └── Seeders/
|
||||
│ └── ExampleSeeder.php
|
||||
├── Http/
|
||||
│ ├── Controllers/
|
||||
│ └── Requests/
|
||||
├── Models/
|
||||
│ └── Example.php
|
||||
├── Repositories/
|
||||
├── Resources/
|
||||
└── ExampleModule.php
|
||||
```
|
||||
|
||||
#### Creating a New Module
|
||||
|
||||
1. **Create the directory**: Create a new folder for your module in `app/Modules/`. For example, `app/Modules/NewFeature`.
|
||||
|
||||
2. **Create the Module Class**: Inside the new directory, create the main module class. The class name should be the module name suffixed with `Module`. For `NewFeature`, it would be `NewFeatureModule.php`.
|
||||
|
||||
```php
|
||||
// app/Modules/NewFeature/NewFeatureModule.php
|
||||
<?php
|
||||
|
||||
namespace App\Modules\NewFeature;
|
||||
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class NewFeatureModule implements ModuleContract
|
||||
{
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return true; // Or use config('modules.new_feature.enabled', false)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Add Components**: Add migrations, seeders, models, controllers, etc., to your module following the structure outlined above.
|
||||
|
||||
4. **Enable the Module**: Ensure the `isEnabled()` method in your module class returns `true`. Only enabled modules will have their migrations and seeders registered.
|
||||
|
||||
#### Usage via Helpers
|
||||
|
||||
Use the global helper functions to interact with modules throughout the application.
|
||||
|
||||
- **Get the Module Repository**:
|
||||
```php
|
||||
$repository = modular();
|
||||
```
|
||||
|
||||
- **Get All Enabled Modules**:
|
||||
```php
|
||||
$enabledModules = modules(); // Returns a Collection of BaseModule objects
|
||||
|
||||
foreach ($enabledModules as $module) {
|
||||
echo $module->name;
|
||||
}
|
||||
```
|
||||
|
||||
- **Get a Specific Module Instance**:
|
||||
```php
|
||||
$invoiceModule = module('Invoice'); // Returns instance of InvoiceModule
|
||||
|
||||
if ($invoiceModule->isEnabled()) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
- **Get the Modules Path**:
|
||||
```php
|
||||
$path = modules_path('Invoice/Database'); // app/Modules/Invoice/Database
|
||||
```
|
||||
</laravel-boost-guidelines>
|
||||
12
README.md
12
README.md
@@ -1 +1,13 @@
|
||||
# F
|
||||
|
||||
# Installation
|
||||
```bash
|
||||
# Clone
|
||||
|
||||
composer install
|
||||
cp .env .env.example
|
||||
|
||||
touch database/database.sqlite
|
||||
|
||||
php artisan migrate --seed
|
||||
```
|
||||
|
||||
BIN
app/.DS_Store
vendored
BIN
app/.DS_Store
vendored
Binary file not shown.
46
app/Filament/Pages/Auth/Login.php
Normal file
46
app/Filament/Pages/Auth/Login.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Auth;
|
||||
|
||||
use Filament\Auth\Pages\Login as BaseLogin;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class Login extends BaseLogin
|
||||
{
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
$this->getLoginFormComponent(),
|
||||
$this->getPasswordFormComponent(),
|
||||
$this->getRememberFormComponent(),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getLoginFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('login')
|
||||
->label('Email or Phone Number')
|
||||
->required()
|
||||
->autofocus();
|
||||
}
|
||||
|
||||
protected function getCredentialsFromFormData(array $data): array
|
||||
{
|
||||
$login_type = filter_var($data['login'], FILTER_VALIDATE_EMAIL) ? 'email' : 'phone_number';
|
||||
|
||||
return [
|
||||
$login_type => $data['login'],
|
||||
'password' => $data['password'],
|
||||
];
|
||||
}
|
||||
|
||||
protected function throwFailureValidationException(): never
|
||||
{
|
||||
throw ValidationException::withMessages([
|
||||
'data.login' => __('filament-panels::auth/pages/login.messages.failed'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
53
app/Filament/Pages/Auth/Register.php
Normal file
53
app/Filament/Pages/Auth/Register.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages\Auth;
|
||||
|
||||
use App\Modules\PhoneNumberVerification\Rules\PhoneNumberVerificationRule;
|
||||
use Filament\Auth\Pages\Register as BaseRegister;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
|
||||
class Register extends BaseRegister
|
||||
{
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->schema([
|
||||
$this->getNameFormComponent(),
|
||||
$this->getPhoneNumberFormComponent(),
|
||||
$this->getPasswordFormComponent(),
|
||||
$this->getPasswordConfirmationFormComponent(),
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getPhoneNumberFormComponent(): TextInput
|
||||
{
|
||||
return TextInput::make('phone_number')
|
||||
->prefix('+993')
|
||||
->label('Telefon')
|
||||
->mask('99 99 99 99')
|
||||
->rules(['bail', 'required', new PhoneNumberVerificationRule, 'unique:users,phone_number'])
|
||||
->autofocus();
|
||||
}
|
||||
|
||||
protected function beforeValidate(): void
|
||||
{
|
||||
info(['$this->data' => $this->data]);
|
||||
if (isset($this->data['phone_number'])) {
|
||||
$this->data['phone_number'] = str_replace(' ', '', $this->data['phone_number']);
|
||||
}
|
||||
}
|
||||
|
||||
protected function afterRegister(): void
|
||||
{
|
||||
module('SMS')->verify($this->data['phone_number']);
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeRegister(array $data): array
|
||||
{
|
||||
$data['phone_number'] = str_replace(' ', '', $data['phone_number']);
|
||||
$data['email'] = $data['phone_number'].'@telekechi.com';
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
namespace App\Filament\Resources\Banks\Banks;
|
||||
|
||||
use App\Filament\Resources\BankResource\Pages;
|
||||
use App\Filament\Resources\Banks\Pages\CreateBank;
|
||||
use App\Filament\Resources\Banks\Pages\EditBank;
|
||||
use App\Filament\Resources\Banks\Pages\ListBanks;
|
||||
use App\Modules\Bank\Models\Bank;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Support\Carbon;
|
||||
@@ -16,14 +21,14 @@ class BankResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Bank::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Settings';
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Settings';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-building-library';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-building-library';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->required()
|
||||
->unique(),
|
||||
@@ -67,13 +72,13 @@ class BankResource extends Resource
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -88,9 +93,9 @@ class BankResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListBanks::route('/'),
|
||||
'create' => Pages\CreateBank::route('/create'),
|
||||
'edit' => Pages\EditBank::route('/{record}/edit'),
|
||||
'index' => ListBanks::route('/'),
|
||||
'create' => CreateBank::route('/create'),
|
||||
'edit' => EditBank::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BankResource\Pages;
|
||||
namespace App\Filament\Resources\Banks\Pages;
|
||||
|
||||
use App\Filament\Resources\BankResource;
|
||||
use App\Filament\Resources\Banks\Banks\BankResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateBank extends CreateRecord
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BankResource\Pages;
|
||||
namespace App\Filament\Resources\Banks\Pages;
|
||||
|
||||
use App\Filament\Resources\BankResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\Banks\Banks\BankResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditBank extends EditRecord
|
||||
@@ -13,7 +13,7 @@ class EditBank extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\BankResource\Pages;
|
||||
namespace App\Filament\Resources\Banks\Pages;
|
||||
|
||||
use App\Filament\Resources\BankResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\Banks\Banks\BankResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListBanks extends ListRecords
|
||||
@@ -13,7 +13,7 @@ class ListBanks extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Codes\PaymentPurposeCodeResource\Pages;
|
||||
namespace App\Filament\Resources\Codes\PaymentPurposeCodes\Pages;
|
||||
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodeResource;
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodes\PaymentPurposeCodes\PaymentPurposeCodeResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreatePaymentPurposeCode extends CreateRecord
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Codes\PaymentPurposeCodeResource\Pages;
|
||||
namespace App\Filament\Resources\Codes\PaymentPurposeCodes\Pages;
|
||||
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodeResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodes\PaymentPurposeCodes\PaymentPurposeCodeResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditPaymentPurposeCode extends EditRecord
|
||||
@@ -13,7 +13,7 @@ class EditPaymentPurposeCode extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Codes\PaymentPurposeCodeResource\Pages;
|
||||
namespace App\Filament\Resources\Codes\PaymentPurposeCodes\Pages;
|
||||
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodeResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodes\PaymentPurposeCodes\PaymentPurposeCodeResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListPaymentPurposeCodes extends ListRecords
|
||||
@@ -13,7 +13,7 @@ class ListPaymentPurposeCodes extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Codes;
|
||||
namespace App\Filament\Resources\Codes\PaymentPurposeCodes\PaymentPurposeCodes;
|
||||
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodeResource\Pages;
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodes\Pages\CreatePaymentPurposeCode;
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodes\Pages\EditPaymentPurposeCode;
|
||||
use App\Filament\Resources\Codes\PaymentPurposeCodes\Pages\ListPaymentPurposeCodes;
|
||||
use App\Modules\PaymentPurposeCode\Models\PaymentPurposeCode;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
@@ -15,14 +20,14 @@ class PaymentPurposeCodeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = PaymentPurposeCode::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-cube';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-cube';
|
||||
|
||||
protected static ?string $navigationGroup = 'Settings';
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Settings';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('code')
|
||||
->integer()
|
||||
->unique()
|
||||
@@ -55,13 +60,13 @@ class PaymentPurposeCodeResource extends Resource
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -76,9 +81,9 @@ class PaymentPurposeCodeResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListPaymentPurposeCodes::route('/'),
|
||||
'create' => Pages\CreatePaymentPurposeCode::route('/create'),
|
||||
'edit' => Pages\EditPaymentPurposeCode::route('/{record}/edit'),
|
||||
'index' => ListPaymentPurposeCodes::route('/'),
|
||||
'create' => CreatePaymentPurposeCode::route('/create'),
|
||||
'edit' => EditPaymentPurposeCode::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Company\UserCompanyResource\Pages;
|
||||
namespace App\Filament\Resources\Company\UserCompanies\Pages;
|
||||
|
||||
use App\Filament\Resources\Company\UserCompanyResource;
|
||||
use App\Filament\Resources\Company\UserCompanies\UserCompanies\UserCompanyResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateUserCompany extends CreateRecord
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Company\UserCompanyResource\Pages;
|
||||
namespace App\Filament\Resources\Company\UserCompanies\Pages;
|
||||
|
||||
use App\Filament\Resources\Company\UserCompanyResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\Company\UserCompanies\UserCompanies\UserCompanyResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditUserCompany extends EditRecord
|
||||
@@ -13,7 +13,7 @@ class EditUserCompany extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Company\UserCompanyResource\Pages;
|
||||
namespace App\Filament\Resources\Company\UserCompanies\Pages;
|
||||
|
||||
use App\Filament\Resources\Company\UserCompanyResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\Company\UserCompanies\UserCompanies\UserCompanyResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListUserCompanies extends ListRecords
|
||||
@@ -13,7 +13,7 @@ class ListUserCompanies extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\Company;
|
||||
namespace App\Filament\Resources\Company\UserCompanies\UserCompanies;
|
||||
|
||||
use App\Filament\Resources\Company\UserCompanyResource\Pages;
|
||||
use App\Filament\Resources\Company\UserCompanies\Pages\CreateUserCompany;
|
||||
use App\Filament\Resources\Company\UserCompanies\Pages\EditUserCompany;
|
||||
use App\Filament\Resources\Company\UserCompanies\Pages\ListUserCompanies;
|
||||
use App\Modules\Bank\Repositories\BankRepository;
|
||||
use App\Modules\UserCompany\Models\UserCompany;
|
||||
use App\Modules\UserCompany\Types\CompanyType;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\ToggleColumn;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
@@ -21,14 +25,14 @@ class UserCompanyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = UserCompany::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Company';
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Company';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-building-office';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-building-office';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
Select::make('company_type')
|
||||
->label('Kompaniýa görnüşi')
|
||||
->native(false)
|
||||
@@ -83,12 +87,12 @@ class UserCompanyResource extends Resource
|
||||
->filters([
|
||||
Filter::make('default'),
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -103,9 +107,9 @@ class UserCompanyResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListUserCompanies::route('/'),
|
||||
'create' => Pages\CreateUserCompany::route('/create'),
|
||||
'edit' => Pages\EditUserCompany::route('/{record}/edit'),
|
||||
'index' => ListUserCompanies::route('/'),
|
||||
'create' => CreateUserCompany::route('/create'),
|
||||
'edit' => EditUserCompany::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
namespace App\Filament\Resources\IncomingLetters\IncomingLetters;
|
||||
|
||||
use App\Filament\Resources\IncomingLetterResource\Pages;
|
||||
use App\Filament\Resources\IncomingLetters\Pages\CreateIncomingLetter;
|
||||
use App\Filament\Resources\IncomingLetters\Pages\EditIncomingLetter;
|
||||
use App\Filament\Resources\IncomingLetters\Pages\ListIncomingLetters;
|
||||
use App\Modules\IncomingLetter\Models\IncomingLetter;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class IncomingLetterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = IncomingLetter::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-arrow-down';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-document-arrow-down';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('number')
|
||||
->integer()
|
||||
->required()
|
||||
@@ -38,13 +44,15 @@ class IncomingLetterResource extends Resource
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('number', 'desc')
|
||||
->columns([
|
||||
TextColumn::make('number')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
->sortable(query: fn (Builder $query, string $direction) => $query->orderByRaw("CAST(number AS UNSIGNED) $direction")),
|
||||
|
||||
TextColumn::make('name')
|
||||
->searchable(),
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
@@ -55,13 +63,13 @@ class IncomingLetterResource extends Resource
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -76,9 +84,9 @@ class IncomingLetterResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListIncomingLetters::route('/'),
|
||||
'create' => Pages\CreateIncomingLetter::route('/create'),
|
||||
'edit' => Pages\EditIncomingLetter::route('/{record}/edit'),
|
||||
'index' => ListIncomingLetters::route('/'),
|
||||
'create' => CreateIncomingLetter::route('/create'),
|
||||
'edit' => EditIncomingLetter::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\IncomingLetterResource\Pages;
|
||||
namespace App\Filament\Resources\IncomingLetters\Pages;
|
||||
|
||||
use App\Filament\Resources\IncomingLetterResource;
|
||||
use App\Filament\Resources\IncomingLetters\IncomingLetters\IncomingLetterResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateIncomingLetter extends CreateRecord
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\IncomingLetterResource\Pages;
|
||||
namespace App\Filament\Resources\IncomingLetters\Pages;
|
||||
|
||||
use App\Filament\Resources\IncomingLetterResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\IncomingLetters\IncomingLetters\IncomingLetterResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditIncomingLetter extends EditRecord
|
||||
@@ -13,7 +13,7 @@ class EditIncomingLetter extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\IncomingLetterResource\Pages;
|
||||
namespace App\Filament\Resources\IncomingLetters\Pages;
|
||||
|
||||
use App\Filament\Resources\IncomingLetterResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\IncomingLetters\IncomingLetters\IncomingLetterResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListIncomingLetters extends ListRecords
|
||||
@@ -13,7 +13,7 @@ class ListIncomingLetters extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Resources\OutgoingLetterResource\Pages;
|
||||
use App\Modules\OutgoingLetter\Models\OutgoingLetter;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class OutgoingLetterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = OutgoingLetter::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-document-arrow-up';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
TextInput::make('number')
|
||||
->required(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('number'),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListOutgoingLetters::route('/'),
|
||||
'create' => Pages\CreateOutgoingLetter::route('/create'),
|
||||
'edit' => Pages\EditOutgoingLetter::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\OutgoingLetters\OutgoingLetters;
|
||||
|
||||
use App\Filament\Resources\OutgoingLetters\Pages\CreateOutgoingLetter;
|
||||
use App\Filament\Resources\OutgoingLetters\Pages\EditOutgoingLetter;
|
||||
use App\Filament\Resources\OutgoingLetters\Pages\ListOutgoingLetters;
|
||||
use App\Modules\OutgoingLetter\Models\OutgoingLetter;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class OutgoingLetterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = OutgoingLetter::class;
|
||||
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-document-arrow-up';
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('number')
|
||||
->integer()
|
||||
->required()
|
||||
->default(fn () => getLatestNumber() + 1),
|
||||
|
||||
TextInput::make('name')
|
||||
->required(),
|
||||
|
||||
FileUpload::make('main_file'),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->defaultSort('number', 'desc')
|
||||
->columns([
|
||||
TextColumn::make('number')
|
||||
->searchable()
|
||||
->sortable(query: fn (Builder $query, string $direction) => $query->orderByRaw("CAST(number AS UNSIGNED) $direction")),
|
||||
|
||||
TextColumn::make('name')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->sinceTooltip()
|
||||
->formatStateUsing(fn (?Carbon $state) => $state?->format('H:i, d.m.Y')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListOutgoingLetters::route('/'),
|
||||
'create' => CreateOutgoingLetter::route('/create'),
|
||||
'edit' => EditOutgoingLetter::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\OutgoingLetterResource\Pages;
|
||||
namespace App\Filament\Resources\OutgoingLetters\Pages;
|
||||
|
||||
use App\Filament\Resources\OutgoingLetterResource;
|
||||
use App\Filament\Resources\OutgoingLetters\OutgoingLetters\OutgoingLetterResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateOutgoingLetter extends CreateRecord
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\OutgoingLetterResource\Pages;
|
||||
namespace App\Filament\Resources\OutgoingLetters\Pages;
|
||||
|
||||
use App\Filament\Resources\OutgoingLetterResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\OutgoingLetters\OutgoingLetters\OutgoingLetterResource;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditOutgoingLetter extends EditRecord
|
||||
@@ -13,7 +13,7 @@ class EditOutgoingLetter extends EditRecord
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\OutgoingLetterResource\Pages;
|
||||
namespace App\Filament\Resources\OutgoingLetters\Pages;
|
||||
|
||||
use App\Filament\Resources\OutgoingLetterResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\OutgoingLetters\OutgoingLetters\OutgoingLetterResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListOutgoingLetters extends ListRecords
|
||||
@@ -13,7 +13,7 @@ class ListOutgoingLetters extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrderResource\Actions;
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrders\Actions;
|
||||
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\PaymentOrder\Models\PaymentOrder;
|
||||
@@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrderResource\Pages;
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrders\Pages;
|
||||
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrderResource;
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrders\PaymentOrders\PaymentOrderResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreatePaymentOrder extends CreateRecord
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrderResource\Pages;
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrders\Pages;
|
||||
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrderResource;
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrderResource\Actions\ExportToWord;
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrders\Actions\ExportToWord;
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrders\PaymentOrders\PaymentOrderResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Pages\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditPaymentOrder extends EditRecord
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrderResource\Pages;
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrders\Pages;
|
||||
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrderResource;
|
||||
use Filament\Actions;
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrders\PaymentOrders\PaymentOrderResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListPaymentOrders extends ListRecords
|
||||
@@ -13,7 +13,7 @@ class ListPaymentOrders extends ListRecords
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\PaymentOrder;
|
||||
namespace App\Filament\Resources\PaymentOrder\PaymentOrders\PaymentOrders;
|
||||
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrderResource\Pages;
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrders\Pages\CreatePaymentOrder;
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrders\Pages\EditPaymentOrder;
|
||||
use App\Filament\Resources\PaymentOrder\PaymentOrders\Pages\ListPaymentOrders;
|
||||
use App\Modules\PaymentOrder\Models\PaymentOrder;
|
||||
use Filament\Forms\Components\Fieldset;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Schemas\Components\Fieldset;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
@@ -17,12 +21,12 @@ class PaymentOrderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = PaymentOrder::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-receipt-percent';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-receipt-percent';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
Fieldset::make(__('Töleg'))
|
||||
->schema([
|
||||
TextInput::make('number')
|
||||
@@ -100,12 +104,12 @@ class PaymentOrderResource extends Resource
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -120,9 +124,9 @@ class PaymentOrderResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListPaymentOrders::route('/'),
|
||||
'create' => Pages\CreatePaymentOrder::route('/create'),
|
||||
'edit' => Pages\EditPaymentOrder::route('/{record}/edit'),
|
||||
'index' => ListPaymentOrders::route('/'),
|
||||
'create' => CreatePaymentOrder::route('/create'),
|
||||
'edit' => EditPaymentOrder::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Controllers/Auth/OTPVericationController.php
Normal file
30
app/Http/Controllers/Auth/OTPVericationController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Modules\OTPVerification\Rules\OTPVerificationRule;
|
||||
use App\Modules\PhoneNumberVerification\Rules\PhoneNumberVerificationRule;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OTPVericationController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('pages.auth.otp-verify');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'code' => ['required', 'integer', new OTPVerificationRule(auth()->user()->phone_number)],
|
||||
]);
|
||||
|
||||
User::find(auth()->id())->update([
|
||||
'phone_number_verified_at' => now(),
|
||||
]);
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
29
app/Http/Controllers/Auth/OTPVerificationController.php
Normal file
29
app/Http/Controllers/Auth/OTPVerificationController.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\User;
|
||||
use App\Modules\OTPVerification\Rules\OTPVerificationRule;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OTPVerificationController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('pages.auth.otp-verify');
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'code' => ['required', 'integer', new OTPVerificationRule(auth()->user()->phone_number)],
|
||||
]);
|
||||
|
||||
auth()->user()->update([
|
||||
'phone_number_verified_at' => now(),
|
||||
]);
|
||||
|
||||
return redirect('/');
|
||||
}
|
||||
}
|
||||
@@ -2,86 +2,10 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Modules\Invoice\Actions\GenerateInvoiceExcell;
|
||||
use App\Modules\Invoice\Data\InvoiceExcellData;
|
||||
use App\Modules\Invoice\Data\InvoiceItem;
|
||||
use Carbon\Carbon;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
public function index(): string
|
||||
{
|
||||
return 'F';
|
||||
GenerateInvoiceExcell::make()
|
||||
->setTemplateFile(app_path('Modules/Invoice/Resources/Docs/invoice.xls'))
|
||||
->setData(new InvoiceExcellData(
|
||||
number: random_int(1, 99),
|
||||
date: new Carbon('2024-11-08'),
|
||||
seller_firm_type: 'Telekeçi',
|
||||
seller_firm_name: 'Nurmuhammet Allanov Parahatowiç',
|
||||
seller_ssb: '201126532321',
|
||||
seller_bank_name: 'Türkmenistanyň „Halkbank“ paýdarlar täjirçilik banky',
|
||||
seller_bank_hb_1: '23206934160169902250000',
|
||||
seller_bank_hb_2: '21101934110100700005000',
|
||||
seller_bank_city: 'Aşgabat',
|
||||
seller_bank_bab: '390101601',
|
||||
|
||||
buyer: 'Türkmenistanyň „Türkmenbaşy“ paýdarlar täjirçilik banky',
|
||||
buyer_address: '744000 Aşgabat ş., Çandebil şaýoly köç., 121,',
|
||||
buyer_bank: 'Türkmenistanyň Merkezi Banky',
|
||||
buyer_bank_address: 'Aşgabat ş.',
|
||||
buyer_bank_data: sprintf('şahsy salgyt belgisi %s, MFO %s, Hasap № %s', '101301000408', '390101304', '21101934110100300007000'),
|
||||
|
||||
items: [
|
||||
new InvoiceItem(
|
||||
name: 'Programma üpjünçiligini hyzmat etmek barada',
|
||||
unit: 'ay',
|
||||
quantity: 2,
|
||||
unit_price: 100000,
|
||||
vat: null,
|
||||
vat_excluded: null,
|
||||
vat_percentage: null,
|
||||
vat_tmt: null,
|
||||
total: 200000,
|
||||
),
|
||||
new InvoiceItem(
|
||||
name: 'Programma üpjünçiligini hyzmat etmek barada',
|
||||
unit: 'ay',
|
||||
quantity: 2,
|
||||
unit_price: 100000,
|
||||
vat: null,
|
||||
vat_excluded: null,
|
||||
vat_percentage: null,
|
||||
vat_tmt: null,
|
||||
total: 200000,
|
||||
),
|
||||
new InvoiceItem(
|
||||
name: 'Programma üpjünçiligini hyzmat etmek barada',
|
||||
unit: 'ay',
|
||||
quantity: 2,
|
||||
unit_price: 100000,
|
||||
vat: null,
|
||||
vat_excluded: null,
|
||||
vat_percentage: null,
|
||||
vat_tmt: null,
|
||||
total: 200000,
|
||||
),
|
||||
new InvoiceItem(
|
||||
name: 'Programma üpjünçiligini işläp taýýarlamak barada',
|
||||
unit: 'ay',
|
||||
quantity: 2,
|
||||
unit_price: 100000,
|
||||
vat: null,
|
||||
vat_excluded: null,
|
||||
vat_percentage: null,
|
||||
vat_tmt: null,
|
||||
total: 200000,
|
||||
),
|
||||
]
|
||||
))
|
||||
->handle()
|
||||
->save();
|
||||
|
||||
return 'F';
|
||||
return 'f';
|
||||
}
|
||||
}
|
||||
|
||||
24
app/Http/Middleware/EnsurePhoneNumberIsValidated.php
Normal file
24
app/Http/Middleware/EnsurePhoneNumberIsValidated.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class EnsurePhoneNumberIsValidated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if ($request->user() && ! $request->user()->phone_number_verified_at) {
|
||||
return redirect()->route('otp.verify');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
24
app/Http/Middleware/RedirectIfPhoneNumberIsVerified.php
Normal file
24
app/Http/Middleware/RedirectIfPhoneNumberIsVerified.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class RedirectIfPhoneNumberIsVerified
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||
*/
|
||||
public function handle(Request $request, Closure $next): Response
|
||||
{
|
||||
if ($request->user() && $request->user()->phone_number_verified_at) {
|
||||
return redirect('/');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,30 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Database\Factories\UserFactory;
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Filament\Panel;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
|
||||
class User extends Authenticatable
|
||||
class User extends Authenticatable implements FilamentUser
|
||||
{
|
||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||
/** @use HasFactory<UserFactory> */
|
||||
use HasFactory, Notifiable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'phone_number',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
@@ -34,4 +48,12 @@ class User extends Authenticatable
|
||||
'password' => 'hashed',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Panel guard
|
||||
*/
|
||||
public function canAccessPanel(Panel $panel): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
BIN
app/Modules/.DS_Store
vendored
BIN
app/Modules/.DS_Store
vendored
Binary file not shown.
@@ -43,6 +43,6 @@ class AppHelpersModule implements ModuleContract
|
||||
*/
|
||||
public function hasFilamentResource(): bool
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Excell\Types\RichText\Traits;
|
||||
namespace App\Modules\Excell\Types\iRichText\Traits;
|
||||
|
||||
trait HasExcellRichTextWrappers {}
|
||||
|
||||
76
app/Modules/Invoice/Examples/InvoiceExcellExample.php
Normal file
76
app/Modules/Invoice/Examples/InvoiceExcellExample.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
use App\Modules\Invoice\Actions\GenerateInvoiceExcell;
|
||||
use App\Modules\Invoice\Data\InvoiceExcellData;
|
||||
use App\Modules\Invoice\Data\InvoiceItem;
|
||||
use Carbon\Carbon;
|
||||
|
||||
GenerateInvoiceExcell::make()
|
||||
->setTemplateFile(app_path('Modules/Invoice/Resources/Docs/invoice.xls'))
|
||||
->setData(new InvoiceExcellData(
|
||||
number: random_int(1, 99),
|
||||
date: new Carbon('2024-11-08'),
|
||||
seller_firm_type: 'Telekeçi',
|
||||
seller_firm_name: 'Nurmuhammet Allanov Parahatowiç',
|
||||
seller_ssb: '201126532321',
|
||||
seller_bank_name: 'Türkmenistanyň „Halkbank“ paýdarlar täjirçilik banky',
|
||||
seller_bank_hb_1: '23206934160169902250000',
|
||||
seller_bank_hb_2: '21101934110100700005000',
|
||||
seller_bank_city: 'Aşgabat',
|
||||
seller_bank_bab: '390101601',
|
||||
|
||||
buyer: 'Türkmenistanyň „Türkmenbaşy“ paýdarlar täjirçilik banky',
|
||||
buyer_address: '744000 Aşgabat ş., Çandebil şaýoly köç., 121,',
|
||||
buyer_bank: 'Türkmenistanyň Merkezi Banky',
|
||||
buyer_bank_address: 'Aşgabat ş.',
|
||||
buyer_bank_data: sprintf('şahsy salgyt belgisi %s, MFO %s, Hasap № %s', '101301000408', '390101304', '21101934110100300007000'),
|
||||
|
||||
items: [
|
||||
new InvoiceItem(
|
||||
name: 'Programma üpjünçiligini hyzmat etmek barada',
|
||||
unit: 'ay',
|
||||
quantity: 2,
|
||||
unit_price: 100000,
|
||||
vat: null,
|
||||
vat_excluded: null,
|
||||
vat_percentage: null,
|
||||
vat_tmt: null,
|
||||
total: 200000,
|
||||
),
|
||||
new InvoiceItem(
|
||||
name: 'Programma üpjünçiligini hyzmat etmek barada',
|
||||
unit: 'ay',
|
||||
quantity: 2,
|
||||
unit_price: 100000,
|
||||
vat: null,
|
||||
vat_excluded: null,
|
||||
vat_percentage: null,
|
||||
vat_tmt: null,
|
||||
total: 200000,
|
||||
),
|
||||
new InvoiceItem(
|
||||
name: 'Programma üpjünçiligini hyzmat etmek barada',
|
||||
unit: 'ay',
|
||||
quantity: 2,
|
||||
unit_price: 100000,
|
||||
vat: null,
|
||||
vat_excluded: null,
|
||||
vat_percentage: null,
|
||||
vat_tmt: null,
|
||||
total: 200000,
|
||||
),
|
||||
new InvoiceItem(
|
||||
name: 'Programma üpjünçiligini işläp taýýarlamak barada',
|
||||
unit: 'ay',
|
||||
quantity: 2,
|
||||
unit_price: 100000,
|
||||
vat: null,
|
||||
vat_excluded: null,
|
||||
vat_percentage: null,
|
||||
vat_tmt: null,
|
||||
total: 200000,
|
||||
),
|
||||
]
|
||||
))
|
||||
->handle()
|
||||
->save();
|
||||
@@ -47,8 +47,6 @@ class ModuleRepository
|
||||
|
||||
/**
|
||||
* Set modules
|
||||
*
|
||||
* @param bool|bool $withDisabled
|
||||
*/
|
||||
public function setModules(bool $withDisabled = false): void
|
||||
{
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\OTPVerification\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OTPVerificationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
public function show(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy(Request $request): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('otp_verifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('username');
|
||||
$table->string('code');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('otp_verifications');
|
||||
}
|
||||
};
|
||||
25
app/Modules/OTPVerification/Models/OTPVerification.php
Normal file
25
app/Modules/OTPVerification/Models/OTPVerification.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\OTPVerification\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $username
|
||||
* @property string $code
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*/
|
||||
class OTPVerification extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*/
|
||||
protected $table = 'otp_verifications';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*/
|
||||
protected $fillable = ['username', 'code'];
|
||||
}
|
||||
48
app/Modules/OTPVerification/OTPVerificationModule.php
Normal file
48
app/Modules/OTPVerification/OTPVerificationModule.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\OTPVerification;
|
||||
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class OTPVerificationModule implements ModuleContract
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Module is enabled
|
||||
*/
|
||||
protected bool $enabled = true;
|
||||
|
||||
/**
|
||||
* Check if is module enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable module
|
||||
*/
|
||||
public function disable(): void
|
||||
{
|
||||
$this->enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable module
|
||||
*/
|
||||
public function enable(): void
|
||||
{
|
||||
$this->enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module has a filament resource
|
||||
*/
|
||||
public function hasFilamentResource(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\OTPVerification\Repositories;
|
||||
|
||||
use App\Modules\OTPVerification\Models\OTPVerification;
|
||||
use App\Modules\SMS\Repositories\SMSRepository;
|
||||
|
||||
class OTPVerificationRepository
|
||||
{
|
||||
/**
|
||||
* Send a sms verification
|
||||
*/
|
||||
public static function sendSMSVerification(string|int $phone_number): ?OTPVerification
|
||||
{
|
||||
/* for apple testing */
|
||||
$phone_code = ($phone_number == '61126667') ? 77777 : rand(10000, 99999);
|
||||
|
||||
$verification = OTPVerification::where(['username' => $phone_number])->first();
|
||||
$verification
|
||||
? $verification->update(['code' => $phone_code])
|
||||
: OTPVerification::create(['username' => $phone_number, 'code' => $phone_code]);
|
||||
|
||||
SMSRepository::sendSMS($phone_number, 'Tassyklaýyş belgi: '.$phone_code);
|
||||
|
||||
return $verification;
|
||||
}
|
||||
}
|
||||
32
app/Modules/OTPVerification/Rules/OTPVerificationRule.php
Normal file
32
app/Modules/OTPVerification/Rules/OTPVerificationRule.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\OTPVerification\Rules;
|
||||
|
||||
use App\Modules\OTPVerification\Models\OTPVerification;
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class OTPVerificationRule implements ValidationRule
|
||||
{
|
||||
public function __construct(public null|int|string $username)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the validation rule.
|
||||
*
|
||||
* @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
if (! $value || ! $this->username) {
|
||||
$fail(__('Write a correct data please'));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OTPVerification::where('username', $this->username)
|
||||
->where('code', $value)
|
||||
->existsOr(fn () => $fail(__('Write a correct data please')));
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Modules\PaymentOrder\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
@@ -23,7 +24,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property string $a_bank
|
||||
* @property string $a_hb_1
|
||||
* @property string $a_hb_2
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $deleted_at
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $deleted_at
|
||||
*/
|
||||
class PaymentOrder extends Model {}
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
|
||||
namespace App\Modules\PaymentPurposeCode\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $code
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property Carbon\Carbon $updated_at
|
||||
* @property null|Carbon $created_at
|
||||
* @property null|Carbon $updated_at
|
||||
*/
|
||||
class PaymentPurposeCode extends Model {}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\PhoneNumberVerification;
|
||||
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\ModuleContract;
|
||||
|
||||
class PhoneNumberVerificationModule implements ModuleContract
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Module is enabled
|
||||
*/
|
||||
protected bool $enabled = true;
|
||||
|
||||
/**
|
||||
* Check if is module enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable module
|
||||
*/
|
||||
public function disable(): void
|
||||
{
|
||||
$this->enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable module
|
||||
*/
|
||||
public function enable(): void
|
||||
{
|
||||
$this->enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module has a filament resource
|
||||
*/
|
||||
public function hasFilamentResource(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\PhoneNumberVerification\Repositories;
|
||||
|
||||
class PhoneNumberVerificationRepository {}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\PhoneNumberVerification\Rules;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
|
||||
class PhoneNumberVerificationRule implements ValidationRule
|
||||
{
|
||||
/**
|
||||
* Run the validation rule.
|
||||
*
|
||||
* @param \Closure(string, ?string=): \Illuminate\Translation\PotentiallyTranslatedString $fail
|
||||
*/
|
||||
public function validate(string $attribute, mixed $value, Closure $fail): void
|
||||
{
|
||||
if (! is_numeric($value)) {
|
||||
$fail('Telefon belgisi diňe sanlardan ybarat bolmaly.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$number = (int) $value;
|
||||
|
||||
$isValid = ($number >= 61000000 && $number <= 65999999) || ($number >= 71000000 && $number <= 71999999);
|
||||
|
||||
if (! $isValid) {
|
||||
$fail('Telefon belgisi nädogry aralykda.');
|
||||
}
|
||||
}
|
||||
}
|
||||
36
app/Modules/SMS/Repositories/SMSRepository.php
Normal file
36
app/Modules/SMS/Repositories/SMSRepository.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\SMS\Repositories;
|
||||
|
||||
use Exception;
|
||||
use Illuminate\Http\Client\PendingRequest;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SMSRepository
|
||||
{
|
||||
/**
|
||||
* Send a sms
|
||||
*/
|
||||
public static function sendSMS(string|int $phone, string|int $message): mixed
|
||||
{
|
||||
$response = Http::retry(
|
||||
times: 3,
|
||||
sleepMilliseconds: 50,
|
||||
throw: false,
|
||||
when: function (Exception $exception, PendingRequest $request) {
|
||||
Log::error('Exception: ', [
|
||||
'message' => $exception->getMessage(),
|
||||
'line' => $exception->getLine(),
|
||||
]);
|
||||
|
||||
return true;
|
||||
})
|
||||
->post('http://216.250.14.144:3000/api/data', [
|
||||
'phone' => '+993'.$phone,
|
||||
'code' => $message,
|
||||
]);
|
||||
|
||||
return $response->body();
|
||||
}
|
||||
}
|
||||
75
app/Modules/SMS/SMSModule.php
Normal file
75
app/Modules/SMS/SMSModule.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\SMS;
|
||||
|
||||
use App\Modules\Makeable;
|
||||
use App\Modules\ModuleContract;
|
||||
use App\Modules\SMS\Repositories\SMSRepository;
|
||||
|
||||
class SMSModule implements ModuleContract
|
||||
{
|
||||
use Makeable;
|
||||
|
||||
/**
|
||||
* Module is enabled
|
||||
*/
|
||||
protected bool $enabled = true;
|
||||
|
||||
/**
|
||||
* Check if is module enabled
|
||||
*/
|
||||
public function isEnabled(): bool
|
||||
{
|
||||
return $this->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable module
|
||||
*/
|
||||
public function disable(): void
|
||||
{
|
||||
$this->enabled = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable module
|
||||
*/
|
||||
public function enable(): void
|
||||
{
|
||||
$this->enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if module has a filament resource
|
||||
*/
|
||||
public function hasFilamentResource(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a sms
|
||||
*/
|
||||
public function send(...$args)
|
||||
{
|
||||
return SMSRepository::sendSMS(...$args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a sms verification
|
||||
*/
|
||||
public function verify(...$args)
|
||||
{
|
||||
if (class_exists('App\Modules\OTPVerification\Repositories\OTPVerificationRepository') && module('OTPVerification')->isEnabled()) {
|
||||
$OTPVerificationRepository = 'App\Modules\OTPVerification\Repositories\OTPVerificationRepository';
|
||||
|
||||
return $OTPVerificationRepository::sendSMSVerification(...$args);
|
||||
}
|
||||
|
||||
if (app()->environment('local')) {
|
||||
throw new \Exception('OTPVerification module is not enabled');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -4,20 +4,22 @@ namespace App\Modules\UserCompany\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Modules\Bank\Models\Bank;
|
||||
use App\Modules\UserCompany\Types\CompanyType;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* @property int $id [primary,unique]
|
||||
* @property \App\Modules\UserCompany\Types\CompanyType $company_type
|
||||
* @property CompanyType $company_type
|
||||
* @property string $name
|
||||
* @property string $ssb [unique]
|
||||
* @property string $hb [unique]
|
||||
* @property bool $default [default: false]
|
||||
* @property int $user_id
|
||||
* @property int $bank_id
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
*/
|
||||
class UserCompany extends Model
|
||||
{
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
namespace App\Providers\Filament;
|
||||
|
||||
use App\Filament\Pages\Auth\Login;
|
||||
use App\Filament\Pages\Auth\Register;
|
||||
use App\Http\Middleware\EnsurePhoneNumberIsValidated;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
use Filament\Http\Middleware\DisableBladeIconComponents;
|
||||
use Filament\Http\Middleware\DispatchServingFilamentEvent;
|
||||
use Filament\Navigation\MenuItem;
|
||||
use Filament\Navigation\NavigationGroup;
|
||||
use Filament\Pages;
|
||||
use Filament\Pages\Dashboard;
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
@@ -28,14 +29,15 @@ class AdminPanelProvider extends PanelProvider
|
||||
->default()
|
||||
->id('panel')
|
||||
->path('panel')
|
||||
->login()
|
||||
->login(Login::class)
|
||||
->registration(Register::class)
|
||||
->colors([
|
||||
'primary' => Color::Amber,
|
||||
])
|
||||
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
|
||||
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
|
||||
->pages([
|
||||
Pages\Dashboard::class,
|
||||
Dashboard::class,
|
||||
])
|
||||
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
|
||||
->widgets([
|
||||
@@ -48,6 +50,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
ShareErrorsFromSession::class,
|
||||
VerifyCsrfToken::class,
|
||||
SubstituteBindings::class,
|
||||
EnsurePhoneNumberIsValidated::class,
|
||||
DisableBladeIconComponents::class,
|
||||
DispatchServingFilamentEvent::class,
|
||||
])
|
||||
@@ -60,13 +63,7 @@ class AdminPanelProvider extends PanelProvider
|
||||
])
|
||||
->unsavedChangesAlerts()
|
||||
->databaseTransactions()
|
||||
->brandName('Telekeçi')
|
||||
->userMenuItems([
|
||||
MenuItem::make()
|
||||
->label('Settings')
|
||||
->url(fn (): string => '/')
|
||||
->icon('heroicon-o-cog-6-tooth'),
|
||||
]);
|
||||
->brandName('Telekeçi');
|
||||
|
||||
return $panel;
|
||||
}
|
||||
|
||||
@@ -6,23 +6,25 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"filament/filament": "^3.2",
|
||||
"laravel/framework": "^11.9",
|
||||
"filament/filament": "~4.0",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.9",
|
||||
"phpoffice/phpspreadsheet": "^3.3",
|
||||
"phpoffice/phpword": "^1.3",
|
||||
"pxlrbt/filament-spotlight": "^1.3"
|
||||
"pxlrbt/filament-spotlight": "^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-ide-helper": "^3.2",
|
||||
"fakerphp/faker": "^1.23",
|
||||
"larastan/larastan": "^2.0",
|
||||
"filament/upgrade": "^4.0",
|
||||
"larastan/larastan": "^3.0",
|
||||
"laravel/boost": "^1.2",
|
||||
"laravel/pail": "^1.1",
|
||||
"laravel/pint": "^1.13",
|
||||
"laravel/sail": "^1.26",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.1",
|
||||
"pestphp/pest": "^3.4",
|
||||
"pestphp/pest": "^3.0",
|
||||
"pestphp/pest-plugin-laravel": "^3.0",
|
||||
"phpstan/phpstan": "*"
|
||||
},
|
||||
|
||||
4398
composer.lock
generated
4398
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -80,6 +80,11 @@ return [
|
||||
|
||||
'locale' => env('APP_LOCALE', 'en'),
|
||||
|
||||
'locales' => [
|
||||
'tk',
|
||||
'ru',
|
||||
],
|
||||
|
||||
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
|
||||
|
||||
'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'),
|
||||
|
||||
128
config/filament.php
Normal file
128
config/filament.php
Normal file
@@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
use Filament\Support\Commands\FileGenerators\FileGenerationFlag;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcasting
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By uncommenting the Laravel Echo configuration, you may connect Filament
|
||||
| to any Pusher-compatible websockets server.
|
||||
|
|
||||
| This will allow your users to receive real-time notifications.
|
||||
|
|
||||
*/
|
||||
|
||||
'broadcasting' => [
|
||||
|
||||
// 'echo' => [
|
||||
// 'broadcaster' => 'pusher',
|
||||
// 'key' => env('VITE_PUSHER_APP_KEY'),
|
||||
// 'cluster' => env('VITE_PUSHER_APP_CLUSTER'),
|
||||
// 'wsHost' => env('VITE_PUSHER_HOST'),
|
||||
// 'wsPort' => env('VITE_PUSHER_PORT'),
|
||||
// 'wssPort' => env('VITE_PUSHER_PORT'),
|
||||
// 'authEndpoint' => '/broadcasting/auth',
|
||||
// 'disableStats' => true,
|
||||
// 'encrypted' => true,
|
||||
// 'forceTLS' => true,
|
||||
// ],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the storage disk Filament will use to store files. You may use
|
||||
| any of the disks defined in the `config/filesystems.php`.
|
||||
|
|
||||
*/
|
||||
|
||||
'default_filesystem_disk' => env('FILAMENT_FILESYSTEM_DISK', 'public'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Assets Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the directory where Filament's assets will be published to. It
|
||||
| is relative to the `public` directory of your Laravel application.
|
||||
|
|
||||
| After changing the path, you should run `php artisan filament:assets`.
|
||||
|
|
||||
*/
|
||||
|
||||
'assets_path' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the directory that Filament will use to store cache files that
|
||||
| are used to optimize the registration of components.
|
||||
|
|
||||
| After changing the path, you should run `php artisan filament:cache-components`.
|
||||
|
|
||||
*/
|
||||
|
||||
'cache_path' => base_path('bootstrap/cache/filament'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Livewire Loading Delay
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This sets the delay before loading indicators appear.
|
||||
|
|
||||
| Setting this to 'none' makes indicators appear immediately, which can be
|
||||
| desirable for high-latency connections. Setting it to 'default' applies
|
||||
| Livewire's standard 200ms delay.
|
||||
|
|
||||
*/
|
||||
|
||||
'livewire_loading_delay' => 'default',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File Generation
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Artisan commands that generate files can be configured here by setting
|
||||
| configuration flags that will impact their location or content.
|
||||
|
|
||||
| Often, this is useful to preserve file generation behavior from a
|
||||
| previous version of Filament, to ensure consistency between older and
|
||||
| newer generated files. These flags are often documented in the upgrade
|
||||
| guide for the version of Filament you are upgrading to.
|
||||
|
|
||||
*/
|
||||
|
||||
'file_generation' => [
|
||||
'flags' => [
|
||||
FileGenerationFlag::EMBEDDED_PANEL_RESOURCE_SCHEMAS, // Define new forms and infolists inside the resource class instead of a separate schema class.
|
||||
FileGenerationFlag::EMBEDDED_PANEL_RESOURCE_TABLES, // Define new tables inside the resource class instead of a separate table class.
|
||||
FileGenerationFlag::PANEL_CLUSTER_CLASSES_OUTSIDE_DIRECTORIES, // Create new cluster classes outside of their directories. Not required if you run `php artisan filament:upgrade-directory-structure-to-v4`.
|
||||
FileGenerationFlag::PANEL_RESOURCE_CLASSES_OUTSIDE_DIRECTORIES, // Create new resource classes outside of their directories. Not required if you run `php artisan filament:upgrade-directory-structure-to-v4`.
|
||||
FileGenerationFlag::PARTIAL_IMPORTS, // Partially import components such as form fields and table columns instead of importing each component explicitly.
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| System Route Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the prefix used for the system routes that Filament registers,
|
||||
| such as the routes for downloading exports and failed import rows.
|
||||
|
|
||||
*/
|
||||
|
||||
'system_route_prefix' => 'filament',
|
||||
|
||||
];
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('phone_number')->unique()->nullable()->after('email');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('phone_number');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->softDeletes()->after('updated_at');
|
||||
$table->json('meta')->nullable()->after('phone_number');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropSoftDeletes();
|
||||
$table->dropColumn('meta');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -13,8 +13,8 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$seeders = [];
|
||||
// $seeders = modular()->databaseSeederClasses();
|
||||
// $seeders = [];
|
||||
$seeders = modular()->databaseSeederClasses();
|
||||
|
||||
$this->call($seeders);
|
||||
}
|
||||
|
||||
@@ -11,3 +11,4 @@ parameters:
|
||||
ignoreErrors:
|
||||
- '#Unsafe usage of new static#'
|
||||
- '#Static method Illuminate\\Log\\Logger::info\(\) invoked with 3 parameters, 1-2 required#'
|
||||
- '#PHPDoc type array<int, string> of property App\\Models\\User::\$hidden#'
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/fonts/filament/filament/inter/index.css
Normal file
1
public/fonts/filament/filament/inter/index.css
Normal file
@@ -0,0 +1 @@
|
||||
@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-cyrillic-ext-wght-normal-IYF56FF6.woff2") format("woff2-variations");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-cyrillic-wght-normal-JEOLYBOO.woff2") format("woff2-variations");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-greek-ext-wght-normal-EOVOK2B5.woff2") format("woff2-variations");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-greek-wght-normal-IRE366VL.woff2") format("woff2-variations");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-vietnamese-wght-normal-CE5GGD3W.woff2") format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-latin-ext-wght-normal-HA22NDSG.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-latin-wght-normal-NRMW37G5.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
public/js/filament/actions/actions.js
Normal file
1
public/js/filament/actions/actions.js
Normal file
@@ -0,0 +1 @@
|
||||
(()=>{var n=({livewireId:e})=>({actionNestingIndex:null,init(){window.addEventListener("sync-action-modals",t=>{t.detail.id===e&&this.syncActionModals(t.detail.newActionNestingIndex)})},syncActionModals(t){if(this.actionNestingIndex===t){this.actionNestingIndex!==null&&this.$nextTick(()=>this.openModal());return}if(this.actionNestingIndex!==null&&this.closeModal(),this.actionNestingIndex=t,this.actionNestingIndex!==null){if(!this.$el.querySelector(`#${this.generateModalId(t)}`)){this.$nextTick(()=>this.openModal());return}this.openModal()}},generateModalId(t){return`fi-${e}-action-`+t},openModal(){let t=this.generateModalId(this.actionNestingIndex);document.dispatchEvent(new CustomEvent("open-modal",{bubbles:!0,composed:!0,detail:{id:t}}))},closeModal(){let t=this.generateModalId(this.actionNestingIndex);document.dispatchEvent(new CustomEvent("close-modal-quietly",{bubbles:!0,composed:!0,detail:{id:t}}))}});document.addEventListener("alpine:init",()=>{window.Alpine.data("filamentActionModals",n)});})();
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
public/js/filament/forms/components/checkbox-list.js
Normal file
1
public/js/filament/forms/components/checkbox-list.js
Normal file
@@ -0,0 +1 @@
|
||||
function c({livewireId:s}){return{areAllCheckboxesChecked:!1,checkboxListOptions:[],search:"",visibleCheckboxListOptions:[],init(){this.checkboxListOptions=Array.from(this.$root.querySelectorAll(".fi-fo-checkbox-list-option")),this.updateVisibleCheckboxListOptions(),this.$nextTick(()=>{this.checkIfAllCheckboxesAreChecked()}),Livewire.hook("commit",({component:e,commit:t,succeed:i,fail:o,respond:h})=>{i(({snapshot:r,effect:l})=>{this.$nextTick(()=>{e.id===s&&(this.checkboxListOptions=Array.from(this.$root.querySelectorAll(".fi-fo-checkbox-list-option")),this.updateVisibleCheckboxListOptions(),this.checkIfAllCheckboxesAreChecked())})})}),this.$watch("search",()=>{this.updateVisibleCheckboxListOptions(),this.checkIfAllCheckboxesAreChecked()})},checkIfAllCheckboxesAreChecked(){this.areAllCheckboxesChecked=this.visibleCheckboxListOptions.length===this.visibleCheckboxListOptions.filter(e=>e.querySelector("input[type=checkbox]:checked, input[type=checkbox]:disabled")).length},toggleAllCheckboxes(){this.checkIfAllCheckboxesAreChecked();let e=!this.areAllCheckboxesChecked;this.visibleCheckboxListOptions.forEach(t=>{let i=t.querySelector("input[type=checkbox]");i.disabled||(i.checked=e,i.dispatchEvent(new Event("change")))}),this.areAllCheckboxesChecked=e},updateVisibleCheckboxListOptions(){this.visibleCheckboxListOptions=this.checkboxListOptions.filter(e=>["",null,void 0].includes(this.search)||e.querySelector(".fi-fo-checkbox-list-option-label")?.innerText.toLowerCase().includes(this.search.toLowerCase())?!0:e.querySelector(".fi-fo-checkbox-list-option-description")?.innerText.toLowerCase().includes(this.search.toLowerCase()))}}}export{c as default};
|
||||
37
public/js/filament/forms/components/code-editor.js
Normal file
37
public/js/filament/forms/components/code-editor.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
function r({state:o}){return{state:o,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=i=>i===null?0:Array.isArray(i)?i.length:typeof i!="object"?0:Object.keys(i).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);this.rows=[];let s=e.splice(t.oldIndex,1)[0];e.splice(t.newIndex,0,s),this.$nextTick(()=>{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};
|
||||
function h({state:r}){return{state:r,rows:[],init(){this.updateRows(),this.rows.length<=0?this.rows.push({key:"",value:""}):this.updateState(),this.$watch("state",(e,t)=>{let s=i=>i===null?0:Array.isArray(i)?i.length:typeof i!="object"?0:Object.keys(i).length;s(e)===0&&s(t)===0||this.updateRows()})},addRow(){this.rows.push({key:"",value:""}),this.updateState()},deleteRow(e){this.rows.splice(e,1),this.rows.length<=0&&this.addRow(),this.updateState()},reorderRows(e){let t=Alpine.raw(this.rows);this.rows=[];let s=t.splice(e.oldIndex,1)[0];t.splice(e.newIndex,0,s),this.$nextTick(()=>{this.rows=t,this.updateState()})},updateRows(){let t=Alpine.raw(this.state).map(({key:s,value:i})=>({key:s,value:i}));this.rows.forEach(s=>{(s.key===""||s.key===null)&&t.push({key:"",value:s.value})}),this.rows=t},updateState(){let e=[];this.rows.forEach(t=>{t.key===""||t.key===null||e.push({key:t.key,value:t.value})}),JSON.stringify(this.state)!==JSON.stringify(e)&&(this.state=e)}}}export{h as default};
|
||||
|
||||
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user