Browse Source

Merge pull request #996 from Jakobud/feature/pagination-docs

Added documentation for paginate's second optional argument.
Dayle Rees 12 years ago
parent
commit
c27614b217
1 changed files with 20 additions and 16 deletions
  1. 20 16
      laravel/documentation/views/pagination.md

+ 20 - 16
laravel/documentation/views/pagination.md

@@ -22,6 +22,10 @@ Let's walk through a complete example of paginating using the [Fluent Query Buil
 
 	$orders = DB::table('orders')->paginate($per_page);
 
+You can also pass an optional array of table columns to select in the query:
+
+	$orders = DB::table('orders')->paginate($per_page, array('id', 'name', 'created_at'));
+
 #### Display the results in a view:
 
 	<?php foreach ($orders->results as $order): ?>
@@ -75,30 +79,30 @@ Sometimes you may need to create a Paginator instance manually, without using th
 
 All pagination link elements can be style using CSS classes. Here is an example of the HTML elements generated by the links method:
 
-    <div class="pagination">
-        <a href="foo" class="previous_page">Previous</a>
+	<div class="pagination">
+		<a href="foo" class="previous_page">Previous</a>
 
-        <a href="foo">1</a>
-        <a href="foo">2</a>
+		<a href="foo">1</a>
+		<a href="foo">2</a>
 
-        <span class="dots">...</span>
+		<span class="dots">...</span>
 
-        <a href="foo">11</a>
-        <a href="foo">12</a>
+		<a href="foo">11</a>
+		<a href="foo">12</a>
 
-        <span class="current">13</span>
+		<span class="current">13</span>
 
-        <a href="foo">14</a>
-        <a href="foo">15</a>
+		<a href="foo">14</a>
+		<a href="foo">15</a>
 
-        <span class="dots">...</span>
+		<span class="dots">...</span>
 
-        <a href="foo">25</a>
-        <a href="foo">26</a>
+		<a href="foo">25</a>
+		<a href="foo">26</a>
 
-        <a href="foo" class="next_page">Next</a>
-    </div>
+		<a href="foo" class="next_page">Next</a>
+	</div>
 
 When you are on the first page of results, the "Previous" link will be disabled. Likewise, the "Next" link will be disabled when you are on the last page of results. The generated HTML will look like this:
 
-	<span class="disabled prev_page">Previous</span>
+	<span class="disabled prev_page">Previous</span>