Skip to content

PHP code snippet – How to get data from a table in laravel?

use Illuminate\Support\Facades\DB;

class UserController extends Controller
    public function index()
        $users = DB::table('users')->select('id','name','email')->get();

        return view('some-view')->with('users', $users);
See also  How do i get DefaultTableModel rows sum in column in Java?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.