codemenorg / fakefield
Hide original field name from end user.
Requires
- php: ^7.1
This package is auto-updated.
Last update: 2024-12-12 21:01:23 UTC
README
Hide original field name from end user. It will generate new field name(fake field) every time while you refresh your page.
Installation
You can install the package via composer:
composer require codemenorg/fakefield
For Laravel 5.8 use composer require codemenorg/fakefield:1.0.0
Usage
After installing the package, run the following command to generate fakefield.php
config file. Here you have to define fake field prefix and Eloquent Model path.
php artisan vendor:publish --tag=fake-field-config
Add FakeFieldMiddleware
to app\Http\Kernel.php
web middleware group section.
protected $middlewareGroups = [ 'web' => [ ... \Codemen\FakeField\FakeFieldMiddleware::class, ], ... ];
Inside your model you have to define which fields you want to change.
protected $fakeFields = ['first_name', 'last_name', 'email'];
Now you are ready to use fake field inside your form.
<form action=""> @csrf @fakeKey <!-- <input type="hidden" name="_fake_key" value="eyJpdiI6Ij...wOG9BPT0ifQ"> --> <input type="text" name="{{ fake_field('first_name')}}"> <!-- <input type="text" name="fake_345"> --> <input type="text" name="{{ fake_field('last_name')}}"> <!-- <input type="text" name="fake_53"> --> <input type="text" name="{{ fake_field('email')}}"> <!-- <input type="text" name="fake_24"> --> <button type="submit">Submit</button> </form>
Here @fakeKey
blade directive will generate a fake key without fake field will not working properly. You can also use fake_key()
helper function to generate fake key.
fake_field()
helper function will generate fake field.
If the field is not defined in Model then the function will return original field name.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
To contribute you can create a pull request. But please check all functionality are working before creating pull request. We will publish your name on contribution list.
Security
If you discover any security related issues, please email codemenorg@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.