How to migrate table in october cms? - php

When I migrate the table, the php artisan migrate does not work.

Use composer.
Navigate to the root directory of the project. Run,
php artisan october:up
if you want to roalback you can run
php artisan october:down

Be sure to use composer in the project directory
php artisan migrate:refresh php artisan migrate:rollback php artisan migrate --force are some cmd's you could try. I don't know if this helps you otherwise please explain your question a bit more.

Go to the root directory of your project in command prompt and run these commands
To reset the current migrations if there are some php artisan migrate:reset
then run php artisan migrate

Related

file_put_contents error on existing laravel project

I am trying to configure a new laravel project however I always get the following error no matter what:
file_put_contents(C:\Users\bla...\Documents\GitHub\project\storage\framework/sessions/yB2Ji8maEDu0fXZLpZ5VBnDzIhLdaeA7aYdVMjOf): failed to open stream: No such file or directory
I have tried re installing homestead/laravel/vagrant I have also ran the following and more artisan command again and again:
php artisan config:cache
php artisan cache:clear
php artisan optimize
I have also ran chmod privileges on files/folders inside of my vagrant box but still nothing gets me past this error, any ideas? The project itself is created perfectly fine inside of my vm.
Delete all the files in yourProject/storage/framework/sessions, then run php artisan view:clear and php artisan config:clear

Artisan shell executes too much time. How to fix?

I have 2 laravel apps.
On typing: "time php artisan" in first app, I see:
real 0m0.328s
user 0m0.123s
sys 0m0.057s
And if type the same at my "problem" project, I see:
real 1m15.887s
user 0m0.220s
sys 0m0.085s
I try to:
php artisan cache:clear
php artisan config:clear
php artisan debugbar:clear
php artisan route:clear
php artisan view:clear
composer said, that I have
laravel/framework v5.6.26 The Laravel Framework.
I try to drop "vendor" directory, and to run composer install command
it also doesn't helps. What should i do to fix so long time execution? php v 7.1.4
Few hours ago everything was ok! I was working only with controllers, (no any new artisan commands was made before bug shows)
~75sec for blank artisan coomand execution to show only commands list is too much...
I realy appreciate for any suggestions.

php artisan migrate nothing to migrate error

I am trying to install this package on my server after installing everything when I try to migrate with php artisan migrate it tells me there is nothing to migrate. Also the migration table is not there. here is what I did:
php composer.phar require igaster/laravel_cities
change in providers app.php
Igaster\LaravelCities\GeoServiceProvider::class,
Ran this script
mkdir storage/geo
cd storage/geo
wget http://download.geonames.org/export/dump/allCountries.zip && unzip allCountries.zip && rm allCountries.zip
wget http://download.geonames.org/export/dump/hierarchy.zip && unzip hierarchy.zip && rm hierarchy.zip
Now when I run php artisan migrate it tells me there is nothing to migrate
I am not sure if this is because I have php composer.phar instead of composer?
Try php artisan config:cache then retype php artisan migrate - Hope this helpfull...
Try running:
php artisan vendor:publish --provider="Igaster\LaravelCities\GeoServiceProvider"
And then run the migration
php artisan migrate
php composer.phar is identical to composer so thats not the issue.
If migration file not showing you likely need to run
php artisan vendor:publish
Copy vendor/igaster/laravel_cities/src/migrations folder contents to database\migrations folder, then run php artisan migrate. Sometimes publishing vendor resources doesn't work for me too and I dive into the source of the package then to make them work.

oauth-private.key does not exist or is not readable

So, I imported another project from Bitbucket and tried to launch it using php artisan serve, I always get this error:
[LogicException]
Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" does not
exist or is not readable
I don't get this error when I make a project myself, I can't run any other command. I tried 'php artisan key:generate', and got the exact same error.
I tried: composer update, and got this:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Updating spatie/laravel-permission (1.11.1 => 1.12.0) Downloading: 100%
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
[LogicException]
Key path "file:///var/www/html/DesignViewer5/storage/oauth-private.key" doe
s not exist or is not readable
Script php artisan optimize handling the post-update-cmd event returned with error code 1
Anyone knows how to fix it? Thanks!
I think that this is due to Laravel Passport, you should try the following command:
php artisan passport:install
This command will create the encryption keys needed to generate secure
access tokens. In addition, the command will create "personal access"
and "password grant" clients which will be used to generate access
tokens
Source: https://laravel.com/docs/5.4/passport
I had the same problem when I updated the composer.I generated the keys again using php artisan passport:keys and it solved the problem
I found the solution
Solution:
In config/app.php I had to comment these lines:
/*Laravel\Passport\PassportServiceProvider::class,
App\Providers\CodeGrantProvider::class,
Spatie\Permission\PermissionServiceProvider::class,*/
Than you need to migrate the whole database again,
than uncomment this line:
Laravel\Passport\PassportServiceProvider::class,
And run php artisan passport:install my application keys weren't working so I had to do:
php artisan config:clear
php artisan key:generate
php artisan config:clear
And than I could do php artisan serve
Thanks!
so sample if you already install passpord and don't config run this command
php artisan passport:keys
If already doesnt install the passport package you must check the docs of passpord in Laravel docs
Step 1:
Only Run if oauth-private.key and oauth-public.key not exists in
storage folder otherwise skip first step..
php artisan passport:install
Step 2:
Clear configration and generate key
php artisan config:clear
php artisan key:generate
php artisan config:clear
Step 3:
Change permission and owner like that :
sudo chown www-data:www-data storage/oauth-*.key
sudo chmod 600 storage/oauth-*.key
Since /storage/*.key is in .gitignore so if you pull the project, that might be missing the key by running php artisan passport:keys will generate new keys for you.
Run: php artisan passport:install.
If get message like "Encryption keys already exist. Use the --force option to overwrite them."
Then run
Run: php artisan config:clear
Run: php artisan key:generate.
And finally
Run: php artisan config:clear
I have removed this bit: Passport::loadKeysFrom(__DIR__.'/../secrets/oauth');
from App\Providers\AuthServiceProvider and it fixed the issue.
https://laravel.com/docs/8.x/passport#deploying-passport
/**
* Register any authentication / authorization services.
*
* #return void
*/
public function boot()
{
$this->registerPolicies();
Passport::routes();
Passport::loadKeysFrom(__DIR__.'/../secrets/oauth');
}
if you use heroku as deployment,
try add this in composer.json at the script line
"post-install-cmd": [
"php artisan clear-compiled",
"chmod -R 777 storage",
"php artisan passport:keys"
]
and then run this command
php artisan passport:install
php artisan config:clear
php artisan optimize
do this commands
sudo chown www-data:www-data storage/oauth-*.key
php artisan passport:install
php artisan config:clear
php artisan key:generate
php artisan config:clear
Don't do this line until you have keys in a specific location for the file
in AuthServiceProvider.php
//Passport::loadKeysFrom('/secret-keys/oauth');
for my after i run composer install passport is already installed so php artisan passport:install does not help.
try to touch new file (oauth-private.key) to storage dir, then run command
php artisan passport:keys --force
this command 'll force override private key you touched and create "aouth-public.key" file. it 'll work fine
Depending on the environment you are using to deploy. If, for example, you are using a Heroku deploy, you may have to remove the folder containing the keys from gitignore before pushing and then later add it back. This worked for me after following the steps above.
firstly, search in oath-private-key in your application folder. copy
it and go to App/provider folder. create a new folder , secret and
oauth like that
App/Provider/Secret/Oauth and paste your oath-private-key here.
I hope it helps you.
For Windows OS. If you have already installed passport, or you are setting up an existing application and then facing this problem then try "php artisan passport:keys"

How do I remove old artisan command from Kernel in Laravel 5

I have created some Command files into my Laravel Application. Laravel version is 5.2. I set command like: get:email in the Command file. Also call the Command file into Kernel.php. After that I can see the artisan command list by typing the command php artisan list. as like as below:
//output
get:email
And I changed the command title get:email to get-bq:email. When I run the command php artisan get-bq:email -- its working nicely. Also I can see the list by typing the command php artisan list::
//output
get-bq:email
Issue / Problem: Both commands are working. But I won't to work with both of them. I have done the following things:
modified command file as well as command
run composer dump-autoload -o
run composer update
remove vendor and storage folder then run composer update again.
Still the old command is working into my system.
What I want: How May I remove my old commands from my Laravel(5.2) application?
Run these commands:
php artisan cache:clear
php artisan config:clear
These commands will clear app cache and config cache and recreate it.
I've had the same problem recently.
Repoeatedly tried
php artisan cache:clear
php artisan config:clear
and the cached Kernal command wouldn't clear.
In desperation i killed the queue worker terminal and restarted the queue with the command
php artisan queue:work
The issue stopped.

Categories