Finally, I found a solution like a big one.
In my TeamProfileDetailsController
class TeamProfileDetailsController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function update(Request $request, Team $team)
{
abort_unless($request->user()->ownsTeam($team), 403);
$team->forceFill([
'street1' => $request->street1,
])->save();
}
}
In my route file :
Route::put('/settings/'.Spark::teamsPrefix().'/{team}/team-profile-details', 'TeamProfileDetailsController@update');
And in my component
Vue.component('update-team-profile-details', {
props: ['user', 'team'],
data() {
return {
form: new SparkForm({
street1: ''
})
};
},
mounted() {
this.form.street1 = this.team.street1;
},
methods: {
update() {
Spark.put(this.urlForUpdate, this.form);
}
},
computed: {
/**
* Get the URL for update profile details method update.
*/
urlForUpdate() {
return `/settings/${Spark.teamsPrefix}/${this.team.id}/team-profile-details`;
}
}
});