Provider | Singleton | Instantiable | Configurable |
---|---|---|---|
Constant | Yes | No | No |
Value | Yes | No | No |
Service | Yes | No | No |
Factory | Yes | Yes | No |
Decorator | Yes | No? | No |
Provider | Yes | Yes | Yes |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Calculate Distance Between two points on a map</title> | |
</head> | |
<body> | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry"></script> | |
<script type="text/javascript"> | |
var p1 = new google.maps.LatLng(-12.928646, -38.509659); | |
var p2 = new google.maps.LatLng(-12.929426, -38.517798); |
<?php | |
$unsorted = [ | |
['d'=> 'teste', 'c' => 'teste2', 'e' => 'teste3'], | |
['d'=> 'teste', 'c' => 'teste2', 'e' => 'teste3'], | |
['d'=> 'teste', 'e' => 'teste3', 'c' => 'teste2', 'f' => 'valor'] | |
]; | |
$keys = ['c','e','d', 'f']; |
<?php | |
$this->app->bind('MasterUploader', function($app) use($your_parameter) | |
{ | |
// Make dependencies ... $any_dependancy_instance = $app->make('AnyDependancy'); etc... | |
return new EloquentUploader($any_dependancy_instance, $your_parameter); | |
}); |
You, as a User, can have one (hasOne) Profile. And of course the inverse also applies. Profile (belongsTo) a User. A user can't have more than one profile and a profile can't belong to multiple users.
You as a User, can have many (hasMany) Task(s). The inverse would be Task(s) (belongsTo) a User. So that means that a user can have/create many tasks, but each task only belongs to one user.
You as a User can belong to many (belongsToMany) (i.e. forum) Group(s). The inverse would be that a Group can also belong to many (belongsToMany) User(s). That means that a user can join as many groups as he wants, and of course a single group can have unlimited users inside.
One other thing that is pretty good to know is that when you use belongsTo and belongsToMany you're telling Laravel that this table holds the foreign key that connects it to the other table.
SELECT | |
l.status, | |
l.date_created, | |
ca1.value AS Email, | |
ca2.value AS Name, | |
ca3.value AS Phone | |
FROM tablename l | |
LEFT JOIN lead_data AS ca1 ON l.id = ca1.id_lead AND ca1.key='email' | |
LEFT JOIN lead_data AS ca2 ON l.id = ca2.id_lead AND ca2.key='name' | |
LEFT JOIN lead_data AS ca3 ON l.id = ca3.id_lead AND ca3.key='phone' |
<html> | |
<head> | |
<!-- Bootstrap CSS CDN --> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css"> | |
</head> | |
<body> | |
<!-- APP CONTENT --> | |
<!-- jQuery CDN --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> |