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
@layout('layouts.default') | |
@section('content') | |
<h1>Login</h1> | |
{{ Form::open('login', 'POST') }} | |
{{ Form::token() }} | |
<p> |
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 | |
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'); | |
} |
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 | |
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'); | |
} |
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 | |
class Create_Questions_Table { | |
/** | |
* Make changes to the database. | |
* | |
* @return void | |
*/ | |
public function up() |
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 | |
class Question extends Basemodel { | |
public static $rules = array( | |
'question'=>'required|min:10|max:255', | |
'solved'=>'in:0,1' | |
); | |
public function user() { |
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 | |
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' | |
); |
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
@layout('layouts.default') | |
@section('content') | |
<div id="ask"> | |
<h1>Ask a Question</h1> | |
@if(Auth::check()) | |
@if($errors->has()) | |
<p>The following errors have occurred:</p> |
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 | |
class Questions_Controller extends Base_Controller { | |
public $restful = true; | |
public function __construct() { | |
$this->filter('before', 'auth')->only(array('create')); | |
} |
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
// No model question.php | |
public static function unsolved() { | |
return static::where('solved','=',0)->order_by('id', 'DESC')->paginate(3); | |
} |
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
// no nosso controller questions.php | |
public function get_index() { | |
return View::make('questions.index') | |
->with('title', 'Make It Snappy Q&A - Home') | |
->with('questions', Question::unsolved()); // pega as questions no banco de dados | |
} |