Skip to content

Instantly share code, notes, and snippets.

@andreyuhai
Last active January 9, 2019 09:18
Show Gist options
  • Save andreyuhai/a06cf5b0076d428669d8fd38a03d0716 to your computer and use it in GitHub Desktop.
Save andreyuhai/a06cf5b0076d428669d8fd38a03d0716 to your computer and use it in GitHub Desktop.
How to create a controller and model with php artisan

How to create a controller and model with php artisan

To create a controller with php artisan just type

php artisan make:controller YourController

If you want to create your controller with resources ( index, update, edit, store...) then

php artisan make:controller YourController --resource

Then to make a mode for that controller or any other controller you want

php artisan make:model Your_Model_Name_Singular -m

You usually want to create models with a name in singular. Post, Article ...

Link your storage to public/storage

php artisan storage:link

This way you can use file uploads and etc...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment