Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace AppHttpRequests;
- use AppHttpRequestsRequest;
- class CreateArticleRequest extends Request
- {
- /**
- * Determine if the user is authorized to make this request.
- *
- * @return bool
- */
- public function authorize()
- {
- return true;
- }
- /**
- * Get the validation rules that apply to the request.
- *
- * @return array
- */
- public function rules()
- {
- return [
- 'title' => 'required|min:3',
- 'body' => 'required',
- 'published_at' => 'required|date'
- ];
- }
- }
- public function create()
- {
- return view('articles.create');
- }
- public function store(CreateArticleRequest $request)
- {
- Article::create($request->all());
- return redirect('articles');
- }
- {{ dd($errors->all()) }}
- @if ($errors->any())
- <ul class="alert alert-danger">
- @foreach ($errors->all() as $error)
- <li>{{ $error }}</li>
- @endforeach
- </ul>
- @endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement