PHP: Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/projects/targetspanish.com/storage/logs/laravel.log" Denied in / var / www / projects /targetspanish.com/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107 Migration file: 0

use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreatePZostsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('p_zosts', function (Blueprint $table) { $table->increments('id'); $table->string('title')->nullabble(); $table->string('slug')->unique(); $table->text('exerpt')->nullabble(); $table->text('content')->nullabble(); $table->timestamps('published_at')->nullabble(); $table->boolean('published')->default(false); //$table->rememberToken(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('p_zosts'); } } 
  • one
    Everything is obvious, check the rights to the storage / logs folder give them write permissions - Orange_shadow
  • Thanks, now it gives an error that the table has already been created .... (((([PDOException] SQLSTATE [42S01]: Base table or view already exists: 1050 Table 'users' already exists - Alexander

1 answer 1

1) The first error occurred due to access to the storage / logs file.

2) You have created a table users but with an error, go to the database and kill it.

It works like this: an attempt is made to create a table; if the table is created successfully, it is written to the table of migrations. The next time you call migrate, the migrations table checks whether the migrations were called, if there are migrations that are not in the table, they are performed.

But if you had an error, and the table was created, but did not get into the migrations table. Hence the conflict.

advice for the future:

php artisan migrate:rollback - rolls back one migration (according to a non-number in the migrations table, if with one number several tables rolls back everything, starts from the largest number)

php artisan migrate:refresh - refreshes all tables (blows down and creates a new one)

php artisan make:model -m City - create a model and migration for it

  • range_shadow, thanks !!!! decided from the very beginning ..... killed the user table and created a new model with the command: php artisan make: model -m City after writing: php artisan migrate gave the error: [Symfony \ Component \ Debug \ Exception \ FatalThrowableError] Call to a member function nullabble () on null then using the migration rollback (php artisan migrate: rollback), used the command: php artisan migrate: refresh but the result is the same error: Call to ... the users table is created and the password_resets table has been created, which was not previously used it was, but the City table was not created ... - Alexander
  • @ Alexander, well, so you write carefully :) nullabble is written with one b :) and the second table is for recovering passwords - Orange_shadow
  • This is NOT a claim to me !!!!! I copied the error from the PHPStorm console and it appeared here like this: [Symfony \ Component \ Debug \ Exception \ FatalThrowableError] Call for a member .php there everywhere aBle without double explosives - Alexander
  • @ Alexander, this is your mistake in migrations somewhere. in some file you wrote nullabble - Orange_shadow