Bladephp: Now with 8+ codeigniter, php, and laravel project 8+ php project From $37/Month From Rs. 2499/Month

How to retrieving a single row / column from a table in Laravel 5

by
Category:laravel
mysql laravel
How to retrieving a single row / column from a table in Laravel 5

We can retrieve single row/column from the database table, you may use the first method. This method will return a single StdClass object.

Let’s create a first method in laravel 5

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Http\Requests;
use DB;

class PostController extends Controller
{
    public function singlePost()
    {
        $getpost = DB::table('tbl_post')->where('slug', 'laravel')->first();
        echo $user->title;
    }
}

0 Comments


Html code work in comment box


Related Post