8 months ago

Unable to pass the auth() values to the Create function.

Posted 8 months ago by gouseferoz

I am passing the Auth()->id to the create function along with the other values.

But these values are not getting added and taking up only the default values passed that are used in the migrations.

public function create(Request $request)
        $id = auth()->id();
        $role = auth()->user()->user_role;
        $validateData = $request->validate([
          'name' => 'required|min:3'

            'name' => request('name'),
            'user_role' => $role,
            'user_id' => $id,
            'description' => "None"

        //$examcategories = ExamCategory::where('user_id',auth()->id())->get();

        return redirect('/superadmin/examcategory');

What am i doing wrong here?

Regards, Feroz.

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