laravel select column from table code example

Example 1: laravel model particular column

Table::select('column1', 'column2')
            ->where('checker', 'value')
            ->get();

Example 2: eloquest how to select one specific column in database

$result = DB::Table('table_name')->select('column1','column2')->where('id',1)->get();

Example 3: eloquest how to select one specific column in database

Model::where('id', 1)
         ->pluck('name', 'surname')
         ->all();

Example 4: DB::table('users')->get();

DB::select('SELECT * FROM users WHERE name = ?', array(Input::get('name')));

Example 5: laravel select count

$count = DB::table('category_issue')->count();

Example 6: laravel find query

// Retrieve a model by its primary key...
$flight = App\Models\Flight::find(1);

// Retrieve the first model matching the query constraints...
$flight = App\Models\Flight::where('active', 1)->first();

// Shorthand for retrieving the first model matching the query constraints...
$flight = App\Models\Flight::firstWhere('active', 1);

Tags:

Php Example