Commit 1950ee45 authored by Antoine Le Gonidec's avatar Antoine Le Gonidec

Fix hiding parents from archives when shown from a script

parent 37d98e14
...@@ -28,14 +28,14 @@ class Script extends Model { ...@@ -28,14 +28,14 @@ class Script extends Model {
} }
/** /**
* Hide archives $script and $archive attributes when shown from a script * Hide some archives attributes when shown from a script
* *
* @return \Illuminate\Database\Eloquent\Collection * @return \Illuminate\Database\Eloquent\Collection
*/ */
public function getArchivesAttribute() { public function getArchivesAttribute() {
$archives = $this->archives()->get(); $archives = $this->archives()->get();
$archives->each(function ($archive) { $archives->each(function ($archive) {
$archive->makeHidden([ 'archive', 'scripts', 'group' ]); $archive->makeHidden([ 'parents', 'scripts', 'group' ]);
$archive->required = (bool) $archive->pivot->required; $archive->required = (bool) $archive->pivot->required;
$archive->group = (int) $archive->pivot->group; $archive->group = (int) $archive->pivot->group;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment