Skip to content

Instantly share code, notes, and snippets.

View NiltonMorais's full-sized avatar

Nilton Morais NiltonMorais

View GitHub Profile
@NiltonMorais
NiltonMorais / AlunoTable.php
Last active August 29, 2015 14:20
Catchable fatal error: Argument 1 passed to Zend\Form\Element\Select::setValueOptions() must be of the type array, null given, called in C:\Users\Nilton\Google Drive\localhost\AutoEscola\src\module\Aluno\src\Aluno\Form\Contrato.php on line 42
<?php
namespace Aluno\Model;
use Zend\Db\TableGateway\TableGateway;
use \Exception;
// import for fetchPaginator
use Zend\Db\Sql\Select,
Zend\Db\ResultSet\HydratingResultSet,
@NiltonMorais
NiltonMorais / ArquivoController.php
Created June 18, 2015 00:48
No localhost a aplicação funciona normal, mas quando subo pro servidor dar esse erro: Fatal error: Using $this when not in object context in /home/site/public_html/module/Site/view/partial/colunas_sort_arquivos.phtml on line 4 O que pode ser? versão do php? a versão do php do servidor é 5.3
<?php
namespace Site\Controller;
use Site\Form\Upload;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
class ArquivoController extends AbstractActionController
{
@NiltonMorais
NiltonMorais / produtos.html
Created January 9, 2016 00:50
HTML de produtos
<div class="col-sm-9 padding-right">
<div class="product-details"><!--product-details-->
<div class="col-sm-5">
<div class="view-product">
<img src="http://commerce.dev:10088/uploads/10.jpg" alt=""/>
@NiltonMorais
NiltonMorais / MainActivity.java
Created February 20, 2016 03:51
Latitude e Longitude não funcionam
package br.uesc.nilton.focoapi14;
import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
@NiltonMorais
NiltonMorais / index.php
Created April 11, 2016 15:19
Demonstrando sobrecarga de métodos
<?php
class Teste {
public function __construct()
{
echo "Executando o construtor pai\n";
}
public function meuMetodo()
{
@NiltonMorais
NiltonMorais / autoload.php
Created June 9, 2016 15:50
Autoload Example
<?php
define('CLASS_DIR', __DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR);
set_include_path(get_include_path().PATH_SEPARATOR.CLASS_DIR);
spl_autoload_register();
<?php
namespace DeliveryUrbano\Http\Requests;
use Illuminate\Http\Request as HttpRequest;
class CheckoutRequest extends Request {
/**
* Determine if the user is authorized to make this request.
<?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 controller to call when that URI is requested.
<?php
namespace DeliveryUrbano\Http\Controllers\Api\Client;
use \DeliveryUrbano\Http\Controllers\Controller;
use DeliveryUrbano\Http\Requests\CheckoutRequest;
use DeliveryUrbano\Repositories\OrderRepository;
use DeliveryUrbano\Repositories\UserRepository;
use DeliveryUrbano\Services\OrderService;
use \LucaDegasperi\OAuth2Server\Facades\Authorizer;
@NiltonMorais
NiltonMorais / gist:d50b955b8b79d5834a07fc29a309c66a
Created August 2, 2016 17:56 — forked from isimmons/gist:8202227
Truncate tables with foreign key constraints in a Laravel seed file.

For the scenario, imagine posts has a foreign key user_id referencing users.id

public function up()
{
	Schema::create('posts', function(Blueprint $table) {
		$table->increments('id');
		$table->string('title');
		$table->text('body');