本文整理汇总了PHP中Program::with方法的典型用法代码示例。如果您正苦于以下问题:PHP Program::with方法的具体用法?PHP Program::with怎么用?PHP Program::with使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program::with方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: studentPerprogramFilter
public function studentPerprogramFilter($id)
{
$program_id = $id;
$program = Program::with('courses')->find($program_id);
$programs = Program::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
$menu = 'report';
return View::make('reports.studentperprogram', compact('programs', 'program', 'menu'));
}
示例2: destroy
public function destroy($id)
{
$program = Program::with('courses')->find($id);
if ($program->courses->count() > 0) {
Session::flash('message', 'Tidak dapat menutup program! Program ini pernah berjalan');
} else {
Program::destroy($id);
Session::flash('message', 'Sukses menutup program!');
return Redirect::route('programs.index');
}
}
示例3: getProgramsArchiveHtml
/**
* 获取节目单HTML字符串
*
* @param string $keyword
* @return string
*/
private function getProgramsArchiveHtml($keyword = '')
{
// query program list, and sort by date
$programs = Program::with('participants')->enabled()->orderBy('date', 'desc')->get();
// search
if ($keyword) {
$keywords = array_filter(explode(' ', $keyword));
foreach ($keywords as $keyword) {
$participantIds = Participant::searched($keyword)->lists('id');
$programIds = ProgramParticipant::whereIn('participant_id', $participantIds)->lists('program_id')->flip()->toArray();
foreach ($programs as $i => $program) {
if (false === strpos(strtolower($program->topic), $keyword) and empty($programIds[$program->id])) {
unset($programs[$i]);
}
}
}
}
// collect
$list = [];
foreach ($programs as $program) {
$list[$program->dates->year][$program->dates->month][] = $program;
}
// render page
return (string) View::make('program.index.archive')->with('list', $list);
}