Can you verify you have an id field in the clientSites table?
Oct 6, 2014
35
Level 2
Error -> Illuminate \ Database \ QueryException (42S22) SQLSTATE[42S22]: Column not found: 1054 Unknown column 'clientSites.id' in 'where clause' (SQL: select * from `clientSites` where `clientSites`.`id` = {ClientSites} limit 1)
This is the code in my route [code]Route::get('/edit/{ClientSite}','PagesController@edit'); Route::post('/edit', 'PagesController@doEdit');[/code] This is my controller code [code] public function edit($clientID) { // get the clientsite $ClientSite = ClientSite::find($clientID);
// show the edit form and pass the clientsite
return View::make('edit')
->with('ClientSite', $ClientSite);
}
public function doEdit()
{
$ClientSite = ClienSite::findOrFail(Input::get('clientID'));
$ClientSite->siteName = Input::get('siteName');
$ClientSite->description = Input::get('description');
$ClientSite->save();
return Redirect::action('PagesController@home');
}[/code]
and this in my view [code]
Edit client {{ $ClientSites->clientID }}
{{ Form::open(['url'=> '/edit', 'class'=>'form']) }}
{{ Form::hidden('clientID', $ClientSites->clientID) }}
<div class="form=group">
{{ Form::label('siteName', 'siteName:') }}
{{ Form::text('siteName', $ClientSites->siteName,['class' => 'form-control']) }}
</div>
<div class="form=group">
{{ Form::label('description', 'description:') }}
{{ Form::textarea('description', $ClientSites->description,['class' => 'form-control']) }}
</div>[/code]
Please or to participate in this conversation.