app/Http/Controllers/ReminderController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $validatedData = $request->validate([
            'client_id' => 'required',
            'mobile' => 'required',
            'email' => 'required',
            'end_date' => 'required',
        ]);
        Reminder::create([
            'client_id' => $request->client_id,
            'mobile' => json_encode($request->mobile),
            'email' => json_encode($request->email),
            'message' => $request->message,
            'end_date' => $request->end_date,
        ]);
        $data['text'] = $request->message;
        $number_array = [];
        foreach ($request->email as $email) {
            $data['email'] = $email;
            $this->sendEmail($data);
        }
        foreach ($request->mobile as $phone) {
            array_push($number_array, $phone);
        }
        $number_array = implode(",", $number_array);
        $this->sendSMS($data['text'], $number_array);
        return redirect()->route('reminders.index');
    }
public function store ( Request $ request ) { $ validatedData = $ request -> validate ( [ 'client_id' => 'required' , 'mobile' => 'required' , 'email' => 'required' , 'end_date' => 'required' , ] ) ; Reminder :: create ( [ 'client_id' => $ request -> client_id , 'mobile' => json_encode ( $ request -> mobile ) , 'email' => json_encode ( $ request -> email ) , 'message' => $ request -> message , 'end_date' => $ request -> end_date , ] ) ; $ data [ 'text' ] = $ request -> message ; $ number_array = [ ] ; foreach ( $ request -> email as $ email ) { $ data [ 'email' ] = $ email ; $ this -> sendEmail ( $ data ) ; } foreach ( $ request -> mobile as $ phone ) { array_push ( $ number_array , $ phone ) ; } $ number_array = implode ( " , " , $ number_array ) ; $ this -> sendSMS ( $ data [ 'text' ] , $ number_array ) ; return redirect ( ) -> route ( 'reminders.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .