php - Laravel 4 query paginate associated model -


i'm trying paginate query sellorders.

$user = user::with('sellorders', 'sellorders.sellorderitems', 'sellorders.sellorderitems.status', 'sellorders.sellorderitems.device', 'sellorders.sellorderitems.device.brand')->find(\sentry::getuser()->id); 

what arguments can pass paginate method paginate sellorder instead of user? can't seem find i'm looking in docs.

from can tell, trying paginate particular user's sellorders.

my advice adjust code like:

$user = \sentry::getuser(); if ($user) {     $sellorders = $user->sellorders()->paginate(15); } 

this assumes have sellorders relationship set correctly on user model (and have extended sentry's user model so, , configured sentry use model: see https://github.com/cartalyst/sentry/issues/161).


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -