1. Go to this page and download the library: Download bekwoh/laravel-media-secure library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bekwoh / laravel-media-secure example snippets
use CleaniqueCoders\LaravelMediaSecure\LaravelMediaSecure;
LaravelMediaSecure::routes();
/**
* Register any authentication / authorization services.
*
* @return void
*/
public function boot()
{
$this->policies[config('laravel-media-secure.model')] = config('laravel-media-secure.policy');
$this->registerPolicies();
}
/**
* Middleware want to apply to the media route.
*/
'middleware' => [
'auth', 'verified',
],
// Get the view URL
// https://your-app.com/media/view/some-random-uuid
$view_url = get_view_media_url($media);
// Get the download URL
// https://your-app.com/media/download/some-random-uuid
$download_url = get_download_media_url($media);
// Get the stream URL
// https://your-app.com/media/stream/some-random-uuid
$stream_url = get_stream_media_url($media);