Created
September 6, 2016 14:47
-
-
Save jameslkingsley/2e7777e6d2971409f70cc4cd3a8e1109 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use Validator; | |
use App\JoinRequest; | |
use Illuminate\Http\Request; | |
use App\Http\Requests; | |
class JoinController extends Controller { | |
public function index() { | |
return view('join.form'); | |
} | |
public function list() { | |
$joinRequests = JoinRequest::all(); | |
return view('join.list', compact('joinRequests')); | |
} | |
public function submit(Request $request) { | |
$this->validate($request, [ | |
'name' => 'required|max:255', | |
'age' => 'required|integer|between:16,100', | |
'location' => 'required', | |
'email' => 'required|email', | |
'steam' => 'required|url', | |
'available' => 'required', | |
'apex' => 'required|integer', | |
'groups' => 'required', | |
'experience' => 'required', | |
'bio' => 'required' | |
]); | |
// Create the join request if there are no form errors | |
JoinRequest::create($request->all()); | |
return back(); | |
} | |
public function approve(JoinRequest $joinRequest) { | |
$joinRequest::approve(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment