Created by
Jenny Rasmussen
last modified
| namespace App\Http\Controllers;
use Illuminate\Support\Facades\DB;
class YourController extends Controller
{
public function index()
{
$post = DB::connection('db_connection_name')
->table('posts')
->join('users', 'posts.post_author', '=', 'users.ID')
->select(array('posts.post_title', 'posts.post_content', 'users.display_name', 'posts.post_name'))
->where('post_status', '=', 'publish')
->orderby('post_date', 'desc')
->first();
$post_content = wpautop($post->post_content);
return view('home', compact('post', 'post_content'));
}
}
|