本文整理匯總了PHP中app\Question::sender方法的典型用法代碼示例。如果您正苦於以下問題:PHP Question::sender方法的具體用法?PHP Question::sender怎麽用?PHP Question::sender使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app\Question
的用法示例。
在下文中一共展示了Question::sender方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: storequestion
public function storequestion(Request $request)
{
//
$rules = ['issue_id' => 'required', 'sendDate' => 'required', 'question' => 'required'];
$this->validate($request, $rules);
$issue = Issue::findOrFail($request->get('issue_id'));
$issue->status = "等待回覆";
$issue->save();
$project = Project::findOrFail($issue->project_id);
foreach ($request->get('sendList') as &$receiver) {
if (empty($sendList)) {
if ($receiver == '業務') {
$target_id = $project->salesman;
} elseif ($receiver == '業務主管') {
$target = User::where('job', '業務主管')->firstOrFail();
$target_id = $target->id;
} elseif ($receiver == '產品專員') {
$target = User::where('job', '產品專員')->firstOrFail();
$target_id = $target->id;
} elseif ($receiver == '總經理') {
$target = User::where('job', '總經理')->firstOrFail();
$target_id = $target->id;
}
$sendList = $target_id;
} else {
if ($receiver == '業務') {
$target_id = $project->salesman;
} elseif ($receiver == '業務主管') {
$target = User::where('job', '業務主管')->firstOrFail();
$target_id = $target->id;
} elseif ($receiver == '產品專員') {
$target = User::where('job', '產品專員')->firstOrFail();
$target_id = $target->id;
} elseif ($receiver == '總經理') {
$target = User::where('job', '總經理')->firstOrFail();
$target_id = $target->id;
}
$sendList = $sendList . "|" . $target_id;
}
}
$question = new Question(array('question' => $request->get('question'), 'sendDate' => $request->get('sendDate'), 'sendList' => $sendList, 'status' => '等待回覆'));
$question->issue()->associate($issue);
$sender = User::find(\Auth::id());
$question->sender()->associate($sender);
$question->save();
return \Redirect::to('issue/show/' . $issue->id)->with('message', 'Your Issue has been updated!');
}