Untitled
unknown
plain_text
2 years ago
2.8 kB
8
Indexable
if (!empty($old_background_img)) { $deleted_library = $this->library->remove_library_usage( 'stage_location', $stage_location->id, 'photo' ); if ($deleted_library['return'] != true) { return API::response()->array([ 'success' => false, 'output' => $deleted_library, 'extra' => [ 'message' => 'There was an error deleteing old media reference. Please try again.' ] ])->statusCode(401); } $stage_location_category = \EventType::find($stage_location->type_id); if (isset($library_id)) { /** * Update library usage */ $usage = LibraryUsage::where('type', 'stage_location')->where('type_id', $stage_location->id)->update([ 'library_id' => $library_id ]); } else { /** * Store media to library */ $library_item = $this->library->store_media( $create_event_user_id, $stage_location->name, $stage_location->description, 'stage_location', 'photo', $stage_location->background_image, $stage_location->background_image, '', '', $stage_location_category->name ); /** * Store media to library usage */ if ($library_item['return'] !== true) { return API::response()->array([ 'success' => false, 'extra' => [ 'message' => 'Error while creating library item!' ] ])->statusCode(400); } $library_usage = $this->library->add_media_to_usage( $library_item['output'], 'stage_location', $stage_location->id ); if ($library_usage['return'] !== true) { return API::response()->array([ 'return' => false, 'extra' => [ 'message' => 'Error while creating library usage!' ] ])->statusCode(400); } } }
Editor is loading...