Skip to content

Instantly share code, notes, and snippets.

<?php
class User extends Basemodel {
public static $rules = array(
'username'=>'required|unique:users|alpha_dash|min:4',
'password'=>'required|alpha_num|between:4,8|confirmed',
'password_confirmation'=>'required|alpha_num|between:4,8'
);
<?php
class Question extends Basemodel {
public static $rules = array(
'question'=>'required|min:10|max:255',
'solved'=>'in:0,1'
);
public function user() {
<?php
class Create_Questions_Table {
/**
* Make changes to the database.
*
* @return void
*/
public function up()
<?php
class Users_Controller extends Base_Controller {
public $restful = true;
public function get_new() {
return View::make('users.new')
->with('title', 'Make It Snappy Q&A - Register');
}
<?php
class Users_Controller extends Base_Controller {
public $restful = true;
public function get_new() {
return View::make('users.new')
->with('title', 'Make It Snappy Q&A - Register');
}
@layout('layouts.default')
@section('content')
<h1>Login</h1>
{{ Form::open('login', 'POST') }}
{{ Form::token() }}
<p>
<?php
class Users_Controller extends Base_Controller {
public $restful = true;
public function get_new() {
return View::make('users.new')
->with('title', 'Make It Snappy Q&A - Register');
}
<?php
class Users_Controller extends Base_Controller {
public $restful = true;
public function get_new() {
return View::make('users.new')
->with('title', 'Make It Snappy Q&A - Register');
}
<?php
class Basemodel extends Eloquent {
public static function validate($data) {
return Validator::make($data, static::$rules);
}
}
@layout('layouts.default')
@section('content')
<h1>Register</h1>
@if($errors->has())
<p>The following errors have occurred:</p>
<ul id="form-errors">
{{ $errors->first('username', '<li>:message</li>') }}