예제 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $instagram = new InstagramAPI();
     foreach (\App\Supplier::all() as $supplier) {
         $instagram->setAccessToken($supplier->instagramAccount->access_token);
         foreach ($supplier->products()->where('is_active', true)->get() as $product) {
             $comments = $instagram->getMediaComments($product->instagram->id);
             if ($comments->meta->code == 200) {
                 $lastScannedComment = null;
                 for ($i = count($comments->data) - 1; $i >= 0; $i--) {
                     $comment = $comments->data[$i];
                     if ($lastScannedComment == null) {
                         $lastScannedComment = $comment->id;
                     }
                     if ($product->instagram->last_scanned_comment >= $comment->id) {
                         break;
                     }
                     if (strpos(mb_strtolower($comment->text, 'UTF-8'), 'sepete at') !== false) {
                         if ($customer = \App\InstagramAccount::where('instagram_id', $comment->from->id)->first()) {
                             if ($customer->isCustomer()) {
                                 $customer = $customer->instagramable;
                                 \App\WishedProduct::create(['customer_id' => $customer->id, 'product_id' => $product->id, 'count' => 1]);
                             }
                         }
                     }
                 }
                 if ($lastScannedComment != null) {
                     $productInstagram = $product->instagram;
                     $productInstagram->last_scanned_comment = $lastScannedComment;
                     $productInstagram->update();
                 }
             }
         }
     }
 }
예제 #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $suppliers = Supplier::all();
     $ingredients = Ingredient::all();
     $supplyorder = Supplyorder::find($id);
     return view('supplyorder.show', ['supplyorder' => $supplyorder, 'ingredients' => $ingredients, 'suppliers' => $suppliers]);
 }
예제 #3
0
 public function index()
 {
     $modele = Modeles::with('category', 'brand')->get();
     $supp = Supplier::all();
     $articles_modeles = Article::with('theModels.brand', 'theModels.category', 'supplier')->get();
     $leftmenu['model'] = 'active';
     $leftmenu['model_article'] = 'active';
     if (isset($_GET['sel_modele'])) {
         $response = ['leftmenu' => $leftmenu, 'modeles' => $modele, 'article_modele' => $articles_modeles, 'suppliers' => $supp, 'selection' => $_GET['sel_modele']];
     } else {
         $response = ['leftmenu' => $leftmenu, 'modeles' => $modele, 'article_modele' => $articles_modeles, 'suppliers' => $supp];
     }
     return view('/articles/index', $response);
 }
예제 #4
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $suppliers = Supplier::all();
     return view('supplier.home', compact('suppliers'));
 }
예제 #5
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $suppliers = Supplier::all();
     $ingredient = Ingredient::find($id);
     return view('ingredient.edit', ['ingredient' => $ingredient, 'suppliers' => $suppliers]);
 }
예제 #6
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $suppliers = Supplier::all();
     return view('admin.suppliers.index', compact('suppliers'));
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $suppliers = Supplier::all()->sortBy('supplier_name');
     return view('suppliers.index', compact('suppliers'));
 }
예제 #8
0
  $(".supplierChangeB1").change(function(a){
    var searcher = a.currentTarget.value;
    var supplierChange = ".supplierBTerms1";
    var suppliers = <?php 
echo Supplier::all()->lists('payment_terms', 'id');
?>
;
    $(supplierChange).text(suppliers[searcher]);
  });

  $(".supplierChangeC1").change(function(a){
    var searcher = a.currentTarget.value;
    var supplierChange = ".supplierCTerms1";
    var suppliers = <?php 
echo Supplier::all()->lists('payment_terms', 'id');
?>
;
    $(supplierChange).text(suppliers[searcher]);
  });

  $(".itemChange1").change(function(a){
    var searcher = a.currentTarget.value;
    var unitChange = ".itemUnit1";
    var items = <?php 
echo Item::all()->lists('unit', 'id');
?>
;
    $(unitChange).text(items[searcher]);
  });
예제 #9
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $suppliers = Supplier::all();
     return view('supplier.index')->with('supplier', $suppliers);
 }
예제 #10
0
 public function create($date, $s)
 {
     $suppliers = Supplier::all();
     $products = Product::where('supplier_id', '=', $s->id)->orderBy('name')->get();
     return view('instock.create', compact(['s', 'suppliers', 'products', 'date']));
 }
예제 #11
0
 public function index()
 {
     $supp = Supplier::all();
     $leftmenu['supplier'] = 'active';
     return view('/suppliers/index', ['suppliers' => $supp, 'leftmenu' => $leftmenu]);
 }
예제 #12
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $suppliers = Supplier::all();
     return view('supplier.index', ['suppliers' => $suppliers]);
 }
예제 #13
0
 public function index()
 {
     // show all
     $records = Supplier::all();
     return $records;
 }
예제 #14
0
 public function createFile($id)
 {
     $users = User::all();
     $client = Client::where('id', $id)->get();
     $modele = Modeles::with('category', 'brand', 'articles')->get();
     $devices = Device::all();
     $articles = Article::all();
     $supp = Supplier::all();
     $categories = Category::all();
     $brands = Brand::all();
     $leftmenu['files'] = 'active';
     return view('/files/create-by-id', ['leftmenu' => $leftmenu, 'client' => $client[0], 'modeles' => $modele, 'devices' => $devices, 'articles' => $articles, 'suppliers' => $supp, 'categories' => $categories, 'brands' => $brands, 'users' => $users]);
 }
예제 #15
0
    // }, 'json');

    var items = <?php 
echo Item::all()->lists('unit', 'id');
?>
;
    $(unitChange).text(items[searcher]);

    $.get('getTopSuppliers', {item: searcher}, function(data){

      var terms = <?php 
echo Supplier::all()->lists('payment_terms', 'id');
?>
;
      var contact = <?php 
echo Supplier::all()->lists('telephone_number', 'id');
?>
;

      if (data[0]) {
        $(".supplierChange1").val(data[0].supplier_id);
        $(".itemPrice1").attr("placeholder", data[0].price);
        $(".lastUpdated1").text(data[0].date);
        $(".yesNo1").val(data[0].stock_availability);
        $(".supplierTerms1").text(terms[data[0].supplier_id]);
        $(".contact1").text(contact[data[0].supplier_id]);
      } else {
        $(".itemPrice1").attr("placeholder", "");
        $(".lastUpdated1").text('');
        $(".supplierTerms1").text('');
        $(".contact1").text('');
예제 #16
0
 public function quotation()
 {
     if (Auth::user()['role'] == 'Sales') {
         $clientOptions = Client::where('user_id', Auth::user()['id'])->lists('name', 'id');
     } else {
         $clientOptions = Client::all()->lists('name', 'id');
     }
     $supplierOptions = Supplier::all()->lists('name', 'id');
     $supplierOptions["none"] = "NONE";
     $supplierOptions1 = Supplier::all()->lists('name', 'id');
     $itemOptions = DB::table('items')->where('deleted_at', null)->orderBy('name', 'asc')->lists('name', 'id');
     return view('sales_invoices.quotation', compact('supplierOptions', 'itemOptions', 'clientOptions', 'supplierOptions1'));
 }
예제 #17
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $data['inventory'] = Inventory::find($id);
     $supplier = Supplier::all();
     return view('inventory.edit', $data)->with('supplier', $supplier);
 }
예제 #18
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show(Product $product)
 {
     $product_categories = ProductCategory::all();
     $suppliers = Supplier::all();
     $id = $product->id;
     $previous = Product::where('id', '<', $id)->max('id');
     $next = Product::where('id', '>', $id)->min('id');
     return view('product.show', compact(['product', 'next', 'previous']))->with('product_categories', $product_categories)->with('suppliers', $suppliers);
 }