I can't generate migration file with make:migration command in Laravel - php

This happened to me a couple of months ago. It might have happened in the process of a composer update, but I'm far from sure on that one. I've even updated my project to Laravel 5.3 and it still I can not get make:migration to work through Artisan. No the project it updated to 5.4 and it still do not work.
I've checked out this thread and I have the exact same problem. The symptoms were exactly the same, however the OPs solutions did not work for me.
I get no error or result in the terminal when running make:migrate.
I can generate any other file through Artisan it seems.
I tried to create a new model and pass the -m along with it. Didn't work.
I've checked permissions (and even changed migration folder), but didn't
help.
If I create my own migration-file the rest of the process through artisan works fine (migrate, DB-manipulation etc).
I've tried with different terminals and computers.
Since project were upgraded and even reinstalled I fear it has
nothing to do with the deep kernal. However maybe some sort of conflict from the higher level.
And in the last phase of my quest I tried to figure out what user interacting elements that can possibly effect the make:migration. Nothing worked.
I searched the web without any solution, then I gave up on that project and started to make my own migration files. However I now got some new hope when I saw that other thread.

After some troubleshooting I finaly managed to figure out the problem.
I narrowed it down to have something to do with the config/app.php-file.
Seems I in this project had typed in:
'timezone' => 'UTC+2'
This made creation of migration-files come to a halt without error messages. And it effected only the creation of migration-files (at least what I noticed).
I changed it to 'UTC' and it worked liked a charm again.
Note: the 'UTC+2' worked in the application and I never saw any other indications of errors regarding the rest of the app.php-file, or in the application in general.
Solution: When I instead used the parameters from this site it all worked perfectly again.

Related

Quick Admin Panel | Unable to locate a class or view for component (only when live)

I am trying to get a Laravel 8 project up and running on Hostinger's shared hosting. I realize I'm already complicating things but have successfully set things up besides the components. I am using Povilas' Quick Admin Panel (Livewire ver), and it's this that requires components that are only 'missing' when on production server. Everything runs smoothly on localhost.
I've read that this may be caused by namespace issues - the environment may have case sensitivity (if so, how can I work around?). Other posts explained how each component should be visible in Http\View\Components as well as in resources\views\components. I've also read something on the existence of default/packaged components but can not find documentation on these individual ones.
I am looking for components 'x-application-logo', 'x-dropdown', 'x-dropdown-link', 'x-responsive-nav-link', and more. I do not see ANY of these in my local files, yet it all works fine in a local environment.
Yes, I've seen very many similar questions asked. However, in all of those cases, the askers were able to visually locate their component files, or were using self-declared components...
Has anyone working with Quick Admin Panel had similar issues?
I've attempted:
php artisan cache:clear, config:clear, view:clear,
php artisan optimize,
composer dump-autoload,
recompiling with npm then reuploading files,
composer install (and composer2 install)
I ended up installing a fresh instance of Jetstream to copy over its source files. After a few tweaks I got something to work without errors... As I've come to find out, the entire admin panel that I was working with had wiped itself, and for some reason started requiring an instance of Jetstream?? I have no recollection of touching any sort of configuration regarding this, so either there's a carbon monoxide leak in my home, or Hostinger is deciding to automatically mess with my Laravel files for one reason or another. Thankfully I have a proper local version of my project, which I will use to reattempt.

Laravel 7 404 Error with Route with more than 2 Levels

I'm facing a wired issue with Laravel where routes with multiple parameters (both mandatory/optional) aren't working.
Environment Information
Local: Windows, XAMPP, PHP 7.3
Production: Ubuntu 18.04, PHP 7.4
Initially, I suspected issue with .htaccess file but that seems not to be an issue.
This works perfectly on my Local, but for some reason, that doesn't work on Ubuntu Server.
The following code works perfectly.
Route::any('route/me/','Tst#routeme');
However, any of the following doesn't work:
Route::any('route/me/here/','Tst#routeme');
Route::any('route/me/here/{id?}','Tst#routeme');
Route::any('route/me/here/and/here','Tst#routeme');
Any suggestions where I can look up to fix this out, please?
My first suggestion would be to place the route with most params at the top like:
Route::any('route/me/here/and/here','Tst#routeme');
Route::any('route/me/here/{id?}','Tst#routeme');
Route::any('route/me/here/','Tst#routeme');
It's more like which ever route matches first gets executed first so from top to bottom the least param route matches last.
Second thing i would suggest you to group the routes like:
Route::prefix('route/me')->group(function () {
Route::get('here/and/here', 'Tst#routeme');
Route::get('here/{id?}', 'Tst#routeme');
Route::get('here', 'Tst#routeme');
});
for better readability...
I can't give you specifics on why this particular scenario is happening but, matching your development and production environments should elimate these problems in future.
Homestead Docs
The Homestead vagrant box provided by the Laravel team is a solid choice and well documented. It is an Ubuntu 18.04 / 20.04 machine and can be configured with many add-ons. You can easily configure which version of PHP any given project is using with a single line in the Homestead.yaml file.
Docker Docs
Docker is a little more advanced but very flexible in how it can be configured. It's container design allows you to isolate the dependencies of one project from the next.
These aren't that difficult to setup (easily done within a day or two) and allow you to replicate your production environments almost perfectly.
It will help massively in those "but it works on my machine" moments!
updating my own question so that might be of some help for others.
I would say probably this is the last thing that someone (or at least me) failed to check. I tried to list the routes in my server and found my newly added route was not found.
php artisan route:list
Earlier, I cleared cache, restarted apache but didn't help. Finally found the following commands to be a lifesaver when routes are cache & aren't working.
So the thing that worked for me - clearing the "route" cache.
php artisan route:cache
php artisan route:clear
My hearty thanks to #Spholt,#Akbar khan, #Spholt, #Gzai Kun for helping out.

Syntax error: unexpected '->' (T_OBJECT_OPERATOR)

There is a project in a bitbucket repository where I am developing with 3 more other people. We have the development branch where we close versions and it is the main branch of the project. The thing is that in my computer all files pulled from that branch works fine and I can navigate trough all pages without getting any exception. On the other hand the other 3 people are getting this error in some pages:
Like I said, in my computer this page and some other ones work fine so my guess is that's most likely an error in a file that has .gitignore or individual computer file.
Already tried:
running composer update, composer dump-autoload, php artisan optimize;
clearing cache;
searching into real syntax error in controller (didn't find anything. If there really was this syntax error i'd be getting it too because files are pulled from git);
deleting logic inside controllers to check if it was syntax error (didn't find anything again);
replacing their vendor folder with my vendor folder;
cloning the project again in their machines
These exceptions occur mainly in namespaces after /admin/editar_paginas/vantagens
We are using AdminLTE package, not sure if there is something related with it.
Honestly I have no ideia what's going on. How can it work specifically in my computer and on theirs not? Let me know if it's not clear enough.
yesterday i got stuck on a similar situation where i was not getting what the error was all about, so what i did was i deleted the controller,model ,request and migration and recreated it all it removed the error. it worked for me and if there is not much data in the database you could give it a try, laravel does produce such errors from time to time.
It was really PHP version. They had PHP 5.6 in their machines. Upgrading it to ^7.0 solved the issue.

Laravel database appearing as not configured?

So I decided to setup an Openshift server with Laravel. I ran into some complications and posted this question
How to configure Laravel 5.2 on Openshift?
I go back to it and realized I messed up a lot of stuff setting it up and really the problem was within the .env file. Now it seems like everything else is working except for my databases.
What I have been doing to test Laravel on Openshift is using the make:auth command, so I can test migrations and stuff like that. However, I do feel like I have setup database configurations properly, because when I ran migrations through the cli everything was setup properly (users and password_resets table showed up in the mysql database) no errors through there. Now when I try to register a user using the register page I get this error:
I've tried editing the database.php file, .env configurations, google, but I just can't find a fix. Maybe the solution is staring me in the eyes, but I'm blinder than a bat. Any help would be very much appreciated. I can provide any information needed.
You should set and check environment variables for database on web console.
Or you can follow the lucho2d7/openshift-quickstart-laravel5.2.

bootstrap.php.cache is missing

I have a problem with Symfony 2. trying the example from the book. I have written a controller but when i go to the URL specified in the route i get an error. The server can't find the page. When i run app_dev.php i get an error that the file boostrap.php.cache is missing.
searched on the internet but found nothing relevant so far. I don't know if the front-controller is already written or if that is something that still has to be done by me.
I can't get the application to run.
Found the solution. I followed the guidelines installing sf2 in netbeans. Instead of running the application as a local website i used the build-in server option wich gave me access to the cli commands. There i could use the command run server and all of my problems were gone.

Categories