migrate Laravel Database using artisan - php

when try to migrate Laravel 4 with table 'user' in database using artisan:
php artisan migrate:make --table="user" CreateUserTable
I receive this error:
C:\xampp\htdocs\laravel>php artisan migrate:make --table=user CreateUserTable
[21.04.2014 02:27:56 NOTICE] Successfully established connection to the database
[21.04.2014 02:27:56 NOTICE] Event Reporting is not allowed at the
moment. Reaso ns: Pre Startup or Post Shutdown
{"error":{"type":"Symfony\Component\HttpKernel\Exception\NotFoundHttpExcepti
on","message":"","file":"C:\xampp\htdocs\laravel\vendor\laravel\framework\
\src\Illuminate\Foundation\Application.php","line":871}}
C:\xampp\htdocs\laravel>
how to solve this?
thanks,

I solved this by install all laravel dependences using composer (not download it from GithHub)

to install all dependencies with composer.
change directory to laravel folder in cmd and than type
composer update
and hit enter and wait until it is done.

Related

Laravel 8 UI issue

I have installed Laravel 8 as a new project. When I run the project I get the "In order to use the Auth::routes() method, please install the laravel/ui package." But Laravel installation doc says that laravel ui is depreciated and that we should use Jetstream. So I installed Jetstream with the Livewire stack. Back to test the project and I get the same error msg.
I have run a composer dump-autoload.
What do I have to do to get a Laravel 8 project to run?
You will need to clear and recreate cache. Run the following php artisan commands:
php artisan cache:clear
php artisan config:cache
php artisan route:cache
I had this problem as well on many 'upgrades' from earlier versions of Laravel. I don't want to change the entire auth mechanism, as it works, so I will keep the code I have.
#Elisha Senoo's answer is correct, and solved it most of the time. However, if you find yourself unable to clear the cache (because it has the same error message on the artisan command), the solution is to manually clear the .php files within the bootstrap/cache folder and then php artisan config:cache.

Can not run Seeding on Laravel

Docker 18.09.2
Mysql 5.7
Laravel 5.7
PHP 7.125
I am new at Laravel and I have a problem When I use php artisan db:seed, this error appeared:
include(/var/www/laravel_app/vendor/composer/../../database/seeds/AdminsTableSeeder.php):
failed to open stream: No such file or directory
at /var/www/laravel_app/vendor/composer/ClassLoader.php:444
440| * Prevents access to $this/self from included files.
441| */
442| function includeFile($file)
443| {
> 444| include $file;
445| }
446|
I have no idea why does it happens.
There was no error when I used php artisan migrate.
I have already tried php artisan migrate --seed and php artisan migrate:refresh --seed.
Can anyone please help me?
You should try using composer dump-autoload.
From this answer in SO:
Basically, because Composer can't see the migration files you are
creating, you are having to run the dump-autoload command which won't
download anything new, but looks for all of the classes it needs to
include again. It just regenerates the list of all classes that need
to be included in the project (autoload_classmap.php), and this is why
your migration is working after you run that command.

Laravel clear package auto-discovery cache of composer packages

I wanted to remove a package from laravel. I did composer remove vendor/package
It was all good on my dev, but when I deploy on production something went wrong and I cannot do anything now.
when I run
php artisan package:discover
I'm geting
In ProviderRepository.php line 208:
Class 'Laracasts\Flash\FlashServiceProvider' not found
I'm guessing I it is something to do with some kind of cache or maby config
but I cannot run this command,
php artisan config:clear
because I'm getting the same error message as above.
PS. I'm using Laravel 5.6
You may need clear the autoloader files if they get jammed up as it is looking at those cached files when php artisan config:clear runs, thus creating the jam.
Remove the following files and they will rebuild:
/bootstrap/cache/packages.php
/bootstrap/cache/services.php
I fixed my problem deleting a config file like so:
$rm bootstrap/cache/config.php
This file is basically a cache for config, if you want to have this file built for you just run a following artisan command:
$php artisan config:cache

Laravel php artisan make:auth no migration table is created

I am following Laravel documentation for creating Authentication system.
My Steps Are
Installing fresh laravel using laravel new my-project
Then enter into directory (cd my-project). Edit the database config file with database credentials.
Then run php artisan make:auth. All migration php files are created.
Run php artisan migrate. CLI responds with nothing to migrate
So I went back to check the database using phpmyadmin. I do not see any migration table.
System & Version info
Vagrant box laravel/homestead
Database mariaDb
Laravel installer v1.3.5, by cli command laravel -v
Laravel v5.4.16, from composer.lock
Can anyone point me to the right direction?
Also, you can try this:
php artisan migrate:install which creates the migrations table only
php artisan migrate runs your other migrations
Configure your database in .env file
DB_HOST=127.0.0.1
DB_DATABASE=DbName //Your DB Name
DB_USERNAME=root
DB_PASSWORD=password123

Workbench package dependency migration

I'm developing a package (under workbench) which depends on another package (https://github.com/efficiently/authority-controller) for user role management. For this package to work, I need to run a migration initially. But however when I run the command php artisan migrate --package=machuga/authority-l4, it says Nothing to migrate.
I tried running php artisan dump-autoload from the root, and also php artisan migrate --bench=machuga/authority-l4 but nothing seems to work.
Try add Authority\AuthorityL4\AuthorityL4ServiceProvider to your providers and run:
php artisan migrate --package=machuga/authority-l4
I think, efficiently/authority-controller depends on machuga/authority, but doesn't call the provider.

Categories