| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace NovaFormEntries; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use FormEntries\Models\FormEntry; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Illuminate\Http\Request; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Laravel\Nova\Fields\DateTime; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Laravel\Nova\Fields\ID; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Laravel\Nova\Fields\MorphTo; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Laravel\Nova\Fields\Text; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Laravel\Nova\Fields\Textarea; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use NovaFormEntries\Metrics\SendingPerContent; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use NovaFormEntries\Metrics\SendingTrend; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 14 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  | trait FormEntryResource | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |     abstract public function senderTypes(): array; | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 19 | 2 |  |     public function fields(Request $request) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 21 | 2 |  |         return [ | 
            
                                                                        
                            
            
                                    
            
            
                | 22 | 2 |  |             ID::make(), | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 24 | 2 |  |             DateTime::make(__('Sent at'), 'created_at'), | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 26 | 2 |  |             Text::make(__('Type')) | 
            
                                                                        
                            
            
                                    
            
            
                | 27 | 2 |  |                 ->displayUsing(function ($val, FormEntry $model) { | 
            
                                                                        
                            
            
                                    
            
            
                | 28 | 2 |  |                     return $model->name; | 
            
                                                                        
                            
            
                                    
            
            
                | 29 | 2 |  |                 }), | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 31 | 2 |  |             MorphTo::make(__('Sender'), 'sender')->types( | 
            
                                                                        
                            
            
                                    
            
            
                | 32 | 2 |  |                 $this->senderTypes() | 
            
                                                                        
                            
            
                                    
            
            
                | 33 | 2 |  |             ), | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 35 | 2 |  |             Text::make(__('IPs')) | 
            
                                                                        
                            
            
                                    
            
            
                | 36 | 2 |  |                 ->displayUsing(function ($val, FormEntry $model) { | 
            
                                                                        
                            
            
                                    
            
            
                | 37 | 2 |  |                     return implode(', ', $model->requestIps()); | 
            
                                                                        
                            
            
                                    
            
            
                | 38 | 2 |  |                 }), | 
            
                                                                        
                            
            
                                    
            
            
                | 39 | 2 |  |             Text::make(__('User Agent')) | 
            
                                                                        
                            
            
                                    
            
            
                | 40 | 2 |  |                 ->displayUsing(function ($val, FormEntry $model) { | 
            
                                                                        
                            
            
                                    
            
            
                | 41 | 1 |  |                     return $model->requestUserAgent(); | 
            
                                                                        
                            
            
                                    
            
            
                | 42 | 2 |  |                 })->hideFromIndex(), | 
            
                                                                        
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 44 | 2 |  |             Textarea::make(__('Content'), 'content') | 
            
                                                                        
                            
            
                                    
            
            
                | 45 | 2 |  |                     ->resolveUsing(function ($val, FormEntry $model) { | 
            
                                                                        
                            
            
                                    
            
            
                | 46 | 1 |  |                         return $model->content->stringify(); | 
            
                                                                        
                            
            
                                    
            
            
                | 47 | 2 |  |                     })->hideFromIndex(), | 
            
                                                                        
                            
            
                                    
            
            
                | 48 | 2 |  |         ]; | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 | 1 |  |     public function cards(Request $request) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 | 1 |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 | 1 |  |             new SendingTrend(), | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 55 | 1 |  |             new SendingPerContent(), | 
            
                                                                        
                                                                
            
                                    
            
            
                | 56 | 1 |  |         ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 58 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 59 |  |  |  | 
            
                        
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.