function like __construct function but for specific function.
my route
Route::resource('form00', 'Form00Controller');
Route::resource('form001', 'Form001Controller');
........ and more
my __contsruct in Form00Controller
public function __construct()
{
$this->validate(request(), [
'projectName' =>
array(
'required',
'regex:/(^([a-zA-Z]+)(\d+)?$)/u'
)
];
}
my another Form00Controller function
public function create()// this function and another not effected
{
return view('form00.create');
}
public function store(Request $request)//__construct just for this function
{
$requestData = $request->all();
Form00::create($requestData);
return redirect('form00')->with('flash_message', 'Form00 added!');
}
i need validate just for function store and not change that function.