Thanks it works now. Should I do that every time I start using laravel to make the migration works?
-
Also, what is the point of remembering token?
$table->rememberToken();
-
I also get this error message when trying to use varchar in my migration:
C:\xampp\htdocs\shopee_lvl\framework>php artisan migrate
Migration table created successfully.
BadMethodCallException : Method Illuminate\Database\Schema\Blueprint::varchar does not exist.
at C:\xampp\htdocs\shopee_lvl\framework\vendor\laravel\framework\src\Illuminate\Support\Traits\Macroable.php:99
95| */
96| public function __call($method, $parameters)
97| {
98| if (! static::hasMacro($method)) {
99| throw new BadMethodCallException(sprintf(
100| 'Method %s::%s does not exist.', static::class, $method
101| ));
102| }
103|
Exception trace:
1 Illuminate\Database\Schema\Blueprint::__call("varchar")
C:\xampp\htdocs\shopee_lvl\framework\database\migrations\2014_1012000000_create_users_table.php:19
2 CreateUsersTable::{closure}(Object(Illuminate\Database\Schema\Blueprint))
C:\xampp\htdocs\shopee_lvl\framework\vendor\laravel\framework\src\Illuminate\Database\Schema\Builder.php:164
Please use the argument -v to see more details.
C:\xampp\htdocs\shopee_lvl\framework>
CreateUsersTable.php
public function up()
{
Schema::create('users2', function (Blueprint $table) {
$table->increments('id');
$table->string('email')->unique();
$table->varchar('username', 20);
$table->varchar('password', 50);
$table->biginteger('no_ktp', 30);
$table->varchar('foto_ktp', 30);
$table->varchar('foto_profile', 30);
$table->rememberToken();
$table->timestamps();
});
}