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

Commit

Permalink
multiple domains done
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwini0529 committed Aug 24, 2016
1 parent e4455a6 commit 0bce54e
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 67 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea/workspace.xml
/vendor
/node_modules
/public/storage
Expand Down
135 changes: 68 additions & 67 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use App\Http\Requests;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB;

class UserController extends Controller
{
Expand Down Expand Up @@ -212,5 +213,23 @@ public function send()
{
$this->dispatch(new SendSMS('8098678877', 'Queue Worked'));
}

/*
* Function to add domians
* */
public function addDomains(Request $request)
{
$myString = $request->domains;
$myArray = explode(',', $myString);
foreach ($myArray as $item) {
$domain = ((int)$item);
DB::table('user_domains')->insert(['user_id'=>Auth::user()->id,'domain_id'=>$domain]);
}
return 'All domains added successfully';
}
public function addDomainsView()
{
return view('User.addDomain');
}
}

2 changes: 2 additions & 0 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
* */
Route::get('/user/profile','UserController@viewProfile');
Route::get('/user/dashboard', 'UserController@dashboard');
Route::post('user/add/domain','UserController@addDomains');
Route::get('user/add/domain','UserController@addDomainsView');

/*
* Problem Statement Routes
Expand Down
9 changes: 9 additions & 0 deletions resources/views/User/addDomain.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<html>
<body>
<form action="/user/add/domain" method="POST">
{{csrf_field()}}
<label>Domain :</label> <input type="text" name="domains">
<input type="submit" value="add domain">
</form>
</body>
</html>

0 comments on commit 0bce54e

Please sign in to comment.