Skip to content

Instantly share code, notes, and snippets.

@m-maranan
Created February 26, 2014 20:30
Show Gist options
  • Select an option

  • Save m-maranan/9237872 to your computer and use it in GitHub Desktop.

Select an option

Save m-maranan/9237872 to your computer and use it in GitHub Desktop.
Routes.php
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/',function(){
return View::make('web.page.template.home');
});
Route::post('/',function(){
$rules = array(
'email' => 'Required|Between:3,64|Email|Unique:signup'
);
$input = Input::all();
$validator= Validator::make($input, $rules);
if( $validator->passes() ) {
$signup = new Signup();
$signup->email = Input::get('email');
$signup->save();
$data = array('signup_email'=> Input::get('email'));
Mail::send('mail.notifications.signup', $data, function($message)
{
$message->subject('New Signup Notification');
$message->to(array('jdevine@cloud816.com','rorgan@cloud816.com','dlaugharn@cloud816.com'));
});
return View::make('hold.confirmation')->with('message','Thank you for your interest in <strong>Law Firm Rater</strong>. Keep an eye on your inbox.');
} else {
return View::make('hold.confirmation')->with('message','It appears your email address is already signed up for notifications. Thank you for your interest.');
}
});
Route::group(array('prefix' => 'dashboard'), function()
{
// Route to Dashboard Index
Route::get('/',array('before'=>'auth', function()
{
$reviews = Reviews::where('user_id','=',Auth::user()->id)->get();
return View::make('web.dashboard.view.index')->with('reviews',$reviews);
}));
// Routes for Profile
Route::get('profile', array('before'=>'auth', function() { }));
Route::get('profile/manage', array('before'=>'auth', function() {
$practices = Practices::all();
return View::make('web.authentication.view.registration-firm-information')->with('practices',$practices);
}));
Route::post('profile/manage', array('before'=>'auth', function() {
$user = User::find(Auth::user()->id);
$user->firm_name = Input::get('firm_name');
$user->description = Input::get('description');
if(Input::get('practices')){
foreach (Input::get('practices') as $key => $value) {
$user->practices()->attach($value);
}
}
$user->save();
return View::make('web.authentication.view.registration-success');
}));
// Route to Social Media Resource
Route::resource('social-media', 'SocialController');
// Route to Firm Information Resource
Route::resource('firm-information', 'FirmInformationController');
// Routes for Reviews Resource
Route::resource('reviews', 'ReviewController');
});
Route::group(array('prefix' => 'firm'), function()
{
// Routes for Client Review Form
Route::get('{firm_id}/reviews/{slug}','ReviewController@getClientReview');
Route::post('{firm_id}/reviews/{slug}','ReviewController@postClientReview');
Route::get('reviews/success','ReviewController@getReviewSuccess');
// Route for Firms Page
Route::get('{firm_id}', function($firm_id) {});
Route::get('{firm_id}/reviews', function($firm_id) {});
});
Route::group(array('prefix' => 'account'), function()
{
// Route to Login
Route::get('login','AuthController@getLogin');
Route::post('login','AuthController@postLogin');
// Route to Logout
Route::get('logout','AuthController@getLogout');
// Route to Account Registration
Route::get('create','RegistrationController@getCreate');
Route::post('create','RegistrationController@postCreate');
Route::get('payment-method','RegistrationController@getBillingInformation');
Route::post('payment-method','RegistrationController@postBillingInformation');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment