| Conditions | 2 | 
| Paths | 2 | 
| Total Lines | 23 | 
| Code Lines | 15 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 32 | public function show(Request $request, $slug, $id) | ||
| 33 |     { | ||
| 34 |         $user = User::with('articles', 'comments') | ||
| 35 |             ->where('id', $id) | ||
| 36 | ->first(); | ||
| 37 | |||
| 38 |         if (is_null($user)) { | ||
| 39 | return redirect() | ||
| 40 |                 ->route('page_index') | ||
| 41 |                 ->with('danger', 'This user doesn\'t exist or has been deleted !'); | ||
| 42 | } | ||
| 43 | |||
| 44 | $this->breadcrumbs->addCrumb( | ||
| 45 | e($user->username), | ||
| 46 | route( | ||
| 47 | 'users_user_show', | ||
| 48 | ['slug' => $user->slug, 'id' => $user->id] | ||
| 49 | ) | ||
| 50 | ); | ||
| 51 |         $this->breadcrumbs->setCssClasses('breadcrumb'); | ||
| 52 | |||
| 53 |         return view('user.show', ['user' => $user, 'breadcrumbs' => $this->breadcrumbs]); | ||
| 54 | } | ||
| 55 | } | ||
| 56 | 
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: