Skip to content

Instantly share code, notes, and snippets.

@programarivm
Last active October 25, 2019 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save programarivm/1db404c01f0aca7b88ad4c6f367a0b49 to your computer and use it in GitHub Desktop.
Save programarivm/1db404c01f0aca7b88ad4c6f367a0b49 to your computer and use it in GitHub Desktop.
Example showing how the Review model can be used in a controller
<?php
namespace App\Http\Controllers;
use App\Review;
use Illuminate\Http\Request;
class ReviewController extends Controller
{
public function results()
{
return Review::orderBy('created_at', 'desc')
->with('user')
->with('restaurant')
->get();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment