예제 #1
0
 public function update(Request $request)
 {
     $profile = Profile::personal()->find(Auth::user()->id);
     $profile->firstname = $request->input('firstname');
     $profile->lastname = $request->input('lastname');
     $profile->location = $request->input('location');
     $profile->avatar_url = $request->input('avatar_url');
     $profile->save();
     return redirect()->route('profile.show')->with('info', 'Your Profile was saved!');
 }
예제 #2
0
 public function testUserCanSaveHisProfile()
 {
     $updatedProfile = factory(Profile::class)->make(['user_id' => $this->user->id]);
     $this->actingAs($this->user)->makeRequest('put', "/profile", ['firstname' => $updatedProfile->firstname, 'lastname' => $updatedProfile->lastname, 'location' => $updatedProfile->location, 'avatar_url' => $updatedProfile->avatar_url]);
     $actualProfile = Profile::personal()->find($this->user->id);
     $this->assertNotEmpty($actualProfile);
     $this->assertEquals($updatedProfile->firstname, $actualProfile->firstname);
     $this->assertEquals($updatedProfile->lastname, $actualProfile->lastname);
     $this->assertEquals($updatedProfile->location, $actualProfile->location);
     $this->assertEquals($updatedProfile->avatar_url, $actualProfile->avatar_url);
 }