title: How to validate only part of a value I'm getting through a get request?
body: <p>I want to get two values from a get request, and then I'll use explode to retrieve each of them separately. However, this means that the value I'm getting before using explode isn't unique to the table (since it's a compound, and therefore it's not an existing value in the table). How can use validate to avoid duplicate of it ? </p>
  
  <p>I tried making the column unique using an SQL constraint, however this means I get an exception page when a user enters a duplicate. I would like to use validation instead so I get an error message. </p>
  
  <pre><code>public function store(Request $request)
      {
          $this-&gt;validate($request, [
              'idProduit' =&gt; 'unique:stocks', 
              'produit' =&gt; 'required|unique:stocks',
              'quantite' =&gt; 'required'
          ]);
          $produit = explode("|",$request-&gt;get('produit'));
          $stock = new Stock;
          $stock-&gt;idProduit = $produit[0];
          $stock-&gt;produit = $produit[1];
          $stock-&gt;quantite = $request-&gt;input('quantite');
          $stock-&gt;save();
  
          return redirect('/stocks/')-&gt;with('success', 'Entrée de stock ajoutée à la base de données');
      }
  </code></pre>
  
  <p>I don't actually get any error message, but it is allowing me to add duplicates in the database, which I know why : the value is a compound that doesn't exist in the database, and so the unique validation I wrote cannot catch duplicate on just a part of it.</p>