示例#1
0
 public function senderStore(Request $request)
 {
     $pk_sender = $request->input('sp_key');
     $messageReceived = $request->input('message');
     $sender = new Sender();
     $sender->private_key = $pk_sender;
     $sender->save();
     $message = new Message();
     $message->text_message = $messageReceived;
     $message->save();
     return redirect('/encrypt');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //validatation
     /*$this->validate($request,[
                 'fname' => 'required | min:5',
                 'lname' => 'required | min:5
     
             ]);*/
     //validatation
     $this->validate($request, ['fname' => 'required | min:3| max:35', 'lname' => 'required | min:3| max:35', 'contact_no' => 'required | max:15', 'address' => 'required | min:10 | max:255', 'source_of_inc' => 'required | min:5', 'occupation' => 'required | min:4', 'citizenship' => 'required', 'residency' => 'required', 'address_ph' => 'required | min:10 | max:255']);
     $sender = new Sender();
     foreach ($request->all() as $key => $value) {
         $sender->{$key} = $value;
     }
     $sender->save();
     return response()->success(compact('sender'));
 }