I'm doing the following tutorial with uses the Slim
PHP micro framework:
https://www.cloudways.com/blog/using-eloquent-orm-with-slim/
where I have the following model
:
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class User extends Model{
protected $table = 'users';
protected $fillable = ['name','email','password'];
}
?>
On that tutorial they say we need to run the following SQL
query to create the corresponding table:
CREATE TABLE `users` (
`id` int(11) NOT NULL,
`name` varchar(250) NOT NULL,
`email` varchar(250) NOT NULL,
`password` varchar(250) NOT NULL,
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`updated_at` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
The point is that in my opinion, we should be able to skip that last step since all the necessary information is on the model
.
For example, on Laravel
you can achieve this by running the following command:
php artisan migrate
Any idea how to do that?
Thanks!