File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,20 @@ $vimeo->upload('/home/aaron/foo.mp4');
1313
1414// Want to use a facade?
1515Vimeo::uploadImage('/videos/123/images', '/home/aaron/bar.png', true);
16+ Vimeo::upload($video, [
17+ 'name' => NAME,
18+ 'privacy.view' => [
19+ 'anybody',
20+ 'contacts',
21+ 'disable',
22+ 'nobody',
23+ 'password',
24+ 'unlisted',
25+ 'users'
26+ ],
27+ 'folder_uri' => 'https://vimeo.com/manage/folders_name/folder_id'
28+ ]);
29+ Vimeo::request('/videos/'. $value, ['per_page' => 2], 'GET');
1630```
1731
1832[ ![ Build Status] ( https://img.shields.io/travis/vimeo/laravel/master.svg?style=flat )] ( https://travis-ci.org/vimeo/laravel )
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace Vimeo \Laravel \Rules ;
3+
4+ use Illuminate \Contracts \Validation \Rule ;
5+ use Vimeo \Laravel \Facades \Vimeo ;
6+
7+ class VimeoVideoIdValidationRule implements Rule
8+ {
9+ /**
10+ * Determine if the validation rule passes.
11+ *
12+ * @param string $attribute
13+ * @param mixed $value
14+ * @return bool
15+ */
16+ public function passes ($ attribute , $ value )
17+ {
18+ // Make an API request to Vimeo to check if the video with the given ID exists.
19+ // Replace 'your-api-endpoint' with the actual API endpoint you want to use.
20+ $ response = Vimeo::request ('/videos/ ' .$ value , [], 'GET ' );
21+
22+ // Check if the response status is 200, indicating a successful request.
23+ return data_get ($ response , 'status ' ) === 200 ;
24+ }
25+
26+ /**
27+ * Get the validation error message.
28+ *
29+ * @return string
30+ */
31+ public function message ()
32+ {
33+ // Return a generic error message if the validation fails.
34+ return __ ('The :attribute format is invalid. ' );
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments