protected function addStorageSymlinkAlert()
    {
        if (app('router')->current() !== null) {
            $currentRouteAction = app('router')->current()->getAction();
        } else {
            $currentRouteAction = null;
        }
        $routeName = is_array($currentRouteAction) ? Arr::get($currentRouteAction, 'as') : null;

        if ($routeName != 'voyager.dashboard') {
            return;
        }

        $storage_disk = (!empty(config('voyager.storage.disk'))) ? config('voyager.storage.disk') : 'public';

        if (request()->has('fix-missing-storage-symlink')) {
            if (file_exists(public_path('storage'))) {
                if (@readlink(public_path('storage')) == public_path('storage')) {
                    rename(public_path('storage'), 'storage_old');
                }
            }

            if (!file_exists(public_path('storage'))) {
                $this->fixMissingStorageSymlink();
            }
        } elseif ($storage_disk == 'public') {
            if (!file_exists(public_path('storage')) || @readlink(public_path('storage')) == public_path('storage')) {
                $alert = (new Alert('missing-storage-symlink', 'warning'))
                    ->title(__('voyager::error.symlink_missing_title'))
                    ->text(__('voyager::error.symlink_missing_text'))
                    ->button(__('voyager::error.symlink_missing_button'), '?fix-missing-storage-symlink=1');
                VoyagerFacade::addAlert($alert);
            }
        }
    }
protected function addStorageSymlinkAlert()
    {
        if (app('router')->current() !== null) {
            $currentRouteAction = app('router')->current()->getAction();
        } else {
            $currentRouteAction = null;
        }
        $routeName = is_array($currentRouteAction) ? Arr::get($currentRouteAction, 'as') : null;

        if ($routeName != 'voyager.dashboard') {
            return;
        }

        $storage_disk = (!empty(config('voyager.storage.disk'))) ? config('voyager.storage.disk') : 'public';

        if (request()->has('fix-missing-storage-symlink')) {
            if (file_exists(public_path('storage'))) {
                if (@readlink(public_path('storage')) == public_path('storage')) {
                    rename(public_path('storage'), 'storage_old');
                }
            }

            if (!file_exists(public_path('storage'))) {
                $this->fixMissingStorageSymlink();
            }
        } elseif ($storage_disk == 'public') {
            if (!file_exists(public_path('storage')) || @readlink(public_path('storage')) == public_path('storage')) {
                $alert = (new Alert('missing-storage-symlink', 'warning'))
                    ->title(__('voyager::error.symlink_missing_title'))
                    ->text(__('voyager::error.symlink_missing_text'))
                    ->button(__('voyager::error.symlink_missing_button'), '?fix-missing-storage-symlink=1');
                VoyagerFacade::addAlert($alert);
            }
        }
    }
protected function addStorageSymlinkAlert ( ) { if ( app ( 'router' ) -> current ( ) !== null ) { $ currentRouteAction = app ( 'router' ) -> current ( ) -> getAction ( ) ; } else { $ currentRouteAction = null ; } $ routeName = is_array ( $ currentRouteAction ) ? Arr :: get ( $ currentRouteAction , 'as' ) : null ; if ( $ routeName != 'voyager.dashboard' ) { return ; } $ storage_disk = ( ! empty ( config ( 'voyager.storage.disk' ) ) ) ? config ( 'voyager.storage.disk' ) : 'public' ; if ( request ( ) -> has ( 'fix-missing-storage-symlink' ) ) { if ( file_exists ( public_path ( 'storage' ) ) ) { if ( @ readlink ( public_path ( 'storage' ) ) == public_path ( 'storage' ) ) { rename ( public_path ( 'storage' ) , 'storage_old' ) ; } } if ( ! file_exists ( public_path ( 'storage' ) ) ) { $ this -> fixMissingStorageSymlink ( ) ; } } elseif ( $ storage_disk == 'public' ) { if ( ! file_exists ( public_path ( 'storage' ) ) || @ readlink ( public_path ( 'storage' ) ) == public_path ( 'storage' ) ) { $ alert = ( new Alert ( 'missing-storage-symlink' , 'warning' ) ) -> title ( __ ( 'voyager::error.symlink_missing_title' ) ) -> text ( __ ( 'voyager::error.symlink_missing_text' ) ) -> button ( __ ( 'voyager::error.symlink_missing_button' ) , '?fix-missing-storage-symlink=1' ) ; VoyagerFacade :: addAlert ( $ alert ) ; } } }
Add storage symlink alert.
Add storage symlink alert .