I\'m trying get a single value from MySQL database using laravel but the problem I\'m getting an array . this is my query result in MySQL command line:
select gr
As of Laravel >= 5.3, best way is to use value:
$groupName = \App\User::where('username',$username)->value('groupName');
or
use App\User;//at top of controller
$groupName = User::where('username',$username)->value('groupName');//inside controller function
Of course you have to create a model User for users table which is most efficient way to interact with database tables in Laravel.