Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):
class Shop extends Eloquent {}
Using custom table name
protected $table = 'my_shops';
A curated list of amazingly awesome PHP libraries, resources and shiny things.
<?php | |
/* | |
* Dependency injection can help you reduce coupling and increase testability, making your applications more maintainable. | |
* | |
* DependencyResolver gives you the best of both worlds by mixing a registry with call time dependency resolution. In addition, it provides significant resource | |
* usage advantages over other patterns, such as an object pool, because dependencies are only resolved when they are actually needed. | |
* | |
* It supports both constructor injection for class wide dependencies, as well as method injection for method specific dependencies. | |
* |
<?php | |
/** | |
* Return the coefficient of two items based on Jaccard index | |
* http://en.wikipedia.org/wiki/Jaccard_index | |
* | |
* Example: | |
* | |
* $tags1 = "code, php, jaccard, test, items"; | |
* $tags2 = "test, code"; |
Sentry is an amazing auth system. But I really need a feature: multiple user types in the same app. And I cannot separate those in groups, because they have different table columns. After 2 days burning my head, I think I found a good solution. The magic is duplicate SentryServiceProvider with new different settings.
Lets suppose we have a fresh Sentry install with default User ambient. Now we want another ambient called Admin, with new model and different settings. How to do:
Let's create one model called Admin for our new ambient.
<?php | |
namespace Twilio; | |
use GuzzleHttp\Client as HttpClient; | |
use GuzzleHttp\Collection; | |
use GuzzleHttp\Command\Guzzle\GuzzleClient; | |
use GuzzleHttp\Command\Guzzle\Description; | |
use GuzzleHttp\Command\Model; | |
use GuzzleHttp\Subscriber\Retry\RetrySubscriber; |
<?php | |
class User extends Cartalyst\Sentry\Users\Eloquent\User { | |
/** | |
* @author Arda Kılıçdağı, | |
* @param $orderBy string how to order | |
* @param $sortBy string Sort like Ascending or Descending, values are asc/desc | |
* @param $toArray boolean whether to return the output as array or not. Default is false | |
* |
<script type="text/javascript"> | |
(function () { | |
"use strict"; | |
// once cached, the css file is stored on the client forever unless | |
// the URL below is changed. Any change will invalidate the cache | |
var css_href = './index_files/web-fonts.css'; | |
// a simple event handler wrapper | |
function on(el, ev, callback) { | |
if (el.addEventListener) { | |
el.addEventListener(ev, callback, false); |
A curated list by Eric Elliott and friends. Suggest links in the comments below.
This is a very exclusive collection of only must-have JavaScript links. I'm only listing my favorite links. Nothing else makes the cut. Feel free to suggest links if you think they're good enough to make this list. The really curious should feel free to browse the comments to find other links. I can't guarantee the quality of links in the comments.
Some of these links are affiliate links, meaning that if you make a purchase, I might earn a little money. This has absolutely no bearing on whether or not links make the list. None, whatsoever. However, it does allow me more resources to fight poverty with code. Every little bit counts.
import { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |