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

javascript - How to process users in one specific order using map o each function? -

javascript - Linking from page A to a specific iframe on page B -

java - Two interface have same method name with different return type -