Laravel Eloquent update()
it will return int. Int return values will be the number of affected rows resulted by update(). 0 means no row.
"An update query returns the number of rows that where affected by the update query."
https://stackoverflow.com/questions/38551397/laravel-dbupdate-only-return-0-or-1
Larave Eloquent insert()
It will return boolean (0 or 1). 0 means insert failed, 1 means success
"Yeah, Laravel will return a boolean saying if the query succeeded or not, so in your case just true. You can see that here:"
https://laracasts.com/discuss/channels/eloquent/return-value-from-dbinsert
https://github.com/laravel/framework/blob/8dde9527f42f061eaa68e32692d864d63835c57b/src/Illuminate/Database/Query/Builder.php#L2644
| /** | ||||||||||||||
| * Insert a new record into the database. | ||||||||||||||
| * | ||||||||||||||
| * @param array $values | ||||||||||||||
| * @return bool | ||||||||||||||
| */ | ||||||||||||||
public function insert(array $values)
|
No comments:
Post a Comment