Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

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".