Created
October 23, 2025 15:46
-
-
Save NandoKstroNet/e6538b028db89bdb7024e1e8248fed05 to your computer and use it in GitHub Desktop.
Processos básicos CRUD nos videos: VideoFlix Code Experts Laravel 12 e InertiaJS 2 em https://codeexperts.com.br
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| public function store(Request $request, Content $content) | |
| { | |
| $video = $content->videos()->create([ | |
| 'code' => Str::uuid(), | |
| 'name' => $request->name, | |
| ]); | |
| return $video; | |
| } | |
| public function update(Content $content, $video, Request $request) | |
| { | |
| $video = $content->videos()->findOrFail($video); | |
| $video->update([ | |
| 'name' => $request->name, | |
| 'description' => $request->description | |
| ]); | |
| return redirect()->back(); | |
| } | |
| public function destroy(Content $content, $video) | |
| { | |
| $video = $content->videos()->findOrFail($video); | |
| $video->delete(); | |
| return redirect()->back(); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment