I'm following this tutorial which suggests a Resource Controller Laravel API Setup.
Everything is working well in a Resource Controller, I have a fair understanding as to what's going on, but when I get to the update function, I return a successful message but never update the database.
Here it is (verbatim from site):
public function update($id)
{
$url = Url::where('user_id', Auth::user()->id)->find($id);
if ( Request::get('url') )
{
$url->url = Request::get('url');
}
if ( Request::get('description') )
{
$url->description = Request::get('description');
}
$url->save();
return Response::json(array(
'error' => false,
'message' => 'url updated'),
// or 'message' => $url),
200
);
}
From a quick look, can you see why it's just returning what is already in the database? It doesn't even like to change the "updated_at" timestamp Laravel seems to be pretty smart about.