Dropbox Integration with Voyager

Posted In Introductions
  • xm-arks 1 year ago
    Hello,
    I am trying to integrate Dropbox with Laravel Voyager.
    I have tried the instructions here: https://laravel.com/docs/5.5/filesystem#custom-filesystems
    
    As well as tried to install an independed package that seems to just inclue the above instructions out of the box: https://github.com/benjamincrozat/laravel-dropbox-driver
    	
    With either method, I get this error:
    > 	This driver does not support retrieving URLs. (View: /home/vagrant/code/voyager/vendor/tcg/voyager/resources/views/master.blade.php) (View: /home/vagrant/code/voyager/vendor/tcg/voyager/resources/views/master.blade.php)
    
    image link to Error: https://screenshots.firefox.com/I5LAPjbMwDuILwCP/voyager.test
    
    So it seems that the built-in methods of `FilesystemAdapter` just does not support Dropbox. Is there anything to be done? Can I extend this method to add Dropbox Functions? How can this be done so it integrates with the Image Capabilities of Voyager?
    
    Any tips are highly appreciated,
    Regards
    

    Hello, I am trying to integrate Dropbox with Laravel Voyager. I have tried the instructions here: https://laravel.com/docs/5.5/filesystem#custom-filesystems

    As well as tried to install an independed package that seems to just inclue the above instructions out of the box: https://github.com/benjamincrozat/laravel-dropbox-driver

    With either method, I get this error:

    This driver does not support retrieving URLs. (View: /home/vagrant/code/voyager/vendor/tcg/voyager/resources/views/master.blade.php) (View: /home/vagrant/code/voyager/vendor/tcg/voyager/resources/views/master.blade.php)

    image link to Error: https://screenshots.firefox.com/I5LAPjbMwDuILwCP/voyager.test

    So it seems that the built-in methods of FilesystemAdapter just does not support Dropbox. Is there anything to be done? Can I extend this method to add Dropbox Functions? How can this be done so it integrates with the Image Capabilities of Voyager?

    Any tips are highly appreciated, Regards

  • cbmagent-agent 1 year ago
    Not sure if the versions have anything to do with anything, however we are not on v5.5 we are: 5.4.28
    
    Though I did find filesystem values:
    
                'filesystem'           => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
                'filesystem.disk'      => [\Illuminate\Contracts\Filesystem\Filesystem::class],
                'filesystem.cloud'     => [\Illuminate\Contracts\Filesystem\Cloud::class],
    
    I notice your URL system is showing /home/vagrant/code/, I am not very experienced with laravel, but the scripts i install normally only pull starting from my publichtml on... i usually don't see "home" in any of the links, but like i said, this may have nothing to do with anything, just trying to help maybe point out possibilities. 

    Not sure if the versions have anything to do with anything, however we are not on v5.5 we are: 5.4.28

    Though I did find filesystem values:

            'filesystem'           => [\Illuminate\Filesystem\FilesystemManager::class, \Illuminate\Contracts\Filesystem\Factory::class],
            'filesystem.disk'      => [\Illuminate\Contracts\Filesystem\Filesystem::class],
            'filesystem.cloud'     => [\Illuminate\Contracts\Filesystem\Cloud::class],
    

    I notice your URL system is showing /home/vagrant/code/, I am not very experienced with laravel, but the scripts i install normally only pull starting from my publichtml on... i usually don't see "home" in any of the links, but like i said, this may have nothing to do with anything, just trying to help maybe point out possibilities.

  • cbmagent-agent 1 year ago
    drop this in a blade and goto that page and see what version it brings up for you. 
    
    {{ App::VERSION() }}
    
    sorry you might be using a different script than I am, and your version may differ, didn't think about that. 

    drop this in a blade and goto that page and see what version it brings up for you.

    {{ App::VERSION() }}

    sorry you might be using a different script than I am, and your version may differ, didn't think about that.

  • xm-arks 1 year ago
    Hello,
    
    Thank you for checking this out. Sorry for not getting back to you sooner.
    
    Apologies, I did not know Voyager did not support Laravel 5.5. Reading the Installation [Instructions](https://voyager.readme.io/docs/installation), it says:
    > If you are installing with Laravel 5.4 you will need to Add the Service Provider manually. Otherwise, if you are on 5.5 this happens automatically thanks to package auto-discovery.
    
    So I guessed there was no Problem with Laravel 5.5.
    
    In any case, I created another Fresh Laravel Installation. I tried to pull Laravel 5.4, but ended up with `5.4.36` not `5.4.28`. Not sure now if this would too be a problem. If yes, then I'll try to figgure something out to get the exact `5.4.28` version.
    
    So what I have done:
    * I am working on Homestead. I just refreshed the Virtual Machine
    	* Vagrant V 2.0.1
    	* Virtualbox 5.2.2
    	* Vagrant box laravel/homestead 5.0.1
    	* Homestead 2.0
    * Installed Fresh Laravel Package: screenshot: `https://screenshots.firefoxusercontent.com/images/9b3c088a-0bb4-4f4e-b042-a65c56e86bb0.png`
    * Installed Voyager: `composer require tcg/voyager`
    * Configured .env-file with url: `APP_URL=http://voyager.test:8000`
    
    Added Voyager Service Provider: `https://voyager.readme.io/docs/adding-the-service-provider` On file: `config\app.php`
    
    ```
        'providers' => [
    
            /*
             * Laravel Framework Service Providers...
             */
    				 // ...
    
            /*
             * Package Service Providers...
             */
            Laravel\Tinker\TinkerServiceProvider::class,
            // Voyager Package Service Provider
            TCG\Voyager\VoyagerServiceProvider::class,
    				
    				/*
             * Application Service Providers...
             */
    				 // ...
    
        ],
    ```
    
    Installed Voyager Dummy: `php artisan voyager:install --with-dummy`
    		
    Installed this Dropbox Package: `https://github.com/benjamincrozat/laravel-dropbox-driver`
    		
    Added Service Provider for this Package On file: `config\app.php`:
    
    ```
        'providers' => [
    
            /*
             * Laravel Framework Service Providers...
             */
    				 // ...
    
            /*
             * Package Service Providers...
             */
            Laravel\Tinker\TinkerServiceProvider::class,
            // Voyager Package Service Provider
            TCG\Voyager\VoyagerServiceProvider::class,
            // Dropbox Package Service Provider
            BC\Laravel\DropboxDriver\ServiceProvider::class,
    				
    				/*
             * Application Service Providers...
             */
    				 // ...
    
        ],
    ```
    
    Added Filesystem for the Dropbox Package On file `config\filesystems.php`:
    
    ```
    		'disks' => [
    
            'local' => [
                'driver' => 'local',
                'root' => storage_path('app'),
            ],
    
            'public' => [
                'driver' => 'local',
                'root' => storage_path('app/public'),
                'url' => env('APP_URL').'/storage',
                'visibility' => 'public',
            ],
    
            's3' => [
                'driver' => 's3',
                'key' => env('AWS_KEY'),
                'secret' => env('AWS_SECRET'),
                'region' => env('AWS_REGION'),
                'bucket' => env('AWS_BUCKET'),
            ],
    
            'dropbox' => [
                'driver' => 'dropbox',
                'token' => env('DROPBOX_TOKEN'),
            ],
    
        ],
    ```
    
    Created a New Dropbox App. Generated a Key, and added to `.env` file:
    
    ```
    		DROPBOX_TOKEN=<token_string_here>
    ```
    
    Changed Voyager `Storage Config` on file `config\voyager.php`:
    
    ```
    		/*
        |--------------------------------------------------------------------------
        | Storage Config
        |--------------------------------------------------------------------------
        |
        | Here you can specify attributes related to your application file system
        |
        */
    
        'storage' => [
            // 'disk' => 'public',
            'disk' => 'dropbox',
        ],
    ```
    
    Now here is what I get:
    * Laravel Welcome Page is working fine: `http://voyager.test:8000` (This is on Homestead Localhost)
    * If I access admin-page: `http://voyager.test:8000/admin` I get this error: `https://screenshots.firefoxusercontent.com/images/62e3dd99-56a4-420a-a3ee-284ff196d229.png`
    
    FlysystemAdapter.php line 336 still has the same code:
    
    ```
        /**
         * Get the URL for the file at the given path.
         *
         * @param  string  $path
         * @return string
         */
        public function url($path)
        {
            $adapter = $this->driver->getAdapter();
    
            if (method_exists($adapter, 'getUrl')) {
                return $adapter->getUrl($path);
            } elseif ($adapter instanceof AwsS3Adapter) {
                return $this->getAwsUrl($adapter, $path);
            } elseif ($adapter instanceof LocalAdapter) {
                return $this->getLocalUrl($path);
            } else {
                throw new RuntimeException('This driver does not support retrieving URLs.');
            }
        }
    ```
    
    So I am guessing I will need some form of DropboxAdapter?
    
    Not sure where to go from here...
    

    Hello,

    Thank you for checking this out. Sorry for not getting back to you sooner.

    Apologies, I did not know Voyager did not support Laravel 5.5. Reading the Installation Instructions, it says:

    If you are installing with Laravel 5.4 you will need to Add the Service Provider manually. Otherwise, if you are on 5.5 this happens automatically thanks to package auto-discovery.

    So I guessed there was no Problem with Laravel 5.5.

    In any case, I created another Fresh Laravel Installation. I tried to pull Laravel 5.4, but ended up with 5.4.36 not 5.4.28. Not sure now if this would too be a problem. If yes, then I'll try to figgure something out to get the exact 5.4.28 version.

    So what I have done:

    • I am working on Homestead. I just refreshed the Virtual Machine
      • Vagrant V 2.0.1
      • Virtualbox 5.2.2
      • Vagrant box laravel/homestead 5.0.1
      • Homestead 2.0
    • Installed Fresh Laravel Package: screenshot: https://screenshots.firefoxusercontent.com/images/9b3c088a-0bb4-4f4e-b042-a65c56e86bb0.png
    • Installed Voyager: composer require tcg/voyager
    • Configured .env-file with url: APP_URL=http://voyager.test:8000

    Added Voyager Service Provider: https://voyager.readme.io/docs/adding-the-service-provider On file: config\app.php

        'providers' => [
    
            /*
             * Laravel Framework Service Providers...
             */
    				 // ...
    
            /*
             * Package Service Providers...
             */
            Laravel\Tinker\TinkerServiceProvider::class,
            // Voyager Package Service Provider
            TCG\Voyager\VoyagerServiceProvider::class,
    				
    				/*
             * Application Service Providers...
             */
    				 // ...
    
        ],
    

    Installed Voyager Dummy: php artisan voyager:install --with-dummy

    Installed this Dropbox Package: https://github.com/benjamincrozat/laravel-dropbox-driver

    Added Service Provider for this Package On file: config\app.php:

        'providers' => [
    
            /*
             * Laravel Framework Service Providers...
             */
    				 // ...
    
            /*
             * Package Service Providers...
             */
            Laravel\Tinker\TinkerServiceProvider::class,
            // Voyager Package Service Provider
            TCG\Voyager\VoyagerServiceProvider::class,
            // Dropbox Package Service Provider
            BC\Laravel\DropboxDriver\ServiceProvider::class,
    				
    				/*
             * Application Service Providers...
             */
    				 // ...
    
        ],
    

    Added Filesystem for the Dropbox Package On file config\filesystems.php:

    		'disks' => [
    
            'local' => [
                'driver' => 'local',
                'root' => storage_path('app'),
            ],
    
            'public' => [
                'driver' => 'local',
                'root' => storage_path('app/public'),
                'url' => env('APP_URL').'/storage',
                'visibility' => 'public',
            ],
    
            's3' => [
                'driver' => 's3',
                'key' => env('AWS_KEY'),
                'secret' => env('AWS_SECRET'),
                'region' => env('AWS_REGION'),
                'bucket' => env('AWS_BUCKET'),
            ],
    
            'dropbox' => [
                'driver' => 'dropbox',
                'token' => env('DROPBOX_TOKEN'),
            ],
    
        ],
    

    Created a New Dropbox App. Generated a Key, and added to .env file:

    		DROPBOX_TOKEN=<token_string_here>
    

    Changed Voyager Storage Config on file config\voyager.php:

    		/*
        |--------------------------------------------------------------------------
        | Storage Config
        |--------------------------------------------------------------------------
        |
        | Here you can specify attributes related to your application file system
        |
        */
    
        'storage' => [
            // 'disk' => 'public',
            'disk' => 'dropbox',
        ],
    

    Now here is what I get:

    • Laravel Welcome Page is working fine: http://voyager.test:8000 (This is on Homestead Localhost)
    • If I access admin-page: http://voyager.test:8000/admin I get this error: https://screenshots.firefoxusercontent.com/images/62e3dd99-56a4-420a-a3ee-284ff196d229.png

    FlysystemAdapter.php line 336 still has the same code:

        /**
         * Get the URL for the file at the given path.
         *
         * @param  string  $path
         * @return string
         */
        public function url($path)
        {
            $adapter = $this->driver->getAdapter();
    
            if (method_exists($adapter, 'getUrl')) {
                return $adapter->getUrl($path);
            } elseif ($adapter instanceof AwsS3Adapter) {
                return $this->getAwsUrl($adapter, $path);
            } elseif ($adapter instanceof LocalAdapter) {
                return $this->getLocalUrl($path);
            } else {
                throw new RuntimeException('This driver does not support retrieving URLs.');
            }
        }
    

    So I am guessing I will need some form of DropboxAdapter?

    Not sure where to go from here...

  • cbmagent-agent 1 year ago
    I am not firmiliar with laravel myself, but what it seems to me is 5.4.X doesn't have any of the needed service providers, whereas 5.5 has them built in, so I don't think its going to matter which 5.4.X version you have. Is it possible to upgrade to 5.5 without breaking the rest of your site functinality? So far, this seems to be laravels weakness, upgrading to keep current seems like a nightmare mixed with a migrane. but I am new, maybe I am not seeing the light of it all, but I can only guess this is why authors of laravel scripts tend to go away from their projects, because the next update requires so much rewrites. 
    
    I sure wish the author of this script was still active and activley releasing updates. I fear when he finally does I will have my script so hacked up to do what I need it, the updates will not matter. lol
    
    Anyways, at this point I suggest you ask Mark, he seems to be the last pillar holding this project up, and for that we thank him. 
    
    

    I am not firmiliar with laravel myself, but what it seems to me is 5.4.X doesn't have any of the needed service providers, whereas 5.5 has them built in, so I don't think its going to matter which 5.4.X version you have. Is it possible to upgrade to 5.5 without breaking the rest of your site functinality? So far, this seems to be laravels weakness, upgrading to keep current seems like a nightmare mixed with a migrane. but I am new, maybe I am not seeing the light of it all, but I can only guess this is why authors of laravel scripts tend to go away from their projects, because the next update requires so much rewrites.

    I sure wish the author of this script was still active and activley releasing updates. I fear when he finally does I will have my script so hacked up to do what I need it, the updates will not matter. lol

    Anyways, at this point I suggest you ask Mark, he seems to be the last pillar holding this project up, and for that we thank him.

  • xm-arks 1 year ago
    Well I am not sure of that. A couple of projects I have I could just upgrade to 5.5 right away. I believe any simple project where you do not have anything *fancy*, like a simple Informative Website, you probably do not need to do much or anything at all to upgrade to 5.5.
    
    Packages of course are another matter and they fall entirely out of my current abilities.
    
    In any case, what I am currently trying to achieve, either for fun, or to offer as a service to a non-profit, is the ability to connect a Laravel-driven Application or Website to Dropbox, to offer a *Free Filesystem Storage*. Since I am using [Heroku](https://www.heroku.com/home) as a Free Hosting Provider, and Heroku does not support a [Persistent File Storage](https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem).
    
    I have already managed this on a *Fresh Laravel Installation* where I have built an Admin Panel from scratch (tho I admit it still has quite some work to be done), but I was hoping I could manage to find a solution to achieve this as well with Voyager, since there are so many functionalities available out of the box.

    Well I am not sure of that. A couple of projects I have I could just upgrade to 5.5 right away. I believe any simple project where you do not have anything fancy, like a simple Informative Website, you probably do not need to do much or anything at all to upgrade to 5.5.

    Packages of course are another matter and they fall entirely out of my current abilities.

    In any case, what I am currently trying to achieve, either for fun, or to offer as a service to a non-profit, is the ability to connect a Laravel-driven Application or Website to Dropbox, to offer a Free Filesystem Storage. Since I am using Heroku as a Free Hosting Provider, and Heroku does not support a Persistent File Storage.

    I have already managed this on a Fresh Laravel Installation where I have built an Admin Panel from scratch (tho I admit it still has quite some work to be done), but I was hoping I could manage to find a solution to achieve this as well with Voyager, since there are so many functionalities available out of the box.

Please login or signup to leave a response.

Login

or Sign Up

Sign Up

or Login
×
tnylea
Cheers Friend!

I'm Tony, the creator of this site. I'm trying to increase my twitter following. Want to follow me?

Follow @tnylea If not, no worries :)