nategg
1 week ago
132
5
Laravel

1146 Error shows column name as the table name, says it doesn't exist

Posted 1 week ago by nategg

"Base table or view not found: 1146 Table '(my project name).round_id' doesn't exist (SQL: select count(*) as aggregate from round_id where user_id = 112" The error says my table name is 'round_id' but that's just one of the columns/form fields. The model is Draw and the table is draws. My controller is DrawController. I'm using resource controller so route does hit the right method (store), and I've tested the route with dumps. I've been getting this error since I applied validation to my form fields (first in the controller store() then moved to DrawRequest class rules()). If I comment out the validation, the store method will properly persist the input to the db. Even if I comment out the round_id line in the validation, error still says that's my table name. I can't find anything online with the validation as the apparent culprit. My validation looks like this:

    public function rules()
    {
        return [
                'round_id' => 'required',
                'user_id' => 'required|unique:round_id', 
                'hand_id' => 'required',
                'answer' => ['required','integer','max(999)'],
        ];
    }

Please help. Thanks

Please sign in or create an account to participate in this conversation.