PHP code example of yektadg / medialibrary

1. Go to this page and download the library: Download yektadg/medialibrary 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/ */

    

yektadg / medialibrary example snippets


 public function handle(Request $request, Closure $next)
    {
        $user = auth()->user();
        $condition = false;
        if ($user && $user->id == 1) {
            $condition = true;
        }
        $request->merge(['accessAllMedia' => $condition]);

        return $next($request);
    }
shell
 php artisan vendor:publish --provider="YektaDG\Medialibrary\Providers\MediaLibraryServiceProvider"