本文整理汇总了PHP中Comments::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Comments::with方法的具体用法?PHP Comments::with怎么用?PHP Comments::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comments
的用法示例。
在下文中一共展示了Comments::with方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
// SON GÖNDERİLEN SORULARI ÇEKELİM
$lastQuestions = Questions::with('user')->orderBy('id', 'DESC')->take(5)->get();
// EN SON CEVAP YAZILAN SORULARI ÇEKELİM
$lastComments = Comments::with('user', 'questions')->orderBy('id', 'DESC')->take(5)->get();
// VIEW'İ ÇALIŞTIRALIM
return View::make('home/index', compact('lastQuestions', 'lastComments'));
}
示例2: detail
public function detail($id)
{
// SORUYU TABLODAN ÇEKELİM
$question = Questions::with('user')->where('id', '=', $id)->orderBy('id', 'DESC')->first();
// EĞER SORU BULUNAMADIYSA YÖNLENDİRELİM
if (!$question) {
return Redirect::route('homePage');
}
// SAĞ BÖLÜM İÇİN RASTGELE SORULAR ÇEKELİM
$randomQuestions = Questions::take(3)->orderBy(DB::raw('RAND()'))->get();
// GÖNDERİLEN YANITLARI ÇEKELİM
$comments = Comments::with('user')->where('question_id', '=', $id)->get();
// VIEW'İ ÇALIŞTIRALIM
return View::make('questions.detail', compact('question', 'randomQuestions', 'comments'));
}
示例3: getAllFollowupActive
static function getAllFollowupActive()
{
$today = date('Y-m-d');
return Comments::with('Customers')->where("franchisee_id", "=", Session::get('franchiseId'))->where("reminder_date", "!=", "NULL")->where("reminder_type", "=", "followup")->where("reminder_status", "=", "active")->orderBy('reminder_date', 'desc')->get();
}