PHP code example of liaosp / laravel-relation-save

1. Go to this page and download the library: Download liaosp/laravel-relation-save library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liaosp / laravel-relation-save example snippets


$this->model->save($validate->getData());

$this->model->saveRelation($validate->getData());

   public function store_detail()
    {
        return $this->hasOne(\App\Models\StoreDetail::class, 'store_id', 'id');
    }

 //一些店铺操作
 $this->store->save();
 $this->store_detail->store_id = $this->store->id;
 $this->store_detail->address = $request->get('store_detail')['address'];
 $this->store_detail->save();

$this->model->save($request->all());

$this->model->saveRelation($request->all());

2022年3月27日10:21:21  多对多无限级保存