initial commit
This commit is contained in:
		
							
								
								
									
										31
									
								
								app/Actions/Jetstream/UpdateTeamName.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								app/Actions/Jetstream/UpdateTeamName.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace App\Actions\Jetstream; | ||||
| 
 | ||||
| use Illuminate\Support\Facades\Gate; | ||||
| use Illuminate\Support\Facades\Validator; | ||||
| use Laravel\Jetstream\Contracts\UpdatesTeamNames; | ||||
| 
 | ||||
| class UpdateTeamName implements UpdatesTeamNames | ||||
| { | ||||
|     /** | ||||
|      * Validate and update the given team's name. | ||||
|      * | ||||
|      * @param  mixed  $user | ||||
|      * @param  mixed  $team | ||||
|      * @param  array  $input | ||||
|      * @return void | ||||
|      */ | ||||
|     public function update($user, $team, array $input) | ||||
|     { | ||||
|         Gate::forUser($user)->authorize('update', $team); | ||||
| 
 | ||||
|         Validator::make($input, [ | ||||
|             'name' => ['required', 'string', 'max:255'], | ||||
|         ])->validateWithBag('updateTeamName'); | ||||
| 
 | ||||
|         $team->forceFill([ | ||||
|             'name' => $input['name'], | ||||
|         ])->save(); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user