PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 2.4.0
Fluent Support – Helpdesk & Customer Support Ticket System v2.4.0
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
← All changes | app/Models/Product.php +11 -1 1.10.02.4.0 View file →
@@ -46,8 +46,18 @@
46 46 return $query;
47 47 }
48 48
49 49 /**
50 + * Local scope to order products alphabetically by title
51 + * @param $query
52 + * @return mixed
53 + */
54 + public function scopeOrderedByTitle($query)
55 + {
56 + return $query->orderBy('title', 'ASC');
57 + }
58 +
59 + /**
50 60 * This `getProducts` method will return the list of products
51 61 * @param string $search
52 62 * @return array
53 63 */
@@ -53,9 +63,9 @@
53 63 */
54 64 public function getProducts ( $search )
55 65 {
56 66 return [
57 - 'products' => $this->orderBy('id', 'DESC')->searchBy($search)->paginate()
67 + 'products' => $this->orderedByTitle()->searchBy($search)->paginate()
58 68 ];
59 69 }
60 70
61 71 /**