Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
Message Queue and Frontend bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwini0529 committed Aug 24, 2016
1 parent 7c61714 commit e4455a6
Show file tree
Hide file tree
Showing 8 changed files with 324 additions and 156 deletions.
393 changes: 241 additions & 152 deletions .idea/workspace.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion app/Http/Controllers/Auth/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ protected function validator(array $data)
*/
protected function create(array $data)
{

return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'role' => 0,
'domain' =>$data['domain'],
'regno' =>$data['regno'],
'experience' =>$data['experience'],
'why_gdg' =>$data['why_gdg'],
Expand Down
8 changes: 6 additions & 2 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class UserController extends Controller
*/
public function __construct()
{
$this->middleware('auth');
$this->middleware('isAdmin', ['only' => ['showUsers','adminDashboard']]);
$this->middleware('auth',['except'=>['send']]);
$this->middleware('isAdmin', ['only' => ['showUsers','adminDashboard','send']]);

}

Expand Down Expand Up @@ -208,5 +208,9 @@ public function getShortlistedCandidates(Request $request)
return view('User.Admin.getShortlistedCandidates',compact('people'));

}
public function send()
{
$this->dispatch(new SendSMS('8098678877', 'Queue Worked'));
}
}

1 change: 1 addition & 0 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@
Route::get('/admin/dashboard','UserController@adminDashboard');
Route::get('/admin/users/shortlist','UserController@shortlist');
Route::post('/admin/users/shortlist','UserController@getShortlistedCandidates');
Route::get('/sms', 'UserController@send');
71 changes: 71 additions & 0 deletions app/Jobs/SendSMS.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php
namespace App\Jobs;
use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Bus\SelfHandling;
use Illuminate\Contracts\Queue\ShouldQueue;
class SendSMS extends Job implements SelfHandling, ShouldQueue
{
use SerializesModels, InteractsWithQueue;
/**
* @var
*/
private $phone;
/**
* @var
*/
private $message;
/**
* Create a new job instance.
*
* @param $phone
* @param $message
*/
public function __construct(array $phone, $message)
{
$this->phone = implode(',',$phone);
$this->message = $message;
echo $this->message;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//Your authentication key
$authKey = "";
//Define route
$route = "4";

//Sender ID,While using route4 sender id should be 6 characters long.
$senderId = "GDGVIT";
//Prepare you post parameters
$postData = array(
'authkey' => $authKey,
'mobiles' => $this->phone,
'message' => $this->message,
'sender' => $senderId,
'route' => $route
);
//API URL
$url = "https://control.msg91.com/api/sendhttp.php";
// init the resource
$ch = curl_init();
curl_setopt_array($ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => $postData
//,CURLOPT_FOLLOWLOCATION => true
));
//Ignore SSL certificate verification
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
//get response
$output = curl_exec($ch);
curl_close($ch);
}
}
2 changes: 1 addition & 1 deletion app/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class User extends Authenticatable
* @var array
*/
protected $fillable = [
'name', 'email', 'password','role','domain','regno','why_gdg','experience','linkedin','github','behance','selected','marks','contact'
'name', 'email', 'password','role','regno','why_gdg','experience','linkedin','github','behance','selected','marks','contact'
];

/**
Expand Down
1 change: 1 addition & 0 deletions resources/views/auth/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<input type="text" name="name" value="{{ old('name') }}" id="name">
<label for="name">Name
</div>
{{csrf_field()}}
@if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
Expand Down
2 changes: 2 additions & 0 deletions resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
@section('content')

<div class="row main-content">


<div class="left-content col s6 m6 l6">
<div class="links">
<a href="#" data-to="first-content" data-number="0" class="active-link"><img src="images/Button Selected.png"></a>
Expand Down

0 comments on commit e4455a6

Please sign in to comment.