I need to use an variable to make a query in other function. How i can do this?
public function getestados($nick)
{
$nivel = DB::table('locais')
->where('nick', $nick)
->get('nivel');
return $nivel->toJson(JSON_PRETTY_PRINT);
}
public function elevar($nivel) {
$novonivel = DB::table('niveis')
->where('cond', $nivel) // previous variable
->get();
return response()->json([$novonivel]);
}
source https://stackoverflow.com/questions/77549046/how-to-use-a-variable-from-a-function-in-another-function-in-laravel
No comments:
Post a Comment