ich etwas tue, wie dieseLaralvel 5.2 Paginierung Rückkehr nicht von und nach params
$users = CompanyModel::paginate(5);
print_r($users);exit;
, wenn ich diese drucken, wird es „Illuminate \ Paginierung \ LengthAwarePaginator Objekt“ drucken, es params wie total zurück, perPage, currentPage usw. darin.
Jetzt brauche ich param wie von und zu denen ich für die Seitennummerierung am Frontend verwenden werde.
Bitte helfen Sie !!
Meine Antwort:
Illuminate\Pagination\LengthAwarePaginator Object
(
[total:protected] => 21
[lastPage:protected] => 5
[items:protected] => Illuminate\Database\Eloquent\Collection Object
(
[items:protected] => Array
(
[0] => DayJibe\DAL\Company\Models\CompanyModel Object
(
[table:protected] => companies
[fillable:protected] => Array
(
[0] => company_name
[1] => user_first_name
[2] => user_email
[3] => plan_name
[4] => total_users
[5] => monthly_payment_amount
[6] => term_ending
[7] => sign_up_date
[8] => receive_special_offers_emails
[9] => time_spent_logged_in
[10] => storage_used
)
[connection:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
(
[id] => 1
[company_name] => JohnSmithConsulting
[user_first_name] => John
[user_email] => [email protected]
[plan_name] => Basic
[total_users] => 4
[monthly_payment_amount] => 10
[term_ending] => 2016-01-02 00:00:00
[sign_up_date] => 2015-01-02 00:00:00
[receive_special_offers_emails] => Y
[time_spent_logged_in] => 15
[storage_used] => 100
[created_at] => 2016-07-14 11:37:51
[updated_at] => 2016-07-14 11:37:51
)
[original:protected] => Array
(
[id] => 1
[company_name] => JohnSmithConsulting
[user_first_name] => John
[user_email] => [email protected]
[plan_name] => Basic
[total_users] => 4
[monthly_payment_amount] => 10
[term_ending] => 2016-01-02 00:00:00
[sign_up_date] => 2015-01-02 00:00:00
[receive_special_offers_emails] => Y
[time_spent_logged_in] => 15
[storage_used] => 100
[created_at] => 2016-07-14 11:37:51
[updated_at] => 2016-07-14 11:37:51
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[dates:protected] => Array
(
)
[dateFormat:protected] =>
[casts:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
[wasRecentlyCreated] =>
)
[1] => DayJibe\DAL\Company\Models\CompanyModel Object
(
[table:protected] => companies
[fillable:protected] => Array
(
[0] => company_name
[1] => user_first_name
[2] => user_email
[3] => plan_name
[4] => total_users
[5] => monthly_payment_amount
[6] => term_ending
[7] => sign_up_date
[8] => receive_special_offers_emails
[9] => time_spent_logged_in
[10] => storage_used
)
[connection:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
(
[id] => 2
[company_name] => James Engineering
[user_first_name] => James
[user_email] => [email protected]
[plan_name] => Enterprise
[total_users] => 50
[monthly_payment_amount] => 250
[term_ending] => 2016-04-05 00:00:00
[sign_up_date] => 2016-01-02 00:00:00
[receive_special_offers_emails] => N
[time_spent_logged_in] => 25
[storage_used] => 250
[created_at] => 2016-07-15 06:33:34
[updated_at] => 2016-07-15 06:33:34
)
[original:protected] => Array
(
[id] => 2
[company_name] => James Engineering
[user_first_name] => James
[user_email] => [email protected]
[plan_name] => Enterprise
[total_users] => 50
[monthly_payment_amount] => 250
[term_ending] => 2016-04-05 00:00:00
[sign_up_date] => 2016-01-02 00:00:00
[receive_special_offers_emails] => N
[time_spent_logged_in] => 25
[storage_used] => 250
[created_at] => 2016-07-15 06:33:34
[updated_at] => 2016-07-15 06:33:34
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[dates:protected] => Array
(
)
[dateFormat:protected] =>
[casts:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
[wasRecentlyCreated] =>
)
[2] => DayJibe\DAL\Company\Models\CompanyModel Object
(
[table:protected] => companies
[fillable:protected] => Array
(
[0] => company_name
[1] => user_first_name
[2] => user_email
[3] => plan_name
[4] => total_users
[5] => monthly_payment_amount
[6] => term_ending
[7] => sign_up_date
[8] => receive_special_offers_emails
[9] => time_spent_logged_in
[10] => storage_used
)
[connection:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
(
[id] => 3
[company_name] => Joe Engineering LTD.
[user_first_name] => Joe
[user_email] => [email protected]
[plan_name] => Freelance
[total_users] => 36
[monthly_payment_amount] => 500
[term_ending] => 2016-08-08 00:00:00
[sign_up_date] => 2015-08-08 00:00:00
[receive_special_offers_emails] => Y
[time_spent_logged_in] => 50
[storage_used] => 500
[created_at] => 2016-07-15 06:35:39
[updated_at] => 2016-07-15 06:35:39
)
[original:protected] => Array
(
[id] => 3
[company_name] => Joe Engineering LTD.
[user_first_name] => Joe
[user_email] => [email protected]
[plan_name] => Freelance
[total_users] => 36
[monthly_payment_amount] => 500
[term_ending] => 2016-08-08 00:00:00
[sign_up_date] => 2015-08-08 00:00:00
[receive_special_offers_emails] => Y
[time_spent_logged_in] => 50
[storage_used] => 500
[created_at] => 2016-07-15 06:35:39
[updated_at] => 2016-07-15 06:35:39
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[dates:protected] => Array
(
)
[dateFormat:protected] =>
[casts:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
[wasRecentlyCreated] =>
)
[3] => DayJibe\DAL\Company\Models\CompanyModel Object
(
[table:protected] => companies
[fillable:protected] => Array
(
[0] => company_name
[1] => user_first_name
[2] => user_email
[3] => plan_name
[4] => total_users
[5] => monthly_payment_amount
[6] => term_ending
[7] => sign_up_date
[8] => receive_special_offers_emails
[9] => time_spent_logged_in
[10] => storage_used
)
[connection:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
(
[id] => 4
[company_name] => Michal Engineering LTD.
[user_first_name] => Michal
[user_email] => [email protected]
[plan_name] => Basic
[total_users] => 45
[monthly_payment_amount] => 400
[term_ending] => 2016-09-10 00:00:00
[sign_up_date] => 2016-01-05 00:00:00
[receive_special_offers_emails] => N
[time_spent_logged_in] => 40
[storage_used] => 150
[created_at] => 2016-07-15 06:36:57
[updated_at] => 2016-07-15 06:36:57
)
[original:protected] => Array
(
[id] => 4
[company_name] => Michal Engineering LTD.
[user_first_name] => Michal
[user_email] => [email protected]
[plan_name] => Basic
[total_users] => 45
[monthly_payment_amount] => 400
[term_ending] => 2016-09-10 00:00:00
[sign_up_date] => 2016-01-05 00:00:00
[receive_special_offers_emails] => N
[time_spent_logged_in] => 40
[storage_used] => 150
[created_at] => 2016-07-15 06:36:57
[updated_at] => 2016-07-15 06:36:57
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[dates:protected] => Array
(
)
[dateFormat:protected] =>
[casts:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
[wasRecentlyCreated] =>
)
[4] => DayJibe\DAL\Company\Models\CompanyModel Object
(
[table:protected] => companies
[fillable:protected] => Array
(
[0] => company_name
[1] => user_first_name
[2] => user_email
[3] => plan_name
[4] => total_users
[5] => monthly_payment_amount
[6] => term_ending
[7] => sign_up_date
[8] => receive_special_offers_emails
[9] => time_spent_logged_in
[10] => storage_used
)
[connection:protected] =>
[primaryKey:protected] => id
[keyType:protected] => int
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
(
[id] => 5
[company_name] => Michal Engineering LTD.
[user_first_name] => Michal
[user_email] => [email protected]
[plan_name] => Basic
[total_users] => 45
[monthly_payment_amount] => 400
[term_ending] => 0000-00-00 00:00:00
[sign_up_date] => 0000-00-00 00:00:00
[receive_special_offers_emails] => N
[time_spent_logged_in] => 40
[storage_used] => 150
[created_at] => 2016-07-15 07:58:36
[updated_at] => 2016-07-15 07:58:36
)
[original:protected] => Array
(
[id] => 5
[company_name] => Michal Engineering LTD.
[user_first_name] => Michal
[user_email] => [email protected]
[plan_name] => Basic
[total_users] => 45
[monthly_payment_amount] => 400
[term_ending] => 0000-00-00 00:00:00
[sign_up_date] => 0000-00-00 00:00:00
[receive_special_offers_emails] => N
[time_spent_logged_in] => 40
[storage_used] => 150
[created_at] => 2016-07-15 07:58:36
[updated_at] => 2016-07-15 07:58:36
)
[relations:protected] => Array
(
)
[hidden:protected] => Array
(
)
[visible:protected] => Array
(
)
[appends:protected] => Array
(
)
[guarded:protected] => Array
(
[0] => *
)
[dates:protected] => Array
(
)
[dateFormat:protected] =>
[casts:protected] => Array
(
)
[touches:protected] => Array
(
)
[observables:protected] => Array
(
)
[with:protected] => Array
(
)
[morphClass:protected] =>
[exists] => 1
[wasRecentlyCreated] =>
)
)
)
[perPage:protected] => 5
[currentPage:protected] => 1
[path:protected] => http://dayjibe.localhost.com/api/v1.0/company
[query:protected] => Array
(
)
[fragment:protected] =>
[pageName:protected] => page
)
Bitte post, was Sie bekommen 'print_r ($ users);'. – Manwal
Klingt wie eine Frage, die durch das Lesen des Handbuchs beantwortet werden würde – RiggsFolly
Bitte werfen Sie einen Blick auf die Dokumentation [hier] (https://laravel.com/docs/5.2/pagination). Es hilft in den meisten Fällen sofort. – iSS