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

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;
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *