I want to update my data using Eloquent but it gave me some error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'od_logo.id' in 'where clause' (SQL: select * from `od_logo` where `od_logo`.`id` = 1 limit 1)
Here is my code:
$logo = Logo::find($id);
$logo->logo_logoimg_name = Input::get('logo_name');
$logo->logo_logoimg_path = $logo_destinationPath . $logo_filename;
$logo->logo_faviconimg_name = $favicon_destinationPath . $favicon_filename;
$logo->save();
Please find where I do wrong in this code
Because your primary key column is not called id
(which is the default Laravel assumes) you have to specify it in your model:
class Logo extends Eloquent {
protected $primaryKey = 'logo_id';
}
Quote from the docs:
Note: Eloquent will also assume that each table has a primary key column named id. You may define a primaryKey property to override this convention.