Generating an application key in Laravel 4 - laravel

Has the php artisan key:generate command been removed in Laravel 4?
Running it returns;
[InvalidArgumentException]
There are no commands defined in the "key" namespace.
How should you generate keys now? Or do you need to create one manually?

At the time the question was asked, this feature had not yet been implemented for Laravel. It has now.
This is one of the dangers of asking questions about software that's not yet been released. The answers will change.

Related

Command "october:migrate" is not defined

I must add table to existing octobercms project and added migration but it is not migrating. what may be problem? when I type php artisan october:migrate I faced with this problem
Command "october:migrate" is not defined.
Did you mean one of these?
october:down
october:env
october:fresh
october:install
october:mirror
october:passwd
october:up
october:update
october:util
php artisan october:up will only migrate the database
php artisan october:update will update the application files, plugins and migrate the database.
Check out this thread on the official forum
https://octobercms.com/forum/post/artisan-migrate
I had a similar issue: https://github.com/octobercms/october/issues/5589
It looks like the october:migrate would be available once you updated to the version 2.
It is a paid one.

unserialize(): Error at offset 0 of 40 bytes

This Error comes When i try to server site login.
How to solve this error?
You have to set a news Key, use the following command:
php artisan key:generate
After that test again to run the Laravel Application
php artisan serve
See the similiar question: unserialize(): Error at offset 0 of 40 bytes Error
Laravel made a change to the way it handles cookies from V5.6.30 to improve security. It may be that you are trying to decrypt something that isn't serialized or vice versa.
First, Delete the cookies in your browser and/or clear your session-files in your Laravel app.
Or, within the middleware app\Http\Middleware\EncryptCookies.php, you can flip it to test:
add: protected static $serialize = true;
This is a pretty common question - you can search stack overflow for similar answers if this doesn't work.
Delete the cookies in your browser and/or clear your session-files in your Laravel app.
I got the same error, when I upgrade a Laravel 5.5 app to 5.6. The error comes form the EncryptCookies-Middleware.
This type of issue normally rise when you downgrade your Laravel version and a quick solution is I just clear my laravel and browser cache and it will work fine for me. Browser cache clear is mostly important.

Create artisan commands for package Laravel 5

I am developing a package for Laravel 5, now I need to create some new artisan command for this package. I have read the following articles but still stuck
http://laravel.com/docs/5.0/bus
http://laravel.com/docs/5.0/artisan
Question: What I need to do is grouping some artisan commands of laravel 5 into a single command and then add this new command to my package can anyone help me through the steps I have to take?
I could be writing a huge answer but this video is better then 100 words:
https://www.youtube.com/watch?v=BviKET-QTEQ
Also the link for the docs: http://laravel.com/docs/5.0/commands

In Laravel, what is meant by the term "clear compiled class"

I'm trying to use a service class in Laravel called ide-helper. It provides auto completion into PHPStorm. it is not functioning as expected. I have been advised that I should run php artisan clear-compiled.
what does the term "clear compiled" mean ?
https://github.com/barryvdh/laravel-ide-helper#automatic-phpdoc-generation-for-laravel-facades
Many thanks
Laravel uses an optimized class loader for better performance.
The command php artisan clear-compiled deletes the following 2 files:
bootstrap/compiled.php Created when you optimize classes.
app/storage/meta/services.json This file is created as Laravel tries to optimize the loading of the service providers your application uses.
For more Information on performance optimizing also see http://laravel-recipes.com/recipes/60/optimizing-the-framework-for-better-performance

Laravel Generate not working

I am running Sublime Test 2 in Windows 7 64-bit. I have installed (and re-installed many times) Laravel Generator and Laravel 4 Artisan. I have updated composer and all dependencies. But I cannot get it to work properly. If I press ctrl-shift-P and type 'laravel' I get a list of 11 Artisan options, then a list of 17 Generate options, 6 of which appear to be duplications, and then another list of 20 Artisan options. The first lot of Artisan options give WindowsError: [Error 2] The system cannot find the file specified, the Generate options give [InvalidArgumentException] There are no commands defined in the "generate" namespace.
The second batch of Artisan options do appear to work eg Laravel Artisan: Controller: Make gives a command line and if I type 'test' it creates a restful controller called test.php.
However, the more comprehensive resource generation remains unavailable to me.
Can anyone shed any light?
If you are using the way/generators package, you need to make sure to include the service provider ('Way\Generators\GeneratorsServiceProvider') in your config.app file.
First make sure you install this plugin first: https://github.com/laravelbook/laravel4-sublimetext-helper
And then you might want to do what is referred here:
http://net.tutsplus.com/tutorials/tools-and-tips/pro-workflow-in-laravel-and-sublime-text/#comment-925470112
There are other Windows users that had difficulties with this, but seem to have resolved them.

Resources