Skip to content

Instantly share code, notes, and snippets.

View tisuchi's full-sized avatar
🙂
Smile is Sadaqah (righteousness)

Thouhedul Islam tisuchi

🙂
Smile is Sadaqah (righteousness)
View GitHub Profile
Adding Product in Admin
==================================
SELECT
product.*, product_variation.*, product_option.*
FROM product
LEFT JOIN product_variation ON product_variation.product_id = product.product_id
LEFT JOIN product_option ON product_option.product_id = product.product_id
LEFT JOIN order_product ON order_product.product_id = product.product_id
LEFT JOIN customer_order ON customer_order.order_id = order_product.order_id
<?php
User::where('user_id','=', $this->id)
->where('some condition here')
->join('items', 'items.user_id', '=', 'users.id')
->with('items')
->orderBy('items.type')
->get();
<?php
User::where('user_id','=', $this->id)
->where('some condition here')
->join('items', 'items.user_id', '=', 'users.id')
->orderBy('items.type')
->get();
iVBORw0KGgoAAAANSUhEUgAAAyAAAAQrCAIAAAD7cl9yAAAAA3NCSVQICAjb4U/gAAAgAElEQVR4nEy927Ik2Y4c5g5gRe7qPkPTg75GeiBFUuKMSJmkMf2N3vUV+srROd2VGQtwPfiKXV1zbKytu3buyHUBHO4OBP/f/+f/FuKeyevqGa6KIGZLw0pJK3Jl/ew/otCq4CIxo4iiOL27myAYM8qIiOC0MBXZMyCi6jO7NRUZo4zs6elN6L4/mRkRvTcAkEH23mt9kTOTZAIz00FAUs/7/lzX1fddtUjt0Xu/16qkgM7AdDOSTKmnd5AAgGBkt8gAZiau15fE7p65I5TJmZ7ZAHsPlcnCSOTWMAPsuxugNBK6JyIkAcgsACGqOzPvbmbuzzurBoyMVSUNiQjOtB9pd0dGZO69qwqIyjUjKfbeERxqGmutPGsRkqQB6M9BoHt/vV4kP/c9M0BU1RB7Wj0kiZC0tatC3RxBM7uDASa5MDMzQ0SFWjM7EoDe9+fH10v+jwESCZJJpKSq6r1HE4zMnJmmmAlgT5MgICIUAZIhDSkyiZJEJklR3bt7Sz0anwSIQEgMFoDRHiI0QACYBggFJRGYmStXT5MDiCFAM0NSsyESnBkAyQBH0iBGCCIz1HuCFPyHTFJkCBRERGZK8ieQjAgSErolEREAGIxMAWAAkkZBIrqngjNdFVAzQxr1MGJ6CPUenR0lEaOOCLVIzGwf4IgAyBEJkhgyY2ZWFsl7bxDPIcyGMMKoIiQJoARAJMmRWoPgdFdwIAQkEPR3ZLCyJO09UIAbAAfJYmb3HaAkCREx2uLklaEAxp8wHABUQKyoaZAx0wIERJAUMl716m4ArCQZipYGguMICQGkIEnhRU7MDMXMmhkMQyDP5gLo2RHsPQCzuPdeK7vb//25qjrXENHdRUrKKk1rZjBDhOBfSpJkS6Mh6Yfb6sjEAD1NNnh/bkV87k3yj7//g8J+f+6fP3vvCN393vcGYvoeTGbuu33drtdSD0YkpkUA
<?php
// refining the query
User::search('tisuchi')->where('is_active', '=', 1)->get();
User::search('tisuchi')->latest()->get();
User::search('tisuchi')->paginate();
<?php
class User extends Authenticatable
{
use FullTextSearch;
<?php
namespace App;
trait FullTextSearch
{
/**
* Replaces spaces with full text search wildcards
*
* @param string $term
<?php
/**
* The columns of the full text index
*/
protected $searchable = [
'first_name',
'last_name',
@tisuchi
tisuchi / Laravel-request-to-array.php
Created May 18, 2018 04:57
How to add values to Request array in Laravel
<?php
function store(Request $request)
{
$valueYouWantToAdd = "Your some data";
$request->request->add(['arrayKeyName' => $valueYouWantToAdd]);
//now return to check whether working or not
return $request->all();
@tisuchi
tisuchi / pass-params-in-get-method.html
Created April 7, 2018 09:59
Laravel Vue-Resource pass parameter in Get Method
<script>
this.$http.get('api/products', {params: {page: page}} ).then(
function (response) {
//look into the routes file and format your response
this.$set('items', response.data.data.data);
this.$set('pagination', response.data.pagination);
}, function (error) {
// handle error