Answers for "how to fatch values in laravel"

PHP
0

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);
    }
}
Posted by: Guest on October-22-2020
1

How to request and display data from db in larave

$users = DB::table('users')->get();
foreach($users as $key => $value)
{
	//to get each columns value
	//$value->name
}
Posted by: Guest on December-21-2020

Code answers related to "how to fatch values in laravel"

Browse Popular Code Answers by Language