PHP code example of openbuildings / jam-auth

1. Go to this page and download the library: Download openbuildings/jam-auth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

openbuildings / jam-auth example snippets

 defined('SYSPATH') OR die('No direct script access.');

	class Model_User extends Model_Auth_User {

		public static function initialize(Jam_Meta $meta)
		{
			// Initialize the parent - set fields and associations
			parent::initialize($meta);

			$meta->behaviors(array(
				'sluggable' => Jam::behavior('Sluggable'),
			));

			// Add additional fields
			$meta->fields(array(
				'first_name' => Jam::field('string'),
				'last_name'  => Jam::field('string'),
			));
		}
	}


To setup the login code you can use the ->login() method of the jam auth like this:

	APPPATH/views/session/form.php
	 if (isset($message)): 
 echo $message 
 endif 
 if (isset($message)): 
 echo $message 
 endif