Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Jobs;
- use Illuminate\Bus\Queueable;
- use Illuminate\Queue\SerializesModels;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use App\Product;
- class CheckAndSendAccount implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- /**
- * Create a new job instance.
- *
- * @return void
- */
- public function __construct()
- {
- //
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- $products = Product::with('product_bodies')->get();
- foreach ($products as $product) {
- foreach ($product->product_bodies as $prod) {
- $res = $this->checkAccountData($prod->product_body);
- if (!$res) {
- $prod->delete();
- }
- }
- }
- }
- public function checkAccountData($data)
- {
- $login = explode(':', $data)[0];
- $password = explode(':', $data)[1];
- $result = @file_get_contents("https://oauth.vk.com/token?grant_type=password&client_id=2274003&client_secret=hHbZxrka2uZ6jB1inYsH&username={$login}&password={$password}");
- return $result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement