title: Laravel: Best practice for inline PHP in a blade file
body: <p>So I have the following blade file:</p>
  
  <p><code>confirmEmail.blade.php</code></p>
  
  <pre><code>@extends('layouts.master')
  
  @section('title')
  {{ trans('tc.signUpConfirmTitle')}}
  @endsection
  
  
  
  
  
  @section('body')
  
  
  &lt;div class="container"&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-lg-4"&gt;
        &amp;nbsp;
      &lt;/div&gt;
  
      &lt;div class="col-lg-4"&gt;
  
        &lt;?php
        echo $_GET['emailToken'];
        $emailToken = isset($_GET['emailToken']) ? $_GET['emailToken'] : "";
        $email = isset($_GET['email']) ? $_GET['email'] : "";
  
        //database lookup:
        $user = User::where('email','=',$email)-&gt;first();   //this fails...
  
        if($user-&gt;emailToken == $emailToken){
          echo "OK!";
        }
        ?&gt;
  
  
  
  
        &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
  
      &lt;/div&gt;
  
      &lt;div class="col-lg-4"&gt;
        &amp;nbsp;
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;
  
  @endsection
  </code></pre>
  
  <p>As you can see, I have some raw PHP between <code>&lt;?php ?&gt;</code> tags. The problem is that <code>User::where(...)</code> is failing ("FatalErrorException" - Class 'User' not found).</p>
  
  <p>I guess this is because I need to do some Laravel import? But is doing this lightweight?</p>
  
  <p>Can I ask what the best practice would be in this my case? I'm still very new to Laravel so bear with me. Is using raw PHP like this defeating the whole purpose?</p>
  
  <p>I've been using Blade templates for spitting out simple variables and parameters fine up until now. But I want to do something a little more complicated now and I'm having trouble.</p>