Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Juhlinus/kakunin
Instant form validation for your Inertia.js apps.
https://github.com/Juhlinus/kakunin
Last synced: 3 months ago
JSON representation
Instant form validation for your Inertia.js apps.
- Host: GitHub
- URL: https://github.com/Juhlinus/kakunin
- Owner: Juhlinus
- Created: 2020-08-20T16:27:39.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-01T21:15:56.000Z (about 3 years ago)
- Last Synced: 2024-05-01T14:54:31.942Z (6 months ago)
- Language: PHP
- Homepage:
- Size: 30.3 KB
- Stars: 41
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-inertiajs - Kakunin - Laravel package for real-time form validation. (Resources / Packages)
README
# βοΈ Kakunin
## π° Is this useful to you?
**Consider [sponsoring me on github](https://github.com/sponsors/juhlinus)! π**## πΎ Installation
```
composer require juhlinus/kakunin
```## π€ Usage
Kakunin relies on [Custom Form Requests](https://laravel.com/docs/7.x/validation#form-request-validation).Add the `ValidatesInertiaInput` trait to your newly generated form request like so:
```php
export default {
watch: {
email: function (email) {
this.$inertia.post('/users', {
email: email,
validate: true,
});
}
}
}```
Note that I'm passing a `validate` parameter. If this isn't passed then Kakunin will not validate your request.
That's it! Happy validating!
## π Configuration
If you wish to change the `validate` to something else, then you can add `KAKUNIN_VALIDATION_KEY` to your `.env` file. Lastly, add the following to your `config/services.php` file:
```php
'kakunin' => [
'validation_key' => env('KAKUNIN_VALIDATION_KEY'),
],
```## β© That's a stupid name for a package
Kakunin(η’Ίθͺ) is the Japanese verb "to validate".