@RossUK where's the $data variable coming from in your Controller Method?
I'd guess that's what causing the issue
$customer->update($data);
Hi I am getting an error 500 on a test I am running and am struggling to find what I have dome wrong. Below is my test and controller method and route :)
/** @test */
public function authenticated_users_can_update_existing_customer()
{
$this->withExceptionHandling();
$customer = factory('App\Customer')->create();
$data = [
'company' => 'Acme Ltd',
'first_name' => 'Ross',
];
$this->actingAs($this->user)
->patchJson(route('customer.update', $customer->id),$data)
->assertStatus(202);
$customer = $customer->fresh();
$this->assertEquals('Acme Ltd', $customer->company);
}
And my Controller Method and route
public function update(Customer $customer,Request $request)
{
//$this->validator(request()->all())->validate();
$customer->update($data);
return request()->wantsJson()
? response()->json($customer, 202)
: null;
}
// Resource Routes
Route::resource('customer', 'CustomerController')->middleware('auth');
Thanks for any help in advance :)
@RossUK where's the $data variable coming from in your Controller Method?
I'd guess that's what causing the issue
$customer->update($data);
Please or to participate in this conversation.