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.

  1. count number of rows of b against given @ creation request.
  2. show error if more 5.

there no direct way limit b using laravel, far know.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -