本文整理汇总了PHP中App\Http\Requests\ArticleRequest::getClientIp方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleRequest::getClientIp方法的具体用法?PHP ArticleRequest::getClientIp怎么用?PHP ArticleRequest::getClientIp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Requests\ArticleRequest
的用法示例。
在下文中一共展示了ArticleRequest::getClientIp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(ArticleRequest $request, $id)
{
$article = Article::findOrFail($id);
if (Permissions::check('article.edit') or Permissions::check('article.editown') and $article->user_id == Auth::user()->id and $article->published == 0) {
$article->title = $request->input('title');
$article->slug = $request->input('slug');
$article->temporary_jumbo_image = $request->input('temporary_jumbo_image');
$article->store = $request->input('store');
$article->store_app_id = $request->input('store_app_id');
$article->subreddit = $request->input('subreddit');
$article->score = $request->input('score');
$article->titletext = $request->input('titletext');
$article->score_text_md = $request->input('score_text_md');
$article->gameplay_md = $request->input('gameplay_md');
$article->story_md = $request->input('story_md');
$article->graphics_md = $request->input('graphics_md');
$article->conclusion_md = $request->input('conclusion_md');
$article->screenshots_md = $request->input('screenshots_md');
$article->intro_md = $request->input('intro_md');
//actual fields
$article->score_text = Markdown::convertToHtml($request->input('score_text_md'));
$article->gameplay = Markdown::convertToHtml($request->input('gameplay_md'));
$article->story = Markdown::convertToHtml($request->input('story_md'));
$article->graphics = Markdown::convertToHtml($request->input('graphics_md'));
$article->conclusion = Markdown::convertToHtml($request->input('conclusion_md'));
$article->screenshots = Markdown::convertToHtml($request->input('screenshots_md'));
$article->intro = Markdown::convertToHtml($request->input('intro_md'));
$article->save();
$screenshots = array();
if ($request->input('screenshot') != null) {
foreach ($request->input('screenshot') as $key => $screenshot) {
$screenshots[$key]['image_id'] = $screenshot;
$screenshots[$key]['article_id'] = $article->id;
$screenshots[$key]['ip_address'] = inet_pton($request->getClientIp());
}
}
ArticleScreenshot::insert($screenshots);
return redirect()->action('ArticleController@show', [$article->slug]);
}
abort(403);
}