diff --git a/.gitignore b/.gitignore index 6b3af3f..1c96ed4 100755 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.idea/workspace.xml /vendor /node_modules /public/storage diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 3b08022..2e66422 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,14 +2,11 @@ - + + - - - - @@ -34,8 +31,8 @@ - - + + @@ -43,21 +40,21 @@ - - + + - - + + - - + + - - + + @@ -76,14 +73,14 @@ - + - + @@ -96,14 +93,14 @@ - - + + - + @@ -159,11 +156,13 @@ @@ -583,7 +582,7 @@ - + 1470207378642 @@ -596,14 +595,14 @@ - - + @@ -651,20 +650,6 @@ - - - - - - - - - - - - - - @@ -938,81 +923,97 @@ - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 5d14389..7ddf940 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -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 { @@ -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'); + } } diff --git a/app/Http/routes.php b/app/Http/routes.php index 70d96d5..92da495 100755 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -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 diff --git a/resources/views/User/addDomain.blade.php b/resources/views/User/addDomain.blade.php new file mode 100644 index 0000000..1fbd740 --- /dev/null +++ b/resources/views/User/addDomain.blade.php @@ -0,0 +1,9 @@ + + +
+ {{csrf_field()}} + + +
+ + \ No newline at end of file