Giter VIP home page Giter VIP logo

Comments (8)

rajasekar-d avatar rajasekar-d commented on June 27, 2024 1

Required prerequisite package:

composer require softon/sms:dev-master
composer require "laravelcollective/html":"^5.2.0"

routes/routes.php

Route::get('sms','SMSController@sms')->name('sms');
Route::post('send-sms','SMSController@sendSMS')->name('sendSMS');

resources/views/sms.php

{{ Form::open(['route' => ['sendSMS']]) }} 
	<div class="form-group row">
		{{ Form::label('mobile','Mobile No',['class' => 'col-md-3 col-form-label required']) }}
		<div class="col-md-9">
			{{ Form::text('mobile',null,['class' => 'form-control', 'autofocus' => 'autofocus']) }}
		</div>
	</div>
	<div class="form-group row">
		{{ Form::label('message','Message',['class' => 'col-md-3 col-form-label required']) }}
		<div class="col-md-9">
			{{ Form::text('message',null,['class' => 'form-control']) }}
		</div>
	</div>
	<div class="form-group row">
		<div class="col-md-9 ml-md-auto">
			{{ Form::button('Save',['class'=>'btn btn-primary mr-3','type'=>'submit']) }}
		</div>
	</div>
{{ Form::close() }}

http/controllers/SMSController.php

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Softon\Sms\Facades\Sms;

class SMSController extends Controller{

 	public function sms(){
		return view('sms');
	}
	
	public function sendSMS(Request $request){
		$mobile = $request->get('mobile');
                $message = $request->get('message');
                Sms::send_raw($mobile,$message);
		return redirect()->route(' sms')->with('success','SMS sent successfully');
  	}
}

from sms.

rajasekar-d avatar rajasekar-d commented on June 27, 2024

@yoursantu

Use send_raw method instead of send
Sms::send_raw('9090909090','Thank you for registering.');

from sms.

yoursantu avatar yoursantu commented on June 27, 2024

@rajasekar-d

i would like to use custom class instead of default predefined template, that should able to send the SMS from input text box or textarea using POST method!!

from sms.

yoursantu avatar yoursantu commented on June 27, 2024

from sms.

yoursantu avatar yoursantu commented on June 27, 2024

from sms.

yoursantu avatar yoursantu commented on June 27, 2024

@rajasekar-d
Hi,
that method, which you suggested in previous post worked for me,
and one more thig i need is, config from database i mean, i need dynamic config for app/config/sms.php
so how can do it so!?

from sms.

rajasekar-d avatar rajasekar-d commented on June 27, 2024

Try this,

You have to place the below code into AppServiceProvider Boot section

foreach (Setting::pluck('key','name') as $value => $key) {
   config()->set('nexmo.'.$key, $value);
 }

from sms.

yoursantu avatar yoursantu commented on June 27, 2024

@rajasekar-d
Thank you for your responce,
and in above code example the Setting table should be serialized right!?
and the method config()->set(); overrided the config/sms.php!?

from sms.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.