title: Laravel 5 collection issue: Where not equal to
body: <p>I am currently working on a modal where a user can insert an excel file. The task of the system is to upload and/or add a new database record if the records are new or identical to what exists in the database. BUT it also needs a delete function for getting rid of those records where the slug column is not identical to the name column. </p>
  
  <p>At the moment I am using <strong>Laravel 5.3</strong>, and this is my <strong>controller</strong> as it is now:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers;
  
  use Illuminate\Http\Request;
  use App\Product;
  use App\Http\Requests;
  use Illuminate\Support\Facades\DB;
  use Input;
  use Maatwebsite\Excel\Facades\Excel;
  
  class ProductsController extends Controller {
  
  public function importExcel(Request $request) {
      if (Input::hasFile('productFile')) {
          $path = Input::file('productFile')-&gt;getRealPath();
          $checkbox = Input::get('productCheckbox');
          $data = Excel::load($path, function($reader) {
          })-&gt;get();
  
          if (!empty($data) &amp;&amp; $data-&gt;count()) {
              foreach ($data as $key =&gt; $value) {
                  $product = Product::all()-&gt;where('slug', $value-&gt;slug)-&gt;first();
                  $product_false = Product::all()-&gt;where('slug', '!=' , 'name')-&gt;get();
  
                  if ($product_false !== null){
                      //delete row if slug does not matches name
                      dd($product_false);
                  }
  </code></pre>
  
  <p><em>The dd above returns all products, so the collection query is not working properly (see below for the raw SQL that I am trying to run in this collection)</em></p>
  
  <pre><code>                if ($product !== null) {
                      //update row if exist
                      $product-&gt;name = $value-&gt;name;
                      $product-&gt;description = $value-&gt;description;
                      $product-&gt;price = $value-&gt;price;
                      $product-&gt;save();
                  } else {
                      //add new row if not exist
                      $product = new Product;
                      $product-&gt;slug = $value-&gt;slug;
                      $product-&gt;name = $value-&gt;name;
                      $product-&gt;description = $value-&gt;description;
                      $product-&gt;price = $value-&gt;price;
                      $product-&gt;save();
                  }
  
              }
              header("Location: /products");
          }
      }
  }
  
  }
  </code></pre>
  
  <p>This is the Product <strong>model</strong>:</p>
  
  <pre><code>&lt;?php
  
  namespace App;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Product extends Model
  {
  
  /**
   * The attributes that are mass assignable.
   *
   * @var array
   */
  protected $fillable = [
      'slug', 'name', 'description', 'price',
  ];
  }
  </code></pre>
  
  <p>Here is the PHPMyAdmin raw SQL (which works) that I basically am looking for to use in the collection:</p>
  
  <pre><code>SELECT * FROM `products` WHERE `slug` != `name`
  </code></pre>
  
  <p>I hope someone can help me out from this pit. I have been sailing the waves of the internet for about 12 hours now just to get this done.</p>
  
  <p>~ nitsuJ</p>