Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
10 / 10
CRAP
100.00% covered (success)
100.00%
1 / 1
IsReadOnly
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
10 / 10
10
100.00% covered (success)
100.00%
1 / 1
 readOnly
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 save
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 saveMany
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 create
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 createMany
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toggle
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 syncWithoutDetaching
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 sync
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 attach
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 detach
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace Baril\Bonsai\Relations\Concerns;
4
5use Illuminate\Database\Eloquent\Model;
6use LogicException;
7
8trait IsReadOnly
9{
10    /**
11     * @throws \LogicException
12     */
13    protected function readOnly()
14    {
15        throw new LogicException("The $this->relationName relation is read-only!");
16    }
17
18    public function save(Model $model, array $pivotAttributes = [], $touch = true)
19    {
20        $this->readOnly();
21    }
22
23    public function saveMany($models, array $pivotAttributes = [])
24    {
25        $this->readOnly();
26    }
27
28    public function create(array $attributes = [], array $joining = [], $touch = true)
29    {
30        $this->readOnly();
31    }
32
33    public function createMany(iterable $records, array $joinings = [])
34    {
35        $this->readOnly();
36    }
37
38    public function toggle($ids, $touch = true)
39    {
40        $this->readOnly();
41    }
42
43    public function syncWithoutDetaching($ids)
44    {
45        $this->readOnly();
46    }
47
48    public function sync($ids, $detaching = true)
49    {
50        $this->readOnly();
51    }
52
53    public function attach($id, array $attributes = [], $touch = true)
54    {
55        $this->readOnly();
56    }
57
58    public function detach($ids = null, $touch = true)
59    {
60        $this->readOnly();
61    }
62}