• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Laravel: Create morphs() relationship nullable

phplaravelrelationship


PHP Snippet 1:

Schema::create('ps_assistances', function (Blueprint $table) {
    $table->bigIncrements('id');
    $table->string('assistance_number', 50)->nullable();
    $table->nullableMorphs('assitanceable');
});

PHP Snippet 2:

$table->nullableMorphs('assitanceable');

Related Snippets

Laravel 5.2: Unable to locate factory with name [default]

Querying only one row from a one to many relationship laravel

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

Respond with status code 401 on authentication failure using Laravel and Passport?

PHPExcel_IOFactory::createWriter causes wrong behaviour

Phalcon: setStatusCode returns empty response

Merge column values from two arrays to form an indexed array of associative arrays

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

How to Install Composer Require doctrine/dbal

JSON Render Issue in Date Object Laravel and PHP 7.4

Pass a select with mysqli_fetch_row to a table

How to reset Laravel AuthManager/guards in between API calls in tests?

OctoberCMS / Anonymous Global Scope

Render the content of default_filter.php in Joomla front-end

500 Internal Server Error on Ajax request. Not sure the origin of the problem

About Contact Privacy policy Terms and conditions