I've a method in my Controller:
function getSuggestions()
{
$query = Input::get('query');
$suggestions = Suggestion::where('word', 'LIKE', "$query%")->get()->toArray();
$return $suggestions;
}
and in Model I have:
public function toArray(){
$array = parent::toArray();
$array['matched'] = 'ok';
return $array;
}
How can I pass a variable to this toArray() method to append it to the Model? Something like this: $array['matched'] = $query I can't pass the $query directly to toArray($query). Any other way?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire