• 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 lang slug in url

PHP 8.1: strftime() is deprecated

Adding custom body class to the custom archive pages

Elasticsearch - Want to sort by field in all indices where that particular field available or not if not then avoid it

Converting IPv6 to IPv4 address in PHP

Wordpress how to get the post thumbnail inside a figure tag

Show rotation of tweets using current day of month

Issue saving card for customer

Use same method for inertia response and json response Laravel Jetstream

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

How to Create WooCommerce Subscription Product via. REST API?

How to properly set "0000-00-00 00:00:00" as a DateTime in PHP

Server-sent events in PHP (without echo or print)

Send same name multiple checkbox values via ajax

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

About Contact Privacy policy Terms and conditions