We will use DB class for this. Suppose we have a table. Name of the table is table1.

FirstnameLastname
HarryPotter
TomRiddle

This will be a table in database, I am showing this here just for understanding.
Lets see the code to fetch all rows of this table.

use Illuminate\Support\Facades\DB;

class NameofClass {
    public function getTableData( Request $request ) {
        $allRows = DB::table('table1')->get();
        return $allRows;
    }
}

This function return value will be
[{“Firstname“:”Harry”,”Lastname“:”Potter”},{“Firstname“:”Tom”,”Lastname“:”Riddle”}]