title: General error: 1366 Incorrect integer value Laravel
body: <p>I'm stuck with this error. I explain the view a little.</p>
  
  <p>I have a form to create a New project, when I created it I hide the form and I save it, then I render an other form to create translation, I create it and I save it, and finally I render an other form to create client, I create and it save it.</p>
  
  <p>At this moment, just in the same function, I want to save another value in another table. </p>
  
  <p>I want to save in client_projects the value of the last client_id and project_id saved in database. </p>
  
  <p>So i try this:</p>
  
  <pre><code>$client_project = new Client_Project();
              $client_project-&gt;client_id = DB::table('clients')-&gt;where('id', DB::raw("(select max(id) from clients)"))-&gt;get();
              $client_project-&gt;project_id = DB::table('projects')-&gt;where('id', DB::raw("(select max(id) from projects)"))-&gt;get();
              $client_project-&gt;save();
  </code></pre>
  
  <p>But it give me the error of the title::</p>
  
  <pre><code>SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '[{"id":49,"name":"hola","slug":"hola","priority":1,"created_at":"2017-08-03 13:53:35","updated_at":"2017-08-03 13:53:35"}]' for column 'client_id' at row 1 (SQL: insert into `client_project` (`client_id`, `project_id`, `updated_at`, `created_at`) values ([{"id":49,"name":"hola","slug":"hola","priority":1,"created_at":"2017-08-03 13:53:35","updated_at":"2017-08-03 13:53:35"}], [{"id":40,"slug":"1","order":40,"public":1,"pathheader":"\/tmp\/phpf8NUkb","pathhome":"\/tmp\/php9zepk7","created_at":"2017-08-03 13:49:53","updated_at":"2017-08-03 13:49:53"}], 2017-08-03 13:53:35, 2017-08-03 13:53:35))
  </code></pre>
  
  <p>The full function where i create the client and i try to create the client_projects is this</p>
  
  <pre><code>public function storeProjectsClients(Request $request) {
              $client = new Client();
              $client-&gt;name = $request-&gt;input("nameClient");
              $client-&gt;slug = $request-&gt;input("slugClient");
              $client-&gt;priority = $request-&gt;input("priorityClient");
              $client-&gt;save();
              $client_project = new Client_Project();
              $client_project-&gt;client_id = DB::table('clients')-&gt;where('id', DB::raw("(select max(id) from clients)"))-&gt;get();
              $client_project-&gt;project_id = DB::table('projects')-&gt;where('id', DB::raw("(select max(id) from projects)"))-&gt;get();
              $client_project-&gt;save();
          }
  </code></pre>
  
  <p>I know it's better to pass using json the value of the project_id and client_id, cause if some users are doing this at the same time it will give problems, but anyway, this is only for me.</p>
  
  <p>Any help will be appreciated a lot.</p>