mardi 6 décembre 2016

Laravel 5.2 unique URL validation

I am trying to validate a URL in laravel at the same time I want to make sure its unique in the database, so I am using this:

'url' => 'required|unique:table,url|url', 

This is fine because it makes sure the url: 1). required 2). url is unique 3). Here is the problem::: the formate is http://www.example.com or http://example.com or https://www.example.com or http://ift.tt/PRJYjT etc.. all will pass the validation...

how can I make it if someone enters: any of these examples (http://www.example.com or http://example.com or https://www.example.com) will give an error since the "example.com" is the same ? even sub domains dev.example.com I want that to give him error since example.com is there?

Can I modify my filters and how?

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire