Add friend after click in Laravel

Table friend: $table->integer(‘user_id’); Table friend_user: $table->integer(‘user_id’); $table->integer(‘friend_id’); $table->primary([‘user_id’, ‘friend_id’]); User model: public function friends() { return $this->belongsToMany(User::class, ‘friend_user’, ‘user_id’, ‘friend_id’); } UserController: public function getAddFriend(User $user) { Auth::user()->friends()->attach($user->id); return redirect()->back(); } Why is it that if I write $user->id in attach(), the data is not inserted into table friend_user, but if I write the id(1,…

Image upload issue in laravel

I have successfully uploaded this formats (jpeg, png, gif) buh not jpg format is not being upload. public function store(Request $request) { $images = array(); if($request->hasFile(‘images’)){ foreach ($request->file(‘images’) as $image) { $path = $image->store(‘images’); $images[] = $path; } } dd($request->file(‘images’)); } My problem is just that! why is JPG format unable to upload. edit dd…