How do I get User data in Array in Laravel

In this tutorial im going to learn how to get all user data in array.

First to create Controller

php artisan make:controller Youtube

Next to create Route go to web.php.


Go to your controller Youtube.php and paste below code.


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;

class Youtube extends Controller
public function index()
echo "<pre>";

Now run below code.

Now data get successully from Users Table. Thanks đź‘Ťđź‘Ť



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store