jeudi 2 mars 2017

Apply certain condition or validation to restrict operation in Laravel Models

enter image description here

This is a category table I am using in my project using Laravel. I have checks applied in the view files, for the category parent selection dropdown, so that the category itself and it's child's will not appear in the dropdown.

But form input fields value can be easily overridden using dev console.

Is there a way in models so that if parent id is equal to the category id itself or parent id is the child of current category then it will stop execution.

I have recently started laravel, a month ago, and still learning and building, so help here will be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire