php - Limit one to many relationship to a custom maximum number in laravel 5 -
a hasmany(b) b belongsto(a) i want limit number of b maximum of 5.
1 row in can have maximum of 5 rows in b
is there way? or should use 1-1 relationship max 5 columns
here need do.
- count number of rows of b against given @ creation request.
- show error if more 5.
there no direct way limit b using laravel, far know.
Comments
Post a Comment