Support the ongoing development of Laravel.io →
Requests Session Forms
Last updated 2 years ago.
0

What do you get when you dd the file?

0

thomastkim said:

What do you get when you dd the file?

Just null

0

Hmm... I copied/pasted it, and it worked out fine. I can't see anything that would be an issue either.

Are you sure it's hitting that controller method, and also, can you post your ItemRequest class?

0

thomastkim said:

Hmm... I copied/pasted it, and it worked out fine. I can't see anything that would be an issue either.

Are you sure it's hitting that controller method, and also, can you post your ItemRequest class?

Hmm strange :/ This is the ItemRequest class:

<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;
use Auth;

class ItemRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return Auth::check();
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $rules = [
            'title'  => 'required|min:5',
            'description'  => 'required|min:10',
            'price'  => 'required',
            'category_id'  => 'required',
        ];

        if($this->request->get('dimension_measurement')){
            foreach($this->request->get('dimension_measurement') as $key => $val){
                $rules['dimension_measurement.'.$key] = 'numeric';
            }
        }

        return $rules;
    }
}

Could it be because I am using the inbuilt php server?

0

I don't think so. It works out for me.

If you dd($request->all()), what do you get?

0
Solution

Never mind, I had extended App\Http\Requests\Request instead of Illuminate\Http\Request in my ItemRequest class so it didn't work! Thanks for the help :)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

sp99 sp99 Joined 30 Sep 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.