is laravel 5.4 running migrations from vendor folders now? - laravel

I have installed some packages that have migrations in their vendor folders, previously one of the packages I used published these migrations to migrations folder by running:
php artisan vendor:publish
Now I found alteast 2 packages that no longer published migrations when running this command, so I went into vendor folder and grabbed migration file and manually moved it and when I run
composer dump-autoload I got a warrning message from it that said: Warning:
Ambiguous class resolution, "CreateRevisionsTable" was found in both "$baseDir . '/database/migrations/2013_04_09_062329_create_revisions_table.php" and "C:\xampp\htdocs\example\vendor/venturecraft/revisionable/src/migrations\2013_04_09_062329_create_revisions_table.php", the first will be used.
why is this happening? Has something changed in 5.4?

Yes, since version 5.4 Laravel supports loading migrations from any directory.
$this->loadMigrationsFrom(__DIR__.'/path/to/migrations');
Which could be used by a service provider of any package.

Related

Error happens when I install livewire in laravel

the error is
#php artisan vendor:publish --tag=laravel-assets --ansi --force No
publishable resources for tag [laravel-assets].
This is not an error With the laravel.
With the relase of Laravel v8.5.23 they have added a command to post-update-cmd inside composer.json. So when ever if you run a composer update. Laravel will publishes the latest assests of the package that is created by them such as horizon and telescope.
So when they make changes in assests in above packages and tagged a release. You can use it by running the composer update command. But the changes made to vue files and styling will not be changed. You need to run the publish command manually. So to fix that they have added tags to those packages and whenever you run a composer update command it will automatically publishes the assets which are tagged as aravel-assets.
The reason you are getting No publishable resources for tag [laravel-assets]. message is either you haven't installed any of the package that uses the tag laravel-assets or may be not update in the assets.
You can view the PR's here
laravel/laravel/pull/5654
laravel/horizon/pull/1045
laravel/telescope/pull/1105

Is there a way to fix missing files of laravel 5.6

Some guy made a site with laravel 5.6 and we at a different place need to change just some tags and the CSS, I have a git of the site but "vendor, .env" and many files that are also missing in the git, how can I open the site in my computer to adjust the style sheets I have no database backup and also installed laravel 5.6 and try to paste de missing files but there are still many errors.
Altough the original programmers excluded some files in the git repo using the ignoregit file I created a new laravel 5.6 project and copied the missing files to my original app folder, imported the missing packages using composer and finally used artisan to migrate the database using "php artisan migrate"

Publish all contents of a Laravel package

I installed a Laravel package via composer and require some of the non-published controllers of it to be published (to be safely modified by me and still being able to run composer install without overwriting custom code). However, I wouldn't find any appropriate answers on Google.
Basically, php artisan vendor:publish publishes some of the files of the package but not all. Is there a way to modify what files vendor:publish publishes? As stated, I'll need some controllers of the vendor folder to be published.
You can pass in the package's provider class and tags for what you want to publish
php artisan vendor:publish --provider="Namespace\ProviderClass" --tag="config|lang"
Try this out
php artisan vendor:publish --all

How to delete laravel built-in two migration files?

I am using laravel 5.2. I want to delete two laravel built-in migration files 2014_10_12_000000_create_users_table.php and 2014_10_12_100000_create_password_resets_table.php. But PhpStorm told me that there are two usages in other files' code. So if I delete them, I first delete two files' usages, and then delete two files, is that right?
First of all, check in your migrations table if the file is migrated. If its migrated you can use: php artisan migrate:rollback.
You can delete the files, after that you can run: composer dump-autoload, this will recreate all the files generated by composer.
Hope this works!
If you've already ran migrate command, run php artisan rollback. Then delete these two files and run composer dumpauto

Laravel 4 class not found after doployment to production

Error:
Class 'App\Package\PackageServiceProvider' not found
After moving my laravel directories to my server. The app is under psr-0.
The same files are found and working locally without any errors.
I tried to update composer with and without dump but nothing changes.
Why does that happen?
By default, the vendor directory is not checked into your git repository. So, just run composer install on your server and it should take care of the rest.

Resources