Skip to content

Commit f219090

Browse files
committed
fix: save function
1 parent 867f6e2 commit f219090

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/Model/OneRoster.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
use OpenLRW\OpenLRW;
1717
use OpenLRW\Exception\InternalServerErrorException;
18-
use Symfony\Component\Debug\Exception\UndefinedFunctionException;
1918

2019
abstract class OneRoster extends Model
2120
{
@@ -88,15 +87,25 @@ protected static function all()
8887
return $results;
8988
}
9089

91-
protected static function save($data = null)
90+
/**
91+
* Save a model
92+
*
93+
* @return mixed|null
94+
*/
95+
public function save()
9296
{
93-
if ($data === null) {
94-
$data = static::toJson();
95-
}
97+
$attributes = $this->attributes;
9698
$header = self::generateHeader();
97-
return OpenLRW::httpPost(self::PREFIX . static::$collection, $header, $data);
99+
return OpenLRW::httpPost(self::PREFIX . static::$collection, $this->attributes, $header);
98100
}
99101

102+
/**
103+
* Update a model
104+
*
105+
* @param $id
106+
* @param $data
107+
* @return mixed|null
108+
*/
100109
protected static function update($id, $data)
101110
{
102111
$header = self::generateHeader();

0 commit comments

Comments
 (0)