theband
theband

Reputation: 37

laravel save create the object but not insert in database

I have problems in keeping the data in the database, the query creates the object for me returns the id of the same, but not the row inserted in the table.

This is the way in which I keep the data:

  $lineup = new lineup(); <br>
  $lineup->user_id = Auth::user()->id;<br>
  $lineup->date = $fecha; <br>
  $lineup->salary_rest = $salary_rest;<br>

   $lineup->save();

PD: I am using laravel 4.2.

Upvotes: 1

Views: 1482

Answers (1)

Brett
Brett

Reputation: 2010

There are 2 things to check when items aren't saving to the database.

Check the config/database.php file to ensure it's using the correct database driver.

Secondly ensure if a Transaction is being used that a commit statement is called.

DB::beginTransaction()
// Your code
DB::commit()

Without the commit the changes won't flow through to the database

Upvotes: 2

Related Questions