Skip to content

Commit

Permalink
primeiro commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Turini committed Mar 31, 2015
0 parents commit 3afbaa4
Show file tree
Hide file tree
Showing 178 changed files with 20,460 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
17 changes: 17 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString

DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
SESSION_DRIVER=file

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto
*.css linguist-vendored
*.less linguist-vendored
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor
/node_modules
.env
Binary file added app/.DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions app/Commands/Command.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php namespace estoque\Commands;

abstract class Command {

//

}
32 changes: 32 additions & 0 deletions app/Console/Commands/Inspire.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php namespace estoque\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Foundation\Inspiring;

class Inspire extends Command {

/**
* The console command name.
*
* @var string
*/
protected $name = 'inspire';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Display an inspiring quote';

/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL);
}

}
29 changes: 29 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php namespace estoque\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel {

/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
'estoque\Console\Commands\Inspire',
];

/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('inspire')
->hourly();
}

}
7 changes: 7 additions & 0 deletions app/Events/Event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php namespace estoque\Events;

abstract class Event {

//

}
42 changes: 42 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php namespace estoque\Exceptions;

use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler {

/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport = [
'Symfony\Component\HttpKernel\Exception\HttpException'
];

/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
*
* @param \Exception $e
* @return void
*/
public function report(Exception $e)
{
return parent::report($e);
}

/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
return parent::render($request, $e);
}

}
Empty file added app/Handlers/Commands/.gitkeep
Empty file.
Empty file added app/Handlers/Events/.gitkeep
Empty file.
38 changes: 38 additions & 0 deletions app/Http/Controllers/Auth/AuthController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php namespace estoque\Http\Controllers\Auth;

use estoque\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;

class AuthController extends Controller {

/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/

use AuthenticatesAndRegistersUsers;

/**
* Create a new authentication controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\Registrar $registrar
* @return void
*/
public function __construct(Guard $auth, Registrar $registrar)
{
$this->auth = $auth;
$this->registrar = $registrar;

$this->middleware('guest', ['except' => 'getLogout']);
}

}
38 changes: 38 additions & 0 deletions app/Http/Controllers/Auth/PasswordController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php namespace estoque\Http\Controllers\Auth;

use estoque\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords;

class PasswordController extends Controller {

/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/

use ResetsPasswords;

/**
* Create a new password controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
* @return void
*/
public function __construct(Guard $auth, PasswordBroker $passwords)
{
$this->auth = $auth;
$this->passwords = $passwords;

$this->middleware('guest');
}

}
11 changes: 11 additions & 0 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php namespace estoque\Http\Controllers;

use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;

abstract class Controller extends BaseController {

use DispatchesCommands, ValidatesRequests;

}
36 changes: 36 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php namespace estoque\Http\Controllers;

class HomeController extends Controller {

/*
|--------------------------------------------------------------------------
| Home Controller
|--------------------------------------------------------------------------
|
| This controller renders your application's "dashboard" for users that
| are authenticated. Of course, you are free to change or remove the
| controller as you wish. It is just here to get your app started!
|
*/

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}

/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function index()
{
return view('home');
}

}
21 changes: 21 additions & 0 deletions app/Http/Controllers/LoginController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php namespace estoque\Http\Controllers;

use estoque\Http\Requests;
use estoque\Http\Controllers\Controller;

use Auth;
use Request;

class LoginController extends Controller {

public function login()
{
$credenciais = Request::only('email', 'password');

if(Auth::attempt($credenciais)) {
return "Usuário ". Auth::user()->name ." logado com sucesso";
}

return "As credencias não são válidas";
}
}
50 changes: 50 additions & 0 deletions app/Http/Controllers/ProdutoController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php namespace estoque\Http\Controllers;

use estoque\Produto;
use Request;
use estoque\Http\Requests\ProdutosRequest;

class ProdutoController extends Controller {

public function __construct()
{
$this->middleware('auth', ['only' => ['adiciona', 'remove']]);
}

public function lista(){
$produtos = Produto::all();
return view('produto.listagem')->with('produtos', $produtos);
}

public function mostra($id){
$produto = Produto::find($id);
if(empty($produto)) {
return "Esse produto não existe";
}
return view('produto.detalhes')->with('p', $produto);
}

public function novo(){
return view('produto.formulario');
}

public function adiciona(ProdutosRequest $request){
Produto::create($request->all());

return redirect()
->action('ProdutoController@lista')
->withInput(Request::only('nome'));
}

public function listaJson(){
$produtos = Produto::all();
return response()->json($produtos);
}

public function remove($id){
$produto = Produto::find($id);
$produto->delete();
return redirect()->action('ProdutoController@lista');
}

}
36 changes: 36 additions & 0 deletions app/Http/Controllers/WelcomeController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php namespace estoque\Http\Controllers;

class WelcomeController extends Controller {

/*
|--------------------------------------------------------------------------
| Welcome Controller
|--------------------------------------------------------------------------
|
| This controller renders the "marketing page" for the application and
| is configured to only allow guests. Like most of the other sample
| controllers, you are free to modify or remove it as you desire.
|
*/

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}

/**
* Show the application welcome screen to the user.
*
* @return Response
*/
public function index()
{
return view('welcome');
}

}
Loading

0 comments on commit 3afbaa4

Please sign in to comment.