Sorry out of topic question I couldn't find related topic.
public function store(Request $request)
{
$companyRequest = new CompanyRequest($request->get('company'));
return $companyRequest->validated();
}
returns "Call to a member function validated() on null".
I couldn't any information about it.
The reason why I am doing this because I don't want to validate it in one FormRequest. Like
rules(){
company.test => "required"
company.test2 => "required".........
........
......
}
Interesting I've never used Form Request classes manually like this by creating the instance, so pretty sure it wouldn't work, that's why you couldn't have any information about it. Not sure WHY you don't want to validate it in one Form Request, any reason? I would stick to how framework works by default and not reinvent the wheel, but maybe you have a reason for that. But I don't think you would find any docs/examples about this approach.
The reason is "Single Responsibility" just wanted to validate each one in one related class. Company related data in companyRequest form. Test data in testRequest form. But all data will come in one request. Company belongsto Test. Frontend will send post request with company data to testController store and there I want to validate each data in own requestFormClass respectively.
Seems like storing Stripe secret keys for your users in an open database table is asking for trouble. Not sure a better solution, except maybe enforcing table encryption or something to mitigate that data leaking.
Hi, where is the description?
Sorry, forgot, added the description with the link now.
Sorry out of topic question I couldn't find related topic. public function store(Request $request) { $companyRequest = new CompanyRequest($request->get('company')); return $companyRequest->validated(); } returns "Call to a member function validated() on null". I couldn't any information about it. The reason why I am doing this because I don't want to validate it in one FormRequest. Like rules(){ company.test => "required" company.test2 => "required"......... ........ ...... }
Interesting I've never used Form Request classes manually like this by creating the instance, so pretty sure it wouldn't work, that's why you couldn't have any information about it. Not sure WHY you don't want to validate it in one Form Request, any reason? I would stick to how framework works by default and not reinvent the wheel, but maybe you have a reason for that. But I don't think you would find any docs/examples about this approach.
The reason is "Single Responsibility" just wanted to validate each one in one related class. Company related data in companyRequest form. Test data in testRequest form. But all data will come in one request. Company belongsto Test. Frontend will send post request with company data to testController store and there I want to validate each data in own requestFormClass respectively.
Seems like storing Stripe secret keys for your users in an open database table is asking for trouble. Not sure a better solution, except maybe enforcing table encryption or something to mitigate that data leaking.