Repo for the search and displace core module including the interface to select files and search and displace operations to run on them. https://searchanddisplace.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
985 B

<?php
namespace App\Http\Controllers;
use App\SearchDisplace\Regex\RegexFactory;
class RegexController extends Controller
{
public function create()
{
return view('pages.regex.create');
}
public function store()
{
request()->validate([
'name' => 'required',
'tag' => 'nullable',
'expression' => 'required',
]);
try {
$factory = new RegexFactory(
request()->get('name'),
request()->get('expression'),
request()->get('tag')
);
$searcher = $factory->create();
return response()->json([
'status' => 'success',
'searcher' => $searcher,
], 200);
} catch (\Exception $exception) {
return response()->json([
'status' => 'fail',
'message' => $exception->getMessage(),
], 400);
}
}
}