public function bulk ($redirects, $separator, $type, $siteId)
	{
		$rawRedirects = array_map(function ($line) use ($separator) {
			return str_getcsv($line, $separator);
		}, explode(PHP_EOL, $redirects));

		$newFormatted = [];

		foreach ($rawRedirects as $redirect)
		{
			$record = new RedirectRecord();
			$record->uri = $redirect[0];
			$record->to = $redirect[1];
			$record->type = array_key_exists(2, $redirect) ? $redirect[2] : $type;
			$record->siteId = $siteId;
			$record->save();

			$newFormatted[] = [
				'id'     => $record->id,
				'uri'    => $record->uri,
				'to'     => $record->to,
				'type'   => $record->type,
				'siteId' => $record->siteId,
			];
		}

		return [$newFormatted, false];
	}
public function bulk ($redirects, $separator, $type, $siteId)
	{
		$rawRedirects = array_map(function ($line) use ($separator) {
			return str_getcsv($line, $separator);
		}, explode(PHP_EOL, $redirects));

		$newFormatted = [];

		foreach ($rawRedirects as $redirect)
		{
			$record = new RedirectRecord();
			$record->uri = $redirect[0];
			$record->to = $redirect[1];
			$record->type = array_key_exists(2, $redirect) ? $redirect[2] : $type;
			$record->siteId = $siteId;
			$record->save();

			$newFormatted[] = [
				'id'     => $record->id,
				'uri'    => $record->uri,
				'to'     => $record->to,
				'type'   => $record->type,
				'siteId' => $record->siteId,
			];
		}

		return [$newFormatted, false];
	}
public function bulk ( $ redirects , $ separator , $ type , $ siteId ) { $ rawRedirects = array_map ( function ( $ line ) use ( $ separator ) { return str_getcsv ( $ line , $ separator ) ; } , explode ( PHP_EOL , $ redirects ) ) ; $ newFormatted = [ ] ; foreach ( $ rawRedirects as $ redirect ) { $ record = new RedirectRecord ( ) ; $ record -> uri = $ redirect [ 0 ] ; $ record -> to = $ redirect [ 1 ] ; $ record -> type = array_key_exists ( 2 , $ redirect ) ? $ redirect [ 2 ] : $ type ; $ record -> siteId = $ siteId ; $ record -> save ( ) ; $ newFormatted [ ] = [ 'id' => $ record -> id , 'uri' => $ record -> uri , 'to' => $ record -> to , 'type' => $ record -> type , 'siteId' => $ record -> siteId , ] ; } return [ $ newFormatted , false ] ; }
Bulk creates redirects

@param      $redirects
@param      $separator
@param      $type
@param      $siteId

@return array
Bulk creates redirects