Migrations in Laravel are not been placed in 'database\migrations' folder - php

I'm making a migration in laravel like this:
php artisan make:migration create_tasks_table
and then I get a message from the console like this:
Created Migration: 2017_04_03_002411_create_tasks_table
But when I go to the 'database\migrations' directory there's no .php file related to the migration I made.
Why is this happening?

It could be that your IDE is not updating the filesystem. What i would suggest is to use the terminal to navigate to the migrations directory and list the content of the directory to see if its truely empty.

Related

Laravel artisan make:component outside resources folder

When you run php artisan make:component Foo it will always be created inside (root)/resources/views/component.
How can I specify its "parent directory" or any specific directory outside resources folder?
I mean, like creating it at (root)/custom-package/components.
Is there any existing options does make:component command has? or I'm thinking few ways how to achieve this:
Create a custom command that will create the php and blade files to the directory I want.
Create a new command and extend the Laravel's make:component command to modify its path. (Currently, I can't find yet the Class where I can extend it.)
Or is there a config where I can set it?
maybe you can use:
php artisan make:component Foo --path=your/custom/location
hope this help

Change Model namespace on project creation

the way I use laravel is with composer create-project command, in all my projects after ding this I have to make a few changes like changing Model namespace from App folder to App/Models folder in a few places of the codebase, this to me makes more sense. My question is , is there a way I can do these changes automatically so I don't have to make the changes manually each new project?
Maybe creating an artisan command? or creating the php files from scratch or using stubs?
php artisan make:model Models/Task this will do the right thing, if you do not want to repeat this all the time maybe you can have .bashrc alias rather than a new artisan command.
function pamodel () {
php artisan make:model Model/"$*"
}
pamodel Test will do.

Created a project in laravel but I can't access a welcome page

I installed Laravel (in W10/Wamp3.3/PHP5.6) using Composer and created a new project with the following command:
laravel new my_project
Project doesn't have a welcome page, opens file-list directly. So I decided to try my chance on creating a new controller and create a route.
php artisan make:controller Hello
And my route in routes/web
Route::get('/hello', 'HelloController#index');
I also cleared the route cache:
php artisan route:clear
Created the controller with no methods. myproject/hello shows nothing.
What am I missing? File permissions or wamp based problem?
There's a question related with this but it's more like a server problem.
Few causes for this that I've run into. Most likely one is going to be the server pointing to the incorrect directory. What I would do to test is run php artisan serve from the root of the project. This will open up a server pointing to public directory. If this functions correctly then you have confirmation.

Issue with key (cipher error) when changing laravel folder structure

I am changing laravel 5.3 folder structure. What I exactly do is basically move all the content from public folder to root folder, and then all the other files besides public folder to the new created folder - project. Then I update the require paths in index.php, and when I try to run the project via XAMPP, I'm getting this error.
I am pretty sure that the key is set correctly, because I haven't changed anything else but the folder structure and paths, and the project worked before this folder structure change. It seems to me that program can't locate the .env file.
Try running
php artisan config:clear
and
php artisan key:generate
I followed this post

Create model in a custom path in laravel

I want to create a model in a custom path. If i write the php artisan command like the following it will create model inside app.
php artisan make:model core
But i want to create the model file inside the custom made Models folder. How can i do it ?
Just define the path where you want to create model.
php artisan make:model <directory_name>/<model_name>
e.g.
php artisan make:model Models/core
You can do it easily with custom directory of your Models Folder (I assume Models Folder is sub folder of App).
Just use this command php artisan make:model Models/core then you will get your desire result.
Thanks.

Categories