vendredi 1 juillet 2016

How to insert if not exist illuminate slim framework

I use slim framework and use illuminate/database.

I would like to insert data which not duplicate function_number but if different product_id function_number can be duplicate, for example

enter image description here

here is my mode

$app->post('/create_function', function($request, $reponse, $args) {
   $query = $this->db->table('functions')->insert([
            'project_id' => $request->getParam('project_id'),
            'function_number' => $request->getParam('function_number'), 
            'function_text' => $request->getParam('function_text'),
            'created' => date('Y-m-d')
         ]);
   if($query) {
     echo "Function was created";
   }

});

pls help, thx



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2957omj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire