title: Laravel best or effective way to handle if else statement
body: <p>i am stuck a bit, i have lot of if else statement handeling, and i will need to use this in more the none page, so handeling it in the view is not a good idea (and read about it its not a good idea)</p>
  
  <p>So what im am stuck with i have 2 tables.</p>
  
  <pre><code>user
  users_details
  </code></pre>
  
  <p><code>User table</code> stores basic login information and and the user <code>details</code> has the following fields</p>
  
  <pre><code>user_id
  first_name  
  last_name   
  company 
  location    
  experience  
  compensation    
  about   
  gender  
  year    
  day 
  month   
  profile_image
  </code></pre>
  
  <p>my relations</p>
  
  <p><strong>User model</strong></p>
  
  <pre><code>public function detail()
  {
     return $this-&gt;has_one('Detail');
  }
  </code></pre>
  
  <p><strong>Details model</strong></p>
  
  <pre><code>public function user()
  {
     return $this-&gt;belongs_to('User');
  }
  </code></pre>
  
  <p>So what im stuck with is how to handle the object to r<code>eturn experience, compensation</code> because those what i will need on more than one page, at first i did this in my controller</p>
  
  <pre><code>public function get_index($username = null)
  {
  
     $user = User::get_profile($username);
  
     if (is_null($user))  return Response::error('404');
  
     switch ($user-&gt;detail-&gt;experience) {
      case 1:
          $user-&gt;detail-&gt;experience = "No experience";
      break;
  
      case 2:
          $user-&gt;detail-&gt;experience = "Some experience";
      break;
  
      case 3:
          $user-&gt;detail-&gt;experience = "Experienced";
      break;
  
      case 4:
          $user-&gt;detail-&gt;experience = "Very experienced";
      break;
  
     }
  
      switch ($user-&gt;detail-&gt;compensation) {
      case 1:
          $user-&gt;detail-&gt;compensation = "Any";
      break;
  
      case 2:
          $user-&gt;detail-&gt;compensation = "Depends on Assignment ";
      break;
  
      case 3:
          $user-&gt;detail-&gt;compensation = "Paid Assignments Only ";
      break;
  
      case 4:
          $user-&gt;detail-&gt;compensation = "Time for Print ";
      break;
  
     }
  
     $this-&gt;layout-&gt;title = 'Profile' . ' ' . $username ;
  
     $this-&gt;layout-&gt;content = View::make( 'user.profile' )-&gt;with( 'user', $user );
  
  }    
  </code></pre>
  
  <p>And i know this is the worts idea i should come up with because it wont solve my problem, not effective and i still need to duplicate.</p>
  
  <p>So could someone show me and example and effective way to handle these?</p>
  
  <p>Would be grateful, thank you</p>