• 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

Display a success custom notice after Placing an Order in WooCommerce

How to convert binary string to normal string in php

How to check user Permissions using Custom Middleware in Laravel

Is there an equivalent of DynamoDB on Azure as a PHP session Handler

(Laravel) How to delete multiple models including optional relationships?

Install mysql client in docker image

Add and update products to session cart in Laravel

Handling expired token in Laravel

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

phpmyadmin : Depends: php-twig (>= 2.9) but 2.6.2-2 is to be installed. WHAT?

Form Validation and Submission to database

How to map the two arrays with a duplicate value?

Attempt to read property "view" on null when sending password reset email

Converting array to string and then back in PHP

Show rotation of tweets using current day of month

About Contact Privacy policy Terms and conditions