| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * app/Api/Controllers/General/EventlogController.php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * API Controller for eventlog data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * This program is free software: you can redistribute it and/or modify | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * it under the terms of the GNU General Public License as published by | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * the Free Software Foundation, either version 3 of the License, or | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * (at your option) any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * This program is distributed in the hope that it will be useful, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  * GNU General Public License for more details. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |  * You should have received a copy of the GNU General Public License | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  * @package    LibreNMS | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |  * @link       http://librenms.org | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |  * @copyright  2016 Neil Lathwood | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  * @author     Neil Lathwood <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | namespace App\Api\Controllers\General; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | use App\Api\Controllers\Controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | use App\Models\General\Eventlog; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | use Dingo\Api\Routing\Helpers; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | use Illuminate\Http\Request; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 32 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  | class EventlogController extends Controller | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |     use Helpers; | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |      * Display a listing of all alerts | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |      * @param Request $request | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |      * @return \Illuminate\Pagination\LengthAwarePaginator | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     public function index(Request $request) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $per_page = $request->per_page ?: 25; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         return Eventlog::query()->paginate($per_page); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 48 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |      * Show the form for creating a new resource. | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |      * @return \Illuminate\Http\Response|null | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     public function create() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         // | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 59 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |      * Store a newly created resource in storage. | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |      * @param  \Illuminate\Http\Request  $request | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |      * @return \Illuminate\Http\Response|null | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |     public function store(Request $request) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |         // | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 70 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |      * Display the specified resource. | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |      * @param  int  $id | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |      * @return \Illuminate\Http\Response|null | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     public function show(Request $request, $id) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         // | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 81 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |      * Show the form for editing the specified resource. | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |      * @param  int  $id | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |      * @return \Illuminate\Http\Response|null | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     public function edit($id) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         // | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 92 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 95 |  |  |      * Update the specified resource in storage. | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 97 |  |  |      * @param  \Illuminate\Http\Request  $request | 
            
                                                                        
                            
            
                                    
            
            
                | 98 |  |  |      * @param  int  $id | 
            
                                                                        
                            
            
                                    
            
            
                | 99 |  |  |      * @return \Illuminate\Http\Response|null | 
            
                                                                        
                            
            
                                    
            
            
                | 100 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |     public function update(Request $request, $id) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |         // | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 104 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 105 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 106 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 107 |  |  |      * Remove the specified resource from storage. | 
            
                                                                        
                            
            
                                    
            
            
                | 108 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 109 |  |  |      * @param  int  $id | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |      * @return \Illuminate\Http\Response|null | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |     public function destroy($id) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |         // | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 115 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 116 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 117 |  |  |  | 
            
                        
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.