Select CONCATE COLUMNS

$items = Item::join(‘Department’,’Item.DepartmentID’,’=’,’Department.ID’)
->select(DB::raw(‘CONCAT(Item.Name, Department.Name) as user_count’))
->where([‘Item.Active’=>1,’Item.WebsiteShow’=>1])->get();

Advertisements

jQuery Plugin For Creating QR Codes On Your Website – ClassyQR

lassyQR is a very simple jQuery plugin that makes it easy to create QR Codes (Two-dimensional Barcode) from different kinds of data on your website or application.

How to use it:

1. Load the latest version of jQuery library from google CDN

1
https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
2. Load the jQuery ClassyQR after jQuery library

1
http://js/jquery.classyqr.js
3. Create a container to embed the QR Code

1

2

4. Call the plugin with options

view source
1

2
$(document).ready(function() {
3
$(‘#qr’).ClassyQR({
4
create: true, // signals the library to create the image tag inside the container div.
5
type: ‘text’, // text/url/sms/email/call/locatithe text to encode in the QR. on/wifi/contact, default is TEXT
6
text: ‘Welcome to jQueryScript!’ // the text to encode in the QR.
7
});
8
});
9

Social Facebook Login

Reference URL: https://github.com/SammyK/LaravelFacebookSdk#installation

Route::get(‘/facebook/login’, function(SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb)
{
// Send an array of permissions to request
$login_url = $fb->getLoginUrl([’email’]);

// Obviously you’d do this in blade 🙂
echo ‘Login with Facebook‘;
});

// Endpoint that is redirected to after an authentication attempt
Route::get(‘/facebook/callback’, function(SammyK\LaravelFacebookSdk\LaravelFacebookSdk $fb)
{
// Obtain an access token.
try {
$token = $fb->getAccessTokenFromRedirect();
} catch (Facebook\Exceptions\FacebookSDKException $e) {
dd($e->getMessage());
}

// Access token will be null if the user denied the request
// or if someone just hit this URL outside of the OAuth flow.
if (! $token) {
// Get the redirect helper
$helper = $fb->getRedirectLoginHelper();

if (! $helper->getError()) {
abort(403, ‘Unauthorized action.’);
}

// User denied the request
dd(
$helper->getError(),
$helper->getErrorCode(),
$helper->getErrorReason(),
$helper->getErrorDescription()
);
}

if (! $token->isLongLived()) {
// OAuth 2.0 client handler
$oauth_client = $fb->getOAuth2Client();

// Extend the access token.
try {
$token = $oauth_client->getLongLivedAccessToken($token);
} catch (Facebook\Exceptions\FacebookSDKException $e) {
dd($e->getMessage());
}
}

$fb->setDefaultAccessToken($token);

// Save for later
Session::put(‘fb_user_access_token’, (string) $token);

// Get basic info on the user from Facebook.
try {
$response = $fb->get(‘/me?fields=id,name,email’);
} catch (Facebook\Exceptions\FacebookSDKException $e) {
dd($e->getMessage());
}

// Convert the response to a `Facebook/GraphNodes/GraphUser` collection
$facebook_user = $response->getGraphUser();

// Create the user if it does not exist or update the existing entry.
// This will only work if you’ve added the SyncableGraphNodeTrait to your User model.
print_r($facebook_user);exit();
$user = App\User::createOrUpdateGraphNode($facebook_user);

// Log the user into Laravel
Auth::login($user);

return redirect(‘/’)->with(‘message’, ‘Successfully logged in with Facebook’);
});

Create a free website or blog at WordPress.com.

Up ↑