| Total Complexity | 3 | 
| Total Lines | 36 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 10 | trait WithPerPagePagination  | 
            ||
| 11 | { | 
            ||
| 12 | use WithPagination;  | 
            ||
| 13 | |||
| 14 | /**  | 
            ||
| 15 | * Assign the perPage option from the session.  | 
            ||
| 16 | *  | 
            ||
| 17 | * @return void  | 
            ||
| 18 | */  | 
            ||
| 19 | public function mountWithPerPagePagination(): void  | 
            ||
| 20 |     { | 
            ||
| 21 |         $this->perPage = session()->get('perPage', $this->perPage); | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 22 | }  | 
            ||
| 23 | |||
| 24 | /**  | 
            ||
| 25 | * Store in session the perPage option.  | 
            ||
| 26 | *  | 
            ||
| 27 | * @param mixed $value The value of the option perPage.  | 
            ||
| 28 | *  | 
            ||
| 29 | * @return void  | 
            ||
| 30 | */  | 
            ||
| 31 | public function updatedPerPage($value): void  | 
            ||
| 32 |     { | 
            ||
| 33 |         session()->put('perPage', $value); | 
            ||
| 34 | }  | 
            ||
| 35 | |||
| 36 | /**  | 
            ||
| 37 | * Apply the pagination to the query.  | 
            ||
| 38 | *  | 
            ||
| 39 | * @param mixed $query The query to apply the pagination.  | 
            ||
| 40 | *  | 
            ||
| 41 | * @return mixed  | 
            ||
| 42 | */  | 
            ||
| 43 | public function applyPagination($query)  | 
            ||
| 46 | }  | 
            ||
| 47 | }  | 
            ||
| 48 |