Answers for "laravel get data from database in model"

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 get data from request

dd($request->all());
//print an array of the input name and the input value
Posted by: Guest on July-04-2020

Code answers related to "laravel get data from database in model"

Browse Popular Code Answers by Language