After trying all of this possibility, still, have this error message:
SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'categories'
(SQL: alter table `users` add constraint `users_category_id_foreign` foreign key
(`category_id`) references `categories` (`id`) on delete cascade)
The code of relation in users migration:
$table->unsignedBigInteger('category_id');
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
The image of the table:
Help :(