app/Http/Controllers/ArticleCommentController.php
/**
     * Store a newly created resource in storage.
     *
     * @param Request $request
     * @param Article $article
     * @return Response
     */
Store a newly created resource in storage.
@param Request $request
@param Article $article
@return Response
Store a newly created resource in storage . @param Request $request @param Article $article @return Response
public function store(Request $request, Article $article)
    {
        if ($article->authorized_comment) {
            $validatedData = $request->validate([
                'content' => 'required|max:250',
            ]);
            $validatedData['article_id'] = $article->id;
            $validatedData['author_id'] = auth()->id();
            ArticleComment::query()->create($validatedData);
            session()->flash('status', trans('article.comment.submit_comment.comment.create'));
        }
        return redirect()->route('article.show', [$article, $article->slug]);
    }
public function store ( Request $ request , Article $ article ) { if ( $ article -> authorized_comment ) { $ validatedData = $ request -> validate ( [ 'content' => 'required|max:250' , ] ) ; $ validatedData [ 'article_id' ] = $ article -> id ; $ validatedData [ 'author_id' ] = auth ( ) -> id ( ) ; ArticleComment :: query ( ) -> create ( $ validatedData ) ; session ( ) -> flash ( 'status' , trans ( 'article.comment.submit_comment.comment.create' ) ) ; } return redirect ( ) -> route ( 'article.show' , [ $ article , $ article -> slug ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .