Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel delete relationship data

class User extends Eloquent
{
    public function photos()
    {
        return $this->has_many('Photo');
    }

    // this is a recommended way to declare event handlers
    public static function boot() {
        parent::boot();

        static::deleting(function($user) { // before delete() method call this
             $user->photos()->delete();
             // do the rest of the cleanup...
        });
    }
}
Comment

laravel relationship delete all

$transferOrder->dates()->delete();
Comment

PREVIOUS NEXT
Code Example
Php :: file upload in laravel 
Php :: How do i multiple variables in php 
Php :: php get country code from country name 
Php :: laravel check if collection has value 
Php :: laravel get namespace 
Php :: epoch to date php 
Php :: how to get the size of an uploaded file in laravel 
Php :: ::latest() 
Php :: php input radio 
Php :: laravel import xml to database 
Php :: laravel merge two arrays helper 
Php :: compact laravel 
Php :: php and ajax on select option 
Php :: how to loop by index in php 
Php :: carbon date time laravel 
Php :: Invalid credentials. symfony 
Php :: add character after x characters in php 
Php :: referencing constant in config laravel 
Php :: yii2 migration --fields foreign 
Php :: sha256 php cantidad caracteres 
Php :: cmd run php file 
Php :: php public folder 
Php :: woocommerce function traduccion label 
Php :: Form::select laravel 
Php :: get 1 data from get laravel 
Php :: filament make resource 
Php :: get last name user 
Php :: Calculate Math Expression From A String Text With PHP 
Php :: eloquent multiple orwhere 
Php :: + php quantifer 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =