laravel collection to array with/without keys

Collections to array on laravel is a easy to solve problem. An Laravel array to collection convert on Controller is a few ways. You can use toArray() of eloquent as below.  laravel collection to array without keys The toArray method converts the collection into a plain PHP array. If the collection’s values are Eloquent models, the models will also… Continue reading laravel collection to array with/without keys

Run Laravel on Cloud Virtual Server(VPS) / Compare

Run your own Laravel Application Project on virtual cloud Servers with comparing the resources and prices. DigitalOcean.com (Monthly from 5 USD) Pro: One-Click Installation – Laravel as Application to automatically installation. Contra: Vultr.com (Monthly 5 USD) Contra: No Support for automatically Installation on Ubuntu. AWS Amazon Web Services Google Cloud

add a new column to existing table in a migration

To create a migration, you may use the migrate:make command on the Artisan CLI. Use a specific name to avoid clashing with existing models. You then need to use the Schema::table() method (as you’re accessing an existing table, not creating a new one). And you can add a column like this: and don’t forget to add the… Continue reading add a new column to existing table in a migration

Laravel create model, controller and migration in single artisan command

For Laravel 5.6 and older: -m, –migration Create a new migration file for the model.-c, –controller Create a new controller for the model.-r, –resource Indicates if the generated controller should be a resource controller and for Laravel 5.7 and newer: -a, –all Generate a migration, factory, and resource controller for the model or you can… Continue reading Laravel create model, controller and migration in single artisan command