ggc-itec / ggc-talk

Unofficial website for the Georgia Gwinnett College community
MIT License
2 stars 18 forks source link

GGC-Talk

Usage

How to setup development environment in Windows

  1. Download and install WAMP
  2. Clone this repository in your WAMP www folder (i.e. c:\wamp\www)
  3. Download and install Composer (use the Windows Installer)
  4. Remove semi-colon in front of extension=php_openssl.dll line in the c:\wamp\bin\php\php5.4.12\php.ini file
  5. Open terminal and type composer install in the c:\wamp\www\ggc-talk folder
  6. Open a browser and type localhost/ggc-talk/public in the url bar

Editing the project

  1. Download and install Aptana Studio 3
  2. Start Aptana Studio
  3. Click on File then Import
  4. Select Existing Projects into Workspace then select the ggc-talk repository

Using the Auth system

Restrict routes with authentication filters:

Route::group(array('before' => 'auth'), function() {
  // insert route that can only be accessed by a logged in user
});

Route::group(array('before' => 'guest'), function() {
  // insert route that can only be accessed by a non-logged in user
});

You might want to use this to keep users from going to a route directly via URL. For example, if you had the login route under the guest filter, any logged in users going to the login URL will be redirected to the home page.

How to access logged in user's attributes:

@if(Auth::user() -> role == 'Admin')
<!-- insert admin specific html code here -->
@endif

You can access a logged in user's attributes to display or check against. The example above accesses the user's role. In addition to role, you can access id, email (though email and id are the same), first_name, and last_name.

How to check if a user is logged in:

Auth::check()
// This returns true if the user is logged in
Auth::guest()
// This returns true if the user is not logged in

You might want to use this for a specific element that you only want admins to see. For example, you might want admins to be able to see a button to delete comments on the gallery page, but you wouldn't want standard users to see the button.

Additional documentation on the Laravel Authentication system: http://laravel.com/docs/security

Troubleshooting

  1. Where do I set my Database Configuration?

    Database configurations are found in Database configurations: ggc-talk/app/config/database.php Make sure the configurations are pointed too the MYSQL instance that you have set up.

  2. I set up composer and I still can't run the application!?

    on the command line, make sure you run the command: php artisan migrate This command updates your MySQL database changes so that you have a Database Version control. Basically, it makes sure your database is up to date.

  3. I added a new custom class but Laravel can't see it!?

    Please make sure to run the command 'composer dump-autoload' in the root of the application. Alternatively, you can explicityly add a directory to the ClassLoader::addDirectories in the app/start/Global.php file.

    ClassLoader::addDirectories(array(
    
    app_path().'/commands',
    app_path().'/controllers',
    app_path().'/models',
    app_path().'/database/seeds',
    app_path().'/MyClassFolderGoesHere'
    
    ));

Packages

Packages are the primary way of adding functionality to Laravel.