Skip to content

Conversation

jorisvaesen
Copy link
Collaborator

Started porting upload validation from the 2.x plugin.
It's a standalone validation provider which can optionally be loaded and used.

I've split it up into multiple traits to make it more manageable and give the option to add specific validations (video, pdf, ...) later.

Usage:
$validator->provider('upload', \Josegonzalez\Upload\Validation\UploadValidation::class);

If you only want to use the image validation rules:
$validator->provider('upload', \Josegonzalez\Upload\Validation\ImageValidation::class);

After this you can use it as:
$validator->add('file', 'filePhpUploadSize', [ 'rule' => 'isUnderPhpSizeLimit', 'message' => 'File is too large to upload', 'provider' => 'upload' ]);

If this code could makes it, i'll write some documentation for it.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling c9271e4 on jorisvaesen:master into b652f1c on josegonzalez:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling d563e22 on jorisvaesen:master into b652f1c on josegonzalez:master.

@josegonzalez
Copy link
Member

Needs 100% test coverage, but I'm on board with the functionality.

Joris Vaesen added 2 commits March 20, 2016 17:54
@coveralls
Copy link

Coverage Status

Coverage decreased (-1.5%) to 98.477% when pulling 293c0db on jorisvaesen:master into b652f1c on josegonzalez:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-1.5%) to 98.477% when pulling 293c0db on jorisvaesen:master into b652f1c on josegonzalez:master.

@josegonzalez
Copy link
Member

Getting there!

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling ca927c3 on jorisvaesen:master into b652f1c on josegonzalez:master.

… maxSize from ImageValidation to UploadValidation
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 8287d64 on jorisvaesen:master into b652f1c on josegonzalez:master.


.. code:: php

<?php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the php open/close tags?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling e9cbbae on jorisvaesen:master into b652f1c on josegonzalez:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling cb91a6f on jorisvaesen:master into b652f1c on josegonzalez:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 4911745 on jorisvaesen:master into b652f1c on josegonzalez:master.

@josegonzalez
Copy link
Member

Looks good, ship it.

jorisvaesen added a commit that referenced this pull request Mar 21, 2016
@jorisvaesen jorisvaesen merged commit 5e303f6 into FriendsOfCake:master Mar 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants