jquery-validator icon indicating copy to clipboard operation
jquery-validator copied to clipboard

Can you update this to Laravel 4?

Open yazeed opened this issue 11 years ago • 3 comments

This awesome package was obviously prepared for Laravel 3, is there any hope someone could prepare a Laravel 4 version of this?

yazeed avatar Jul 03 '14 21:07 yazeed

Yes. That would be great to make it compatible with Laravel4. Even I am waiting for @joecwallace to make the required changes.

Thanks.

anuragrath avatar Oct 04 '14 10:10 anuragrath

OK. I'll try to look at this soon. I'll update to L4 and L5 - hopefully around the time L5 releases.

If anybody wants to get a head start and submit a PR, I would appreciate it.

joecwallace avatar Oct 15 '14 15:10 joecwallace

I got started on this. I still need to update the documentation, test some more, and submit the package on Packagist, but you should be able to use it with something like this in composer.json:

{
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/joecwallace/jquery-validator"
        }
    ],
    "require": {
        ...
        "joecwallace/jquery-validator": "dev-master"
    }
    ...
}

Add JqueryValidator\HtmlServiceProvider to the providers array in app/config/app.php.

Publish the JS with php artisan asset:publish joecwallace/jquery-validator.

The API changed, and should be used like this:

{{ Form::validate('username' => 'required|email', 'password' => 'required')->open() }}
    {{ Form::text('username') }}
    {{ Form::password('password') }}
{{ Form::close() }}

That should be it. Let me know if you have any trouble.

joecwallace avatar Jan 12 '15 23:01 joecwallace