本文整理汇总了PHP中App\Http\Requests\ArticleRequest::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ArticleRequest::get方法的具体用法?PHP ArticleRequest::get怎么用?PHP ArticleRequest::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Http\Requests\ArticleRequest
的用法示例。
在下文中一共展示了ArticleRequest::get方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update the specified resource in storage.
*
* @param ArticleRequest $request
* @param Article $article
* @return Response
*/
public function update(ArticleRequest $request, Article $article)
{
$article->update($request->all());
$article->tags()->sync($request->get('tag_list'));
session()->flash('success', 'Запись ' . $request->get('title') . ' обновлена');
return redirect()->route('article.index');
}
示例2: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Requests\ArticleRequest $request, $id)
{
$article = Article::findOrFail($id);
$article->update($request->all());
$article->tags()->sync($request->get('tag_list', []));
return redirect()->action('Goenitz\\ArticleController@index');
}
示例3: update
/**
* Update the specified resource in storage.
*
* @param Article $article
* @param ArticleRequest $request
* @return \Illuminate\Http\Response
*/
public function update(Article $article, ArticleRequest $request)
{
$article->update($request->all());
if ($tags = $request->get('tag_list')) {
$article->tags()->sync($tags);
}
flash()->success('Article has been edited!');
return Redirect::back();
}
示例4: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(ArticleRequest $request, $id)
{
$article = Article::find($id);
//Check fileImage
if ($request->hasFile('image')) {
$image = $request->file('image');
$imagename = time() . '-' . $image->getClientOriginalName();
$image->move(public_path() . '/image', $imagename);
} else {
$imagename = $article->image;
}
//Status
if ($request->Input('status') == false) {
$status = 0;
} else {
$status = 1;
}
//data
$data = ['name' => $request->get('name'), 'summary' => $request->get('summary'), 'content' => $request->get('content'), 'image' => $imagename, 'status' => $status];
//update
//dd($data);
$article->update($data);
return redirect()->route('article.index');
}
示例5: createArticle
/**
* @param ArticleRequest $request
*/
private function createArticle(ArticleRequest $request)
{
$article = Auth::user()->articles()->create($request->all());
$this->syncTags($article, $request->get('tag_list'));
}
示例6: createArticle
/**
* Save a new article
* @param ArticleRequest $request
* @return mixed
*/
private function createArticle(ArticleRequest $request)
{
$user = Sentinel::getUser();
$articleCredentials = ['title' => strtolower($request->get('title')), 'user_id' => $user->id, 'lang' => $request->get('lang'), 'body' => $request->get('body'), 'published_at' => $request->get('published_at')];
$article = Article::create($articleCredentials);
$tags = (array) $request->input('tag_list');
if (count($tags)) {
$this->syncTags($article, $tags);
}
return $article;
}
示例7: update
public function update(ArticleRequest $request, $id = 0)
{
$article = Article::findOrFail($id);
$article->update(['title' => $request->get('title'), 'category_id' => $request->get('category_id'), 'sort' => $request->get('sort'), 'views' => $request->get('views'), 'tag' => $request->get('tag'), 'is_recommend' => $request->get('is_recommend'), 'is_show' => $request->get('is_show'), 'info' => $request->get('info'), 'url' => $request->get('url'), 'cover' => $request->get('cover'), 'thumb' => $request->get('thumb'), 'text' => $request->get('text'), 'subtitle' => $request->get('subtitle'), 'author' => $request->get('author'), 'source' => $request->get('source'), 'keywords' => $request->get('keywords'), 'description' => $request->get('description'), 'hash' => $request->get('hash')]);
if ($article) {
Cache::store('article')->flush();
Attachment::where(['hash' => $article->hash, 'project_id' => 0])->update(['project_id' => $article->id]);
$message = '文章修改成功,请选择操作!';
$url = [];
$url['返回文章列表'] = ['url' => route('admin.articles.index')];
if ($article->category_id > 0) {
$url['返回栏目文章列表'] = ['url' => route('admin.articles.show', $article->category_id)];
}
$url['继续添加'] = ['url' => route('admin.articles.create')];
$url['继续编辑'] = ['url' => route('admin.articles.edit', $article->id)];
$url['查看文章'] = ['url' => route('article.show', $article->id), 'target' => '_blank'];
return Theme::view('admin.message.show', compact('message', 'url'));
}
}
示例8: 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)
{
$data = [];
$article = Article::find($id);
$data['article_category_id'] = $request->get('article_category_id');
$data['title'] = $request->get('title');
$data['description'] = $request->get('description');
if ($request->file('image') != null) {
if (!$request->file('image')->isValid()) {
Session::flash('warning', "Gambar tidak berhasil disimpan!");
return redirect()->back()->withInput();
} else {
if ($article->image != null && file_exists('img/article/' . $article->image)) {
unlink('img/article/' . $article->image);
$data['image'] = time() . '.' . $request->file('image')->getClientOriginalExtension();
$request->file('image')->move('img/article', $data['image']);
}
}
}
$article->update($data);
Session::flash('success', "Artikel baru berhasil disunting!");
return redirect()->route('admin.article.index');
}