Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Hélio insign

🎯
Focusing
Block or report user

Report or block insign

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ItemsController.php
<?php
class ItemsController extends BaseController {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index() {
View app\routes.php
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
@insign
insign / calcular.php
Created Oct 8, 2013
Cálculo de Prescrição (simulação)
View calcular.php
<?php
require_once 'cdp.class.php';
$cdp = new CalculoDePrescricao;
$cdp->data_do_crime = $_POST['data_do_crime'];
$cdp->data_da_denuncia = $_POST['data_da_denuncia'];
$cdp->idade_criminoso = $_POST['idade_criminoso'];
$cdp->pena_maxima = $_POST['pena_maxima'];
@insign
insign / watchlist.php
Created Nov 7, 2015
Sync IMDb watchlist to trakt.tv watchlist. Usage: php -f watchlist.php trakt_apikey trakt_username trakt_passwordhash imdb_login imdb_password imdb_uid (IMDb login is email adress or nickname, it's NOT the ur12345678 bit, that's the imdb_uid)
View watchlist.php
<?php
define('TRAKT_APIKEY', $argv[1]);
define('TRAKT_USERNAME', $argv[2]);
define('TRAKT_PASSWORD', $argv[3]);
define('IMDB_EMAIL', $argv[4]);
define('IMDB_PASSWORD', $argv[5]);
define('IMDB_UID', $argv[6]);
function curl_post($urlpre, $data, $urlpost = '')
@insign
insign / User.php
Created Nov 23, 2015
Problemas com relacionamentos - laravel
View User.php
<?php
// APENAS A PARTE RELEVANTE
public function fotos()
{
return $this->hasMany('\App\UserFoto');
}
?>
@insign
insign / 2014_10_29_181650_create_users_fotos_table.php
Created Nov 23, 2015
Problemas com relacionamentos - laravel (Error: Call to undefined method Illuminate\Database\Query\Builder::mini())
View 2014_10_29_181650_create_users_fotos_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateUsersFotosTable extends Migration
{
/**
* Run the migrations.
View exemplo 1.php
<?php
// This will create a product, apply a discount since it is a new
// product, and send a notification via email
public function store()
{
// Create product from request
$product = Product::create($request->all());
// Get the discount to be applied
$discount = Discount::byType('newProduct');
View exemplo2.php
<?php
protected function createProduct()
{
}
protected function applyDiscount($type, $product)
{
}
View exemplo3.php
<?php
protected function createProduct()
{
return Product::create($this->request->all());
}
protected function applyDiscount($type, $product)
{
$discount = Discount::byType($type);
View exemplo4.php
<?php
public function store()
{
$product = $this->createProduct();
$this->applyDiscount('newProduct', $product);
$this->notifyUsersVia('email');
return 'Success';
}
You can’t perform that action at this time.