Laravel 4: php artisan down not defined - laravel

I've updated my Laravel installation with the following commands today (which is a few days after Laravel 4's release date):
php composer self-update
php composer update
You can have a look at my composer.json file here: http://paste.laravel.com/umX
In the Docs I've found out about the Maintenance Mode... (http://laravel.com/docs/configuration#maintenance-mode) Trying to use it returns:
[InvalidArgumentException]
Command "down" is not defined.
Command I've entered in the terminal for this exception:
php artisan down
My current version:
php artisan --version
Laravel Framework version 4.0.0
Any ideas? Did i miss something, am I still on some old version possibly?
Thanks in advance and best regards, Martin.

The fix for me was to update the 'providers' array in ./app/config/app.php. I thought I was doing a pretty good job of manually updating the L4 skeleton near the end of the beta period, but there was a minor change in that array (not sure which line) that allowed the 'down' command to finally appear in artisan.

The first thing I suggest you do is just run php artisan list to get a list of all the available commands. If the up and down commands aren't listed then you probably aren't fully updated.
If you have a bootstrap/compiled.php file try deleting it. Also make sure you pull the latest changes in from the laravel/laravel GitHub repository to update your application skeleton.
Once you've done the above you can again check for the existence of the commands by running php artisan list.

In app/start/global.php (or app/start/artisan.php), you need:
App::down(function() { return Response::make("Be right back!", 503); });
don't you?
Perhaps you could also try updating laravel via composer "composer update" in CLI.

I've just installed a clean Laravel 4 clone and tryed the maintenance mode with it.
Everything's working as supposed...
I've also compared the composer.json files + I'm pretty sure I've done nothing wrong updating to the stable release version even thought my app/start/* php-files remain unchanged.
Summary:
Composer seems to not override the php files in app/start/* which would be needed in order to get the maintenance mode working correctly. Probably there are even more files not being updated. This also makes a lot of sense, since you could have done some important customizations to your application there.
Correct me if I'm wrong... I'll start importing my package into a clean install thought. Don't want to run into more trouble due to this.
Best Regards, Martin.

Related

Error when changing PHP version on Heroku app

As some of you might know, PHP version ≥7.2 has an issue regarding count: count(): parameter must be an array or an object that implements Countable and this does contributes to a lot of problems.
I'm using the PHP framework Laravel 5.3 on Heroku, which until the change of PHP version worked perfectly fine. So why don't I just change the PHP version? Well, according to the docs I'm supposed to just change the version in my composer.json, run composer update and everything will be fine but no - I'm getting this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ^5.6.4 but your PHP version (7.2.1) does not satisfy that requirement.
Anyone knowing anything that can contribute solving my problem?
You also need to push composer.lock.
Change the version in your local and make $ composer update.
Make sure you have changed composer.lock.
Push both files on Heroku.
From the documentation, https://devcenter.heroku.com/articles/php-support#php-runtimes
Next, ensure that your new requirements are “frozen” to composer.lock
by running:
$ composer update
Finally, don’t forget to git add and git commit both files!
Hope this helps.

Compiled Services Class Has been removed Composer error laravel 5.4

Dears whenever i want to add any Packeg using composer i face below error
"Compiled Services Class Has been removed"
I search many solution like "composer update" etc but still i face this problem
due to this error my working is stop.
kindly help me whats the original solution.
thats the composer installation problem? or what ?
The message The compiled services file has been removed. is a info message from the clear compiled command: php artisan clear-compiled.
It is called from php artisan optimize that runs on every composer update or install.
The message is only a info reporting that the file bootstrap/cache/services.php has been removed.
The services.php file will be reconstructed at the next request.
So at the end its a normal info message.
I have encountered the same problem.
Just remove the "Vendor" folder then install the composer. It worked fine for me.

artisan not working in laravel 5.2 returning [ErrorException]

I'm getting problem when trying to execute php artisan "command". Does not matter the command.
For example, executing the command:
php artisan make:controller TestController
I have got the following result
[ErrorException]
Undefined variable: ths
What I have tried to do?
I have tried to update/install composer
composer update
composer install
composer dump-autoload
It's causing me a lot of problem for example I can't execute my migration in another words I can't take the next steps.
Would be great if someone has some idea how to fix that.
Thank's a lot
This error means that somewhere you have a class with $ths variable and it's not related to commands. I think you wrote some code and used $ths instead of $this. Check all last changes (custom commands, facades, service providers etc). Just fix it and commands will work again.
If you can't find $ths in your code, check Laravel error logs for extra info.
I suggest finding this in your code. If you use Sublime Text press:
The keyboard shortcut is Ctrl⇧+F on non-Mac (regular) keyboards, and ⌘⇧+F on a Mac.
And put $this on this variable instead of $ths

Laravel: array_merge(): Argument #2 is not an array error

Exceptions started to appear in all views, and when I try to run composer update, it always ends up with
{"error":{"type":"ErrorException","message":"array_merge(): Argument #2 is not an array","file":"\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php","line":188}}
After a lot of searching and exploring each file in the 'app' folder, it appears that one file was corrupt
Delete app/storage/meta/services.json and re-run composer update and this should solve it.
Sometimes only deleting app/storage/meta/services.json and run composer update doesn't solve the ERROR: array_merge(): Argument #2 is not an array error. At least in my case, it didn't.
Most of the time it happens when you're screwing up the bootstrap/cache/services.json file. And running composer update will not generate services.json file.
To generate the services.json file, you need to delete the previous bootstrap/cache/services.json file and run php artisan serve. Then it'll generate a fresh services.json` file.
Hope it helps to someone!
I had similar problem with a fresh install.
I solved it like this:
Removed bootsrap/cache/**services.php** and then i
surfed to the website with browser, it generated a new services.php and then it worked.
delete bootstrap folder
git reset --hard
composer install
done
Just a composer update worked for me.
You probably just forgot to put compact('var') as the second return view argument
return view("path.to.view", compact ('var'))
I was facing this issue, and my problem was the version of "pusher/pusher-php-server" in composer.json was not matching with my laravel version. For this reason composer-update and deleting caches were not working for me.
I thought maybe this information could help someone.
I got the same error - "array_merge(): Argument #2 is not an array error". running "composer dump-autoload" followed by npm run dev solved the problem immediately. No need of updating composer, npm etc.
in my case app/storage/meta/services.json was empty for some reasson
I deleted the bootstrap/cache/services.json and ran composer update after that it worked for me

Laravel: Can't install Sentry

I tried to install Sentry 2 with composer. I used the composer manuel from the sentry site,
but i got always a serviceprovider exception:
"Class 'Cartalyst\Sentry\SentryServiceProvider' not found"
Is there an another way or i did something wrong?
If you look closely on the [Sentry website installer instructions for laravel 4],
step one states that you need to add "cartalyst/sentry": "2.0.*" to your composer.json,
but it also specifically states that it requires you to run php composer.phar update from the command line
Note that you should run php composer.phar update BEFORE you add the entries for the app/config/app.php (before proceeding to steps 2 and above)
#Todd Isaacs's answer would also lead you to the required result but you do not need to go back to the beggining, all you have to do is revert the changes on your app/config/app.php file and run the update.
hope that helps.
I found the solution. SSL is necessary for composer update and now all works fine.
So I checked the php ini and set ssl on.
I just got this same error and being totally new at Laravel I decided to step back, here is what I did to resolve it.
removed the entries I added to my composer.json and app.php (I think app.php was the issue)
run composer update (yep worked this time)
added "cartalyst/sentry": "2.0.*" to my composer.json
run composer update (sentry was installed)
added 'Cartalyst\Sentry\SentryServiceProvider' and 'Sentry' => 'Cartalyst\Sentry\Facades\Laravel\Sentry' to my app.php
run composer update (still works)
When I originally installed Sentry I added the 'Cartalyst\Sentry\SentryServiceProvider' to the app.php before running the update and I think this was the issue. ( install instructions )
For Sentry 3, change the service provider in app/config/app.php to:
'Cartalyst\Sentry\Laravel\SentryServiceProvider',

Resources