За последние 24 часа нас посетили 22504 программиста и 1141 робот. Сейчас ищут 685 программистов ...

Как исправить vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 237 and e

Тема в разделе "Laravel", создана пользователем boss1, 19 фев 2021.

  1. boss1

    boss1 Новичок

    С нами с:
    18 фев 2021
    Сообщения:
    70
    Симпатии:
    0
    php artisan migrate


    [Symfony\Component\Debug\Exception\FatalThrowableError]
    Type error: Too few arguments to function Illuminate\Database\Schema\Builder::hasColumn(), 1 passed in A
    :\on\OpenServer\domains\localhost\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on
    line 237 and exactly 2 expected
    Мне понятно что нужно 2 аргумента , но где именно сделать?
    --- Добавлено ---
    PHP:
    1. <?php
    2. use Illuminate\Support\Facades\Schema;
    3. use Illuminate\Database\Schema\Blueprint;
    4. use Illuminate\Database\Migrations\Migration;
    5. class CreateUsersTable extends Migration
    6. {
    7.     /**
    8.      * Run the migrations.
    9.      *
    10.      * @return void
    11.      */
    12.     public function up()
    13.     {
    14.         Schema::create('users', function (Blueprint $table) {
    15.             $table->increments('id');
    16.             $table->string('name');
    17.             $table->string('email')->unique();
    18.             $table->string('password');
    19.             $table->rememberToken();
    20.             $table->timestamps();
    21.         });
    22.     }
    23.     /**
    24.      * Reverse the migrations.
    25.      *
    26.      * @return void
    27.      */
    28.     public function down()
    29.     {
    30.         Schema::dropIfExists('users');
    31.     }
    32. }
    33. <?php
    34. use Illuminate\Support\Facades\Schema;
    35. use Illuminate\Database\Schema\Blueprint;
    36. use Illuminate\Database\Migrations\Migration;
    37. class CreatePasswordResetsTable extends Migration
    38. {
    39.     /**
    40.      * Run the migrations.
    41.      *
    42.      * @return void
    43.      */
    44.     public function up()
    45.     {
    46.         Schema::create('password_resets', function (Blueprint $table) {
    47.             $table->string('email')->index();
    48.             $table->string('token')->index();
    49.             $table->timestamp('created_at')->nullable();
    50.         });
    51.     }
    52.     /**
    53.      * Reverse the migrations.
    54.      *
    55.      * @return void
    56.      */
    57.     public function down()
    58.     {
    59.         Schema::dropIfExists('password_resets');
    60.     }
    61. }
    62. <?php
    63. use Illuminate\Support\Facades\Schema;
    64. use Illuminate\Database\Schema\Blueprint;
    65. use Illuminate\Database\Migrations\Migration;
    66. class CreateArticlesTable extends Migration
    67. {
    68.     /**
    69.      * Run the migrations.
    70.      *
    71.      * @return void
    72.      */
    73.     public function up()
    74.     {
    75.         Schema::create('articles', function (Blueprint $table) {
    76.             //$table->engine = 'InnoDB';
    77.             $table->increments('id');///  id INT AUTO_INCREMENT PRIMARY KEY
    78.             $table->string('name',100);//Varchar 100
    79.             $table->text('text');//text
    80.             $table->string('img',255);//Varchar 100
    81.             $table->timestamps();//
    82.         });
    83.     }
    84.     /**
    85.      * Reverse the migrations.
    86.      *
    87.      * @return void
    88.      */
    89.     public function down()
    90.     {
    91.         Schema::dropIfExists('articles');
    92.     }
    93. }
    94. <?php
    95. use Illuminate\Database\Schema\Blueprint;
    96. use Illuminate\Database\Migrations\Migration;
    97. class ChangeArticlesTable extends Migration
    98. {
    99.     /**
    100.      * Run the migrations.
    101.      *
    102.      * @return void
    103.      */
    104.     public function up()
    105.     {
    106.         if(Schema::hasTable('articles')) {
    107.             Schema::table('articles', function (Blueprint $table) {
    108. //        $table->string('alias',100);
    109.                 //
    110.                 if(!Schema::hasColumn('alias')) {
    111.                     $table->string('alias',100)->default('default');
    112.                 }
    113.             });
    114.         }
    115.     }
    116.     /**
    117.      * Reverse the migrations.
    118.      *
    119.      * @return void
    120.      */
    121.     public function down()
    122.     {
    123.         Schema::table('articles', function (Blueprint $table) {
    124.             //
    125.             $table->dropColumn('alias');
    126.         });
    127.     }
    128. }
    129. <?php
    130. use Illuminate\Support\Facades\Schema;
    131. use Illuminate\Database\Schema\Blueprint;
    132. use Illuminate\Database\Migrations\Migration;
    133. class ChangeArticlesTable2 extends Migration
    134. {
    135.     /**
    136.      * Run the migrations.
    137.      *
    138.      * @return void
    139.      */
    140.     public function up()
    141.     {
    142.         Schema::table('articles', function (Blueprint $table) {
    143.             //
    144.             $table->string('alias')->default('alias')->change();
    145.         });
    146.     }
    147.     /**
    148.      * Reverse the migrations.
    149.      *
    150.      * @return void
    151.      */
    152.     public function down()
    153.     {
    154.         Schema::table('articles', function (Blueprint $table) {
    155.             //
    156.         });
    157.     }
    158. }
     
  2. ADSoft

    ADSoft Старожил

    С нами с:
    12 мар 2007
    Сообщения:
    3.823
    Симпатии:
    736
    Адрес:
    Татарстан
    а вообще это нормально все файлы миграции впихать в один?
    --- Добавлено ---
    скорее всего это не нравится


    синтаксис такой - таблица, поле
    PHP:
    1. if (Schema::hasColumn('users', 'email')) {
    2.     //
    3. }
     
  3. boss1

    boss1 Новичок

    С нами с:
    18 фев 2021
    Сообщения:
    70
    Симпатии:
    0
    Уже не имеет значения. Я нашел ошибку
     
  4. boss1

    boss1 Новичок

    С нами с:
    18 фев 2021
    Сообщения:
    70
    Симпатии:
    0
    Жаль нет кнопки закрыть тему или удалить
     
  5. TeslaFeo

    TeslaFeo Старожил

    С нами с:
    9 мар 2016
    Сообщения:
    2.989
    Симпатии:
    759
    Конечно не имеет. Вообще более опытных товарищей не стоит слушать. Они ничего не понимают. У них всего-то много лет опыта реальной разработки. Ты ж БОСС!
     
  6. boss1

    boss1 Новичок

    С нами с:
    18 фев 2021
    Сообщения:
    70
    Симпатии:
    0
    Босс - это ник. Я понимаю что ты и другие лучше меня в программировании. Я учусь
     
  7. boss1

    boss1 Новичок

    С нами с:
    18 фев 2021
    Сообщения:
    70
    Симпатии:
    0
    Tesla - это такой ученый. Судя по нику ты ученый?
     
  8. TeslaFeo

    TeslaFeo Старожил

    С нами с:
    9 мар 2016
    Сообщения:
    2.989
    Симпатии:
    759
    Учись на здоровье.
    --- Добавлено ---
    Да
     
  9. boss1

    boss1 Новичок

    С нами с:
    18 фев 2021
    Сообщения:
    70
    Симпатии:
    0
    Что ты там изобрел. Какую технику?
     
  10. TeslaFeo

    TeslaFeo Старожил

    С нами с:
    9 мар 2016
    Сообщения:
    2.989
    Симпатии:
    759
    Пару базонов открыл. И так по мелочи..