enexspecial's avatar

Please help me solve this Error: [Creating default object from empty value]

I am trying to create a profile page that includes adding of image and i got this error [Creating default object from empty value].

Here is my migration file: public function up() { Schema::create('profiles', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id'); $table->string('photo'); $table->string('address'); $table->string('ethnicity'); $table->string('state'); $table->timestamps(); }); }

Here is my controller public function store(Request $request) { //validate form $this->validate($request,[ 'photo' => 'required|mimes:jpg,png,jpeg,bmp', 'address' => 'required|max:191', 'ethnic' => 'required|min:3', 'state' => 'required', ]); Session(); $user = new User; $profiles = new profile; $profiles->photo = $request->input('photo'); $profiles->address = $request->input('address'); $profiles->ethnic = $request->input('ethnic'); $profiles->state = $request->input('state'); $profile->user_id = auth()->user()->id; return auth()->user()->id; exit(); } Here is my form:

{{csrf_field()}} Fullname My Location Mobile Upload Picture Home Address Ethnicity State of Origin Submit Profile
</div>
0 likes
1 reply

Please or to participate in this conversation.