title: Laravel 5.4 Use If/Else inside of a controller
body: <p>I'm trying to use @if &amp; @else inside a controller, eg:</p>
  
  <pre><code>public function deleteCharacter ($char_delete_id)
  
      {
  
  @if (Auth::user()-&gt;id == $delCharacterUserID) 
  $deleteSuccess = 1;
  
              return redirect('/characters')-&gt;with('deleteSuccess', $deleteSuccess); 
  
  
  @else 
        $deleteSuccess = 0;
  
          return redirect('/characters')-&gt;with('deleteSuccess', $deleteSuccess); 
  
      @endif
  </code></pre>
  
  <p>This throws the error:</p>
  
  <blockquote>
    <p>FatalErrorException in CharacterController.php line 40: syntax error,
    unexpected 'if' (T_IF)</p>
  </blockquote>