Skip to content

Instantly share code, notes, and snippets.

View thangngoc89's full-sized avatar

Khoa Nguyen thangngoc89

View GitHub Profile
// Database connector
<?php
use Illuminate\Database\Capsule\Manager as Capsule;
/**
* Configure the database and boot Eloquent
*/
global $capsule;
$capsule = new Capsule;
$capsule->addConnection(array(
'driver' => getenv('DB_DRIVER'),
// Test Model
<?php
use Illuminate\Database\Eloquent\Model as Eloquent;
class Test extends Eloquent {
protected $table = 'test';
protected $hidden = array();
protected $fillable = array('id', 'title');
protected $nullable = [];
public $timestamps = false;

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.

This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.

1. Get a domain

@thangngoc89
thangngoc89 / larask-gist-series.markdown
Last active August 14, 2021 01:44
Giới thiệu series Larask Gist

This post was orginal public at http://khoanguyen.me/gioi-thieu-series-larask-gist/


#Giới thiệu

Học lập trình/framework thì không gì tốt hơn là học trực tiếp qua code. Ứng dụng vào một ứng dụng thực tế. Hôm nay mình xin được giới thiệu với các bạn series Larask Gist. Giúp bạn có thể tạo được một ứng dụng Github Gist Clone bằng Laravel 5.

#Mục tiêu

Series này sẽ tập trung về các vấn đề Laravel 5, nên sẽ có nhiều chỗ front-end, mình sẽ cung cấp code sẵn cho các bạn copy-paste. Mình hy vọng sẽ có 1 series front-end trong tương lai. Qua series này, các bạn sẽ hiểu được các khái niệm cơ bản của Laravel 5 như route, model, controller, migration, seeder, ... và hiểu rõ hơn về cách hoạt động của mô hình MVC

ErrorException in Guard.php line 419:
Argument 1 passed to Illuminate\Auth\Guard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of Quiz\User given, called in D:\www\newquiz\app\AuthenticateUser.php on line 53 and defined
#Stace Trace
in Guard.php line 419
at HandleExceptions->handleError('4096', 'Argument 1 passed to Illuminate\Auth\Guard::login() must be an instance of Illuminate\Contracts\Auth\Authenticatable, instance of Quiz\User given, called in D:\www\newquiz\app\AuthenticateUser.php on line 53 and defined', 'D:\www\newquiz\vendor\laravel\framework\src\Illuminate\Auth\Guard.php', '419', array()) in Guard.php line 419
at Guard->login(object(User), true) in AuthenticateUser.php line 53
at AuthenticateUser->execute('facebook', true, object(AuthController)) in AuthController.php line 19
at AuthController->login('facebook', object(AuthenticateUser), object(Request))
at call_user_func_array(array(object(AuthController), 'login'), array('provider' => 'facebook', object(Aut
@thangngoc89
thangngoc89 / Discourse Payload
Created January 3, 2015 12:29
Discourse Payload
def to_url(base_url=nil)
base = "#{base_url || sso_url}"
"#{base}#{base.include?('?') ? '&' : '?'}#{payload}"
end