laravel-5
Laravel migration (errno: 150 “Foreign key constraint is incorrectly formed”)
Since increments() creates an unsigned integer column, you need to define the foreign key column as unsigned integer too. Default migrations in Laravel 6+ use bigIncrements(), so you need to use unsignedBigInteger() method: $table->unsignedBigInteger(‘order_id’); https://laravel.com/docs/6.x/migrations#foreign-key-constraints For default migrations in older versions of Laravel use unsignedInteger() method: $table->unsignedInteger(‘order_id’); Or: $table->integer(‘order_id’)->unsigned(); https://laravel.com/docs/5.5/migrations#foreign-key-constraints
Laravel Carbon, retrieve today’s date with weekday?
I’m not sure that Carbon has such formatting, but what you could do is get the wekkday from a map of days and the current week day constant: $weekMap = [ 0 => ‘SU’, 1 => ‘MO’, 2 => ‘TU’, 3 => ‘WE’, 4 => ‘TH’, 5 => ‘FR’, 6 => ‘SA’, ]; $dayOfTheWeek = … Read more
Class ‘Illuminate\Html\HtmlServiceProvider’ not found Laravel 5
First add this line to composer.json “illuminate/html”: “~5.0” Then do a composer update Wait for the update to finish, then open config/app.php add this: ‘Illuminate\Html\HtmlServiceProvider’, to the providers array and this: ‘Form’ => ‘Illuminate\Html\FormFacade’, ‘Html’ => ‘Illuminate\Html\HtmlFacade’, to the aliases array, and be sure when you use Html in blade or wherever use it in … Read more