How to rollback last vendor publish in laravel - php

Hi have messed up my project by doing vendor publish here is the command last time i have executed (i'm using LARAVEL 5.4)
php artisan vendor:publish --tag=laravel-notifications
i want to rollback to previous state which was there before this command
what i was trying to do: i wanted to customize reset password email template
Problem: No longer i'm able to see my customized forgot password template and reset password template. but default template is appearing for both(forgot password and reset password).
Question : please help to get my previous state prior to running this command php artisan vendor:publish --tag=laravel-notifications
please help me thanks in advance!!!!
please help me thanks in advance!!!!

Got it working... The steps to remove a package from Laravel are:
Remove declaration from composer.json (in "require" section)
Remove Service Provider from "app/config/app.php" (reference in "providers" array)
Remove any Class Aliases from "app/config/app.php"
Remove any references to the package from your code.
Run "composer update vendor/package-name". This will remove the package folder from "vendor" folder and will rebuild composer autoloading map
it will remove the package folder from "Vendor" folder

I'm on a similar situation, but with Laravel 5.5
I think that the rollback in this situations does not exist.
When you execute this command:
php artisan vendor:publish --tag=laravel-notifications
a folder vendor/notifications is created under the views folder.
I have delete the notifications folder, and executed the command:
php artisan view:clear
and everything is working fine.
I know that this is an old question, but maybe someone find this useful

Try this: git clean -f -d
-d: for directory;
-f: for force;
This solved for me.

Related

Class 'App\Providers\AppServiceProvider' not found

I have changed my application by using command
php artisan app:name [app_name].
Then, when I try to perform other actions using following artisan commands,
php artisan down
php artisan up
php artisan config:cache
I got the following error:
PHP Fatal error: Class 'App\Providers\AppServiceProvider' not found
How can I solve it?
It is working after Clearing bootstrap/cache directory.
This is how its worked out for me in the case of a fresh install.
First, I cleared the files in boostrap\cache.
Then, in config\app.php, I added the below line in the providers,
\Laravel\Telescope\TelescopeServiceProvider::class,
Then I ran the below commands
php artisan telescope:install
php artisan migrate
And it was working after this.
I don't know for what reason the telescope provider didn't work which was added by Laravel itself. i.e App\Providers\TelescopeServiceProvider::class.
By the way my laravel version was 7.12.0.
In my case, some extension of the VSCode, added a use Illuminate\Support\Facades\App; at the beginning of the file /config/app.php.
I solved it by removing the line from the file and running composer install.
You might have deleted the folder called providers
App/providers.
I had a question like yours then I solved it by copying app/providers directory from another Laravel project to my project thus it worked
I had the same issue, I solved it by,
migrate migration file - vendor>laravel>telescope>database>- manually.
check app.php file, if App\Providers\TelescopeServiceProvider::class, exist or not, have to exist
Run in command shell>
npm run dev

Auth resources are missing in laravel

I want to make use of auth system which comes with the laravel package but the problem is when I make new laravel package using composer i.e composer create-project laravel/laravel project name --prefer-dist
it do not install those auth resources which includes (i.e. auth folder inside resources > views) and also I can't find the Services Folder inside app directory.
All other things are working fine except this authentication system.
What can be the possible problems? Please give me solution
I am working with MAMP.
Taylor Otwell has made it opt-in for Laravel 5.1
You need to run following command after installation
php artisan scaffold:auth
UPDATE
I think this has been answered here
You could also run the command php artisan make:auth in the root directory of you laravel project. I had the same problem and it worked for me.
The command php artisan scaffold:auth didn't work for me i don't know why.
it issued the error:
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "auth" is not defined.
Did you mean this?
make:auth
in Laravel 5.2 you just have to run this command "php artisan make:auth" and the auth folder will be created
Since laravel 6.* version make:auth is no longer supported, use ui:auth instead.
For deploying ui pack run
composer require laravel/ui --dev
then update composer.json :
composer update -W
and do the:
php artisan ui:auth
You need execute
php artisan make:auth
now if your style css and js are missing
You need load file .css and .js
1) execute in your project
npm install
2) then execute
npm run dev => now in folder /public now exist folder js and css
3) reload page

Laravel - Artisan not working

I'm aware of the other questions out there, but they are different to my situation.
I installed a fresh copy of my own laravel, and I tried running php artisan list, which works.
Now, I have a colleague who has installed a copy of laravel himself, and he pushes his entire directory onto a git repository. I pulled the entire branch off the repository, and tried running php artisan list, but nothing happens this time. I mean, literally, nothing happens.
Any ideas as to why this is happening?
Generally speaking, the vendor directory is not committed to VCS, as such, doing a clone on a standard Laravel app won't include all its dependencies.
Once you have cloned, doing composer install (or composer update if you want the latest packages as a developer) will fetch the dependencies and allow your app to work.
You need to run composer install, so the composer refresh all dependencies, artisan's begin on the middle. That should do the job!
My artisan was not working because i had the following lines in my routes.php
if(!isset($_SESSION['c_id'])) {
header("Location: /login_page.php");
exit();
}
I simply commented the exit(). So my code becomes as follows
if(!isset($_SESSION['c_id'])) {
header("Location: /login_page.php");
// exit();
}
Just to point out some thing to anyone struggling with artisan, as this answer is 1st link in google to artisan CLI empty line:
It will print blank line whenever some error happens, even if you have all dependencies installed with composer install. And it won't tell you exactly what is wrong. I couldn't figure it out until I put into artisan file in the root directory this:
ini_set('display_errors',1);
error_reporting(-1);
That forced artisan CLI to show error message and therefore I was able to fix it (my .env file was broken).
Hope this helps someone.
Environment file is not usually pushed to repo.
Make sure you'd also put ".env" file at root path.
In my case problem was to connect artisan with database (migrates) i.e. the command
$php artisan migrate
was not working.
I was running laravel project on 8888 port.
In this case I updated .env file as:
DB_HOST=localhost to DB_HOST=localhost to DB_HOST=127.0.0.1
and DB_PORT=3306 to DB_PORT=8889
Cleared cache by running artisan command and run the migrates:
php artisan config:clear
php artisan migrate
delete the your php at your system , and install it again
or if you run the app, move project folder at htdocs in
xampp folder and type address in browser , localhost/your project name and your app is run on localhost

Unable to update Laravel 4 with Composer (Update: bug?)

Today, I pulled down the laravel/laravel repository from Github. I then ran php composer.phar install (as I normally would on my system, with a command window in the project directory). However, when I ran php composer.phar update, I received this error:
Everything installed just fine, and Laravel works as it should.
Any ideas what could be causing this issue?
Edit 1
artisan exists in the root of the project, but it throws an exception when I attempt to run php artisan optimize:
Side Note 1
If I try the alternative method (quicker) of installing Laravel (php composer.phar create-project laravel/laravel), I get the following:
Edit 2
Upon installation, I also get the same error, where it claims it cannot find artisan. Therefore, the installation does not fully complete. I believe that it is stopping when it wants to compile classes (or something to that effect), and then write bootstrap/compiled.php. That file doesn't exist.
Here's the snap from the install:
Edit 3
It seems that Composer is looking for artisan in the drive root (C:\). Why is it doing this? Even if I specify -d on the update, it throws the error. (I picked this up from a hunch - simply copied artisan to the root of the drive and it found it - albeit, it obviously did not run...)
Solution Found:
Composer makes calls to php artisan <command> (as per the instruction in composer.json > scripts), but it does not see what directory it is running from (perhaps because it is an external command?).
So, I solved my initial problem by using an absolute path to artisan in composer.json.
Everything is working now. I just wish I knew how to get Composer to know that it is running from C:\LocalServer\lab\laravel, and not just C:\.
As i can see, your artisan file is missing. Can you post the exact steps on how you install it ?
Also, please follow http://laravel.com/docs/installation and http://niallobrien.me/2013/03/installing-and-updating-laravel-4/
I had this problem today too. My laravel folder inside the vendor was deleted after composer update. I ran composer install again and problem resolved.

Laravel 4 Artisan commands

I am having some trouble using Laravel 4's artisan. When running a basic
php artisan key:generate
I get this error:
[InvalidArgumentException] There are no commands defined in the "key" namespace
I've read in a few places and have updated composer with the command:
php composer.phar update
but this returns:
Nothing to install or update
and the problem still stands.
Any help will be very appreciated. Thanks.
Try to update composer itself first
php composer.phar self-update
then update you composer packages
php composer.phar update
Look for the file vendor/laravel/framework/src/Illuminate/Foundation/Console/KeyGenerateCommand.php - this is where the key:command is defined.
Then , look for vendor/laravel/framework/src/Illuminate/Foundation/Providers/KeyGeneratorServiceProvider.php - this is where the command is registered to be used with artisan.
Most likely something is messed up in your installation
Have you generated keys in Laravel 4 yet? The process is somewhat different from L3 in that you do not delete the 'Your key goes here!!!' text from this file.
app/config/app.php
You leave that text there and artisan writes over it.
You may already know this and be facing a different issue.

Categories