Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to get data from a table in laravel

use IlluminateSupportFacadesDB;

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

        return view('some-view')->with('users', $users);
    }
}
Comment

get from table laravel

$users = DB::table('users')->get();
 
foreach ($users as $user) {
    echo $user->name;
}
Comment

PREVIOUS NEXT
Code Example
Php :: how to install symfony in windows 10 
Php :: php trim quotes 
Php :: php array to object 
Php :: laravel logout current user 
Php :: check if array contains only unique values php 
Php :: drupal 8 get enabled languages 
Php :: wordpress post type template 
Php :: drop column migration laravel 
Php :: is_unique in codeigniter form validation 
Php :: string match in php 
Php :: date time in php 
Php :: laravel eloquent many to many query using whereHas 
Php :: laravel store array to cache 
Php :: join array of strings php 
Php :: call function in php 
Php :: pagination php mysql 
Php :: how to get public folder path in laravel 
Php :: submonth carbon 
Php :: laravel with callback 
Php :: laravel blade @selected 
Php :: woocommerce order item get product id 
Php :: lDownload multiple files as a zip-file using php 
Php :: php bcrypt password verify 
Php :: uninstall phpstorm ubuntu 
Php :: php new line 
Php :: how to get http parameters in php 
Php :: how to build laravel database 
Php :: show woocommerce product variation in table php 
Php :: create model laravel 
Php :: PHP similar_text — Calculate the similarity between two strings 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =