Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function update(SMSTemplate $sms, Request $request)
- {
- //--
- $this->_security($sms, 'sms');
- //--
- $this->validate($request, $this->_rules($sms));
- $sms->client_id = \Auth::user()->client_id;
- $sms->name = $request->input('name');
- $sms->sender = $request->input('sender');
- $sms->text = $request->input('text');
- $sms->save();
- return redirect()->route('sms.index')->with('success', 'SMS template successfully updated!');
- }
- public function _rules($sms = false)
- {
- $rules['name'] = 'required|min:1|max:200|unique:sms_templates,name,NULL,id,client_id,'.\Auth::user()->client_id;
- $rules['sender'] = 'required|min:1|max:50';
- $rules['text'] = 'min:1|max:3000';
- if($sms) {
- $rules['name'] = 'required|min:1|max:200|unique:sms_templates,name,'.$sms->id.',id,client_id,'.\Auth::user()->client_id;
- }
- return $rules;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement