本文整理匯總了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();
}