Answers for "get a single value from a db in laravel 8"

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
0

laravel db inserr

DB::table('users')->insert([
    ['email' => '[email protected]', 'votes' => 0],
    ['email' => '[email protected]', 'votes' => 0],
]);
Posted by: Guest on January-23-2021

Code answers related to "get a single value from a db in laravel 8"

Browse Popular Code Answers by Language