Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to locate publishable resources #664

Closed
ekandreas opened this issue Feb 13, 2020 · 12 comments
Closed

Unable to locate publishable resources #664

ekandreas opened this issue Feb 13, 2020 · 12 comments
Assignees
Labels

Comments

@ekandreas
Copy link

The command php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="migrations" just gives us:
Unable to locate publishable resources
We have all the models in a "Models" folder. Can it be the case here?

@Gummibeer
Copy link
Collaborator

Hey,
could it be that you already have a class named CreateActivityLogTable? The models aren't important for the publish step.

if (! class_exists('CreateActivityLogTable')) {
$timestamp = date('Y_m_d_His', time());
$this->publishes([
__DIR__.'/../migrations/create_activity_log_table.php.stub' => database_path("/migrations/{$timestamp}_create_activity_log_table.php"),
], 'migrations');
}

@Gummibeer Gummibeer self-assigned this Feb 13, 2020
@ekandreas
Copy link
Author

Ohh, my. So sorry! Thanks!

@datlechin
Copy link

same issue

class ActivitylogServiceProvider extends PackageServiceProvider
{
    public function configurePackage(Package $package): void
    {
        $package
        ->name('laravel-activitylog')
        ->hasConfigFile('activitylog')
        ->hasMigrations([
            'CreateActivityLogTable',
            'AddEventColumnToActivityLogTable',
            'AddBatchUuidColumnToActivityLogTable',
        ])
        ->hasCommand(CleanActivitylogCommand::class);
    }

    public function registeringPackage()
    {
        $this->app->bind(ActivityLogger::class);

        $this->app->singleton(LogBatch::class);

        $this->app->singleton(CauserResolver::class);

        $this->app->singleton(ActivityLogStatus::class);
    }

    public static function determineActivityModel(): string
    {
        $activityModel = config('activitylog.activity_model') ?? ActivityModel::class;

        if (! is_a($activityModel, Activity::class, true)
            || ! is_a($activityModel, Model::class, true)) {
            throw InvalidConfiguration::modelIsNotValid($activityModel);
        }

        return $activityModel;
    }

    public static function getActivityModelInstance(): ActivityContract
    {
        $activityModelClassName = self::determineActivityModel();

        return new $activityModelClassName();
    }
}

@alinmiron
Copy link

Hi,
Had the same issue when I ran
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-config"

I got rid of it by running:
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"

@Gummibeer
Copy link
Collaborator

@alinmiron please check your local installed and the referenced documentation version.
I expect that you've installed v3 but checked v4 documentation (default).

@alinmiron
Copy link

alinmiron commented May 18, 2021

all i did was to run:

composer require spatie/laravel-activitylog

and I got this, in composer.json: "spatie/laravel-activitylog": "^3.17",

`
composer require spatie/laravel-activitylog

Using version ^3.17 for spatie/laravel-activitylog
./composer.json has been updated
Running composer update spatie/laravel-activitylog
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals

  • Locking spatie/laravel-activitylog (3.17.0)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 1 install, 0 updates, 0 removals
  • Downloading spatie/laravel-activitylog (3.17.0)
  • Installing spatie/laravel-activitylog (3.17.0): Extracting archive
    Generating optimized autoload files

`

I have laravel version 8.42.0
I use PHP 7.4.x and just saw on the 4.0.0 release this: Drop PHP 7.x support.

Thanks @Gummibeer

@warifp
Copy link

warifp commented May 20, 2021

Hi,
Had the same issue when I ran
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-config"

I got rid of it by running:
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"

Thank!

@hoangphidev
Copy link

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"

Thanks

@warifp
Copy link

warifp commented Oct 1, 2021

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"

Thank!

@samuelvs
Copy link

Hi, the same problem is avaiable in https://github.com/spatie/laravel-health

@bfuzze
Copy link

bfuzze commented Feb 8, 2023

For future readers: The above did not work for me. I am trying to upgrade an old site currently on L6. This issue is the --provider option strips slashes from the value, and so it does not match the registered providers list. Running without the provider option works, although this may not be a good work-around depending on your situation.

@sueboy19
Copy link

Hi everybody

php: 8.2.8
laravel: v10.37.3
spatie/laravel-activitylog: 4.7.3

I try --tag="migrations" --tag="config" is faild

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"
 INFO  No publishable resources for tag [migrations].
 INFO  No publishable resources for tag [config].

Now try is correct, because README.md content like under

php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-migrations"
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="activitylog-config"
   INFO  Publishing [activitylog-migrations] assets.

_table.php]  DONE
  Copying file [C:\WinNMP\WWW\acc_hr\vendor\spatie\laravel-activitylog\database\migrations\add_event_column_to_activity_log_table.php.stub] to [C:\WinNMP\WWW\acc_hr\database\migrations\2023_12_20_141207_add_event_column_to_activity_log_table.php]  DONE
  Copying file [C:\WinNMP\WWW\acc_hr\vendor\spatie\laravel-activitylog\database\migrations\add_batch_uuid_column_to_activity_log_table.php.stub] to [C:\WinNMP\WWW\acc_hr\database\migrations\2023_12_20_141208_add_batch_uuid_column_to_activity_log_table.php]  DONE

Copying file [C:\WinNMP\WWW\acc_hr\vendor\spatie\laravel-activitylog\config\activitylog.php] to [C:\WinNMP\WWW\acc_hr\config\activitylog.php]  DONE

Just confused ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants