src/controllers/ApiController.php
public function settings(Request $request, SketchpadConfig $config)
		{
			if (!$config->admin->settings)
			{
				return response()->json($config->settings);
			}

			function textToArray ($text)
			{
				return array_values(array_filter(array_map('trim', explode("\n", trim($text))), 'strlen'));
			}

			if($request->isMethod('post'))
			{
				// convert data
				$data = json_decode($request->get('settings'));

				// trim values
				$data->livereload->paths = textToArray($data->livereload->paths);

				// save
				$config->settings->save((array) $data);
			}
			return response()->json($config->settings);
		}
public function settings(Request $request, SketchpadConfig $config)
		{
			if (!$config->admin->settings)
			{
				return response()->json($config->settings);
			}

			function textToArray ($text)
			{
				return array_values(array_filter(array_map('trim', explode("\n", trim($text))), 'strlen'));
			}

			if($request->isMethod('post'))
			{
				// convert data
				$data = json_decode($request->get('settings'));

				// trim values
				$data->livereload->paths = textToArray($data->livereload->paths);

				// save
				$config->settings->save((array) $data);
			}
			return response()->json($config->settings);
		}
public function settings ( Request $ request , SketchpadConfig $ config ) { if ( ! $ config -> admin -> settings ) { return response ( ) -> json ( $ config -> settings ) ; } function textToArray ( $ text ) { return array_values ( array_filter ( array_map ( 'trim' , explode ( "\n" , trim ( $ text ) ) ) , 'strlen' ) ) ; } if ( $ request -> isMethod ( 'post' ) ) { // convert data $ data = json_decode ( $ request -> get ( 'settings' ) ) ; // trim values $ data -> livereload -> paths = textToArray ( $ data -> livereload -> paths ) ; // save $ config -> settings -> save ( ( array ) $ data ) ; } return response ( ) -> json ( $ config -> settings ) ; }
Loads or saves settings data

@method  POST
@method  GET
@param   Request $request
@param   SketchpadConfig $config
@return  SketchpadSettings
Loads or saves settings data