How to run crontab job every week on Sunday

Here is an explanation of the crontab format.

# 1. Entry: Minute when the process will be started [0-60]
# 2. Entry: Hour when the process will be started [0-23]
# 3. Entry: Day of the month when the process will be started [1-28/29/30/31]
# 4. Entry: Month of the year when the process will be started [1-12]
# 5. Entry: Weekday when the process will be started [0-6] [0 is Sunday]
#
# all x min = */x

So according to this your 5 8 * * 0 would run 8:05 every Sunday.

30 18 * * * curl URL >/dev/null 2>&1
30 18 * * * curl URL >/dev/null 2>&1
30 18 * 1 * curl URL >/dev/null 2>&1
30 18 * * 1 curl URL >/dev/null 2>&1

Position 1 for minutes, allowed values are 1-60
position 2 for hours, allowed values are 1-24
position 3 for day of month ,allowed values are 1-31
position 4 for month ,allowed values are 1-12 
position 5 for day of week ,allowed values are 1-7 or and the day starts at Monday. 
crontab -e    for edit or add cron/scheduled job

crontab -l    for show list

how can i protect laravel api calling from other website

Access-Control-Allow-Origin https://mydomain.com/

 added a new middleware

<?php

namespace App\Http\Middleware;

use Closure;

class VerifyAPIAccess
{
    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if (
            !(App::environment('local'))
            && (
                !$request->header('access-token')
                || $request->header('access-token') !== env('APP_API_TOKEN')
            )
        ) {
            return response()->json(['Message' => 'You do not access to this api.'], 403);
        }

        return $next($request);
    }
}

and then added to my route

Route::group([
    'middleware' => [
        VerifyAPIAccess::class,
 	'throttle:60,1'
    ]
], function () {

// list some routes

});

you could also restrict access by adding throttling which would stop someone from hammering your API, with token or not.

There are probably many approaches. A simple but effective one would be sessions. You can save the user in a session. This way you can also count his Api accesses. As soon as they are larger than allowed, you can block their requests. You also write the block in the session. But pay attention to the session duration. It must be long enough.

But the user with bad intentions can get a new session. To avoid this, you can also put his IP on an internal blacklist for a day.

Note: But an open api is always a point of attack.

Things tried:

  • Using passport to protect my routes and then use passport’s CreateFreshApiToken middleware. Protection works fine, unauthorized users are not able to access the routes, however I don’t get laravel_token in my cookies and therefore I can’t get access to that route if I’m not logged in.
  • Use passport’s client credentials grant access. Works fine and the way I want it to work but doesn’t really make sense because if I hardcode the client_secret – anyone can access it and then use it to access protected routes. If I make a proxy-like solution, to call a controller method, which would issue a valid token and thus not exposing client_secret to front-end but then anyone could just call that route which issues the token and it would be pointless once again.

You cannot stop people from trying to access of publicly visible API. You need to secure the API and only respond to those with the proper access privileges. 

429 too many requests laravel 8

I stumbled upon the same problem today and did some debugging. When registering the /login route, Fortify applies the Illuminate\Routing\Middleware\ThrottleRequests:login middleware to it. This means, for every request to that route, the ThrottleRequests middleware will call the RateLimiter instance for that specified key. Apparently, Fortify doesn’t register a RateLimiter for the login key.

Due to the missing key in the $limiters property of the RateLimiter instance, the ThrottleRequests middleware uses its default fallback, which doesn’t handle the edge case “there SHOULD be a rate limiter for that key, but there isn’t.” really well. The $maxAttempts variable is set to 0 and will result in flaky rate limiting behaviour.

I feel like this is a bug in Fortify, because rate limiting is also happening in the \Laravel\Fortify\Actions\EnsureLoginIsNotThrottled action, which is invoked in the \Laravel\Fortify\Http\Controllers\AuthenticatedSessionController controller. I didn’t check this on a fresh Laravel installation, though, so I don’t want to jump to conclusions here.

Anyway, long story short: As a workaround, you can simply register a rate limiter for the “login” key in some of your providers, e. g. AppServiceProvider or AuthServiceProvider:

public function boot()
{
    RateLimiter::for("login", function () {
        Limit::perMinute(5);
    });
}

Edit: I just realized that the rate limiter for the “login” key is indeed provided by Fortify within the FortifyServiceProvider class. If you happen to have a problem similar to the one discussed above, make sure that you added the FortifyServiceProvider class to your providers array in the config/app.php.

source : stackoverflow

use of binding in kernel laravel 8

Route Model Binding

When injecting a model ID to a route or controller action, you will often query the database to retrieve the model that corresponds to that ID. Laravel route model binding provides a convenient way to automatically inject the model instances directly into your routes. For example, instead of injecting a user’s ID, you can inject the entire User model instance that matches the given ID.

Implicit Binding

Laravel automatically resolves Eloquent models defined in routes or controller actions whose type-hinted variable names match a route segment name. For example:

use App\Models\User;
 
Route::get('/users/{user}', function (User $user) {
    return $user->email;
});

Since the $user variable is type-hinted as the App\Models\User Eloquent model and the variable name matches the {user} URI segment, Laravel will automatically inject the model instance that has an ID matching the corresponding value from the request URI. If a matching model instance is not found in the database, a 404 HTTP response will automatically be generated.

Of course, implicit binding is also possible when using controller methods. Again, note the {user} URI segment matches the $user variable in the controller which contains an App\Models\User type-hint:

use App\Http\Controllers\UserController;
use App\Models\User;
 
// Route definition...
Route::get('/users/{user}', [UserController::class, 'show']);
 
// Controller method definition...
public function show(User $user)
{
    return view('user.profile', ['user' => $user]);
}

uno r3 board

Arduino UNO is the widely used microcontroller board for developing different kind of projects and prototypes. This small development board has all the features of its native IC Atmega328p with additional features. This comes with on board programmer cp2102, so no need to connect external programmer. Arduino Uno board has 12V DC barrel jack which can accept upto 12V but use it for 9V Max. It has onboard LEDs to indicate power. The IC Atmega328p is removable, so if the Atmega IC is not working then it can be replaced with another one.

Arduino Uno Specifications:

  • Digital I / O digital input / output terminal: 0 to 13.
  • Analog I / O Analog inputs / outputs: 0 to 5.
  • Support ISP download function.
  • Output voltage: 5V / 3.3V DC.
  • Input voltage: No external power supply when connected to the computer
  • USB, external power supply 5V ~ 9V DC voltage input.

बिना इंटरनेट वाले फोन से भी पैसे ट्रांसफर हो सकेंगे

बिना इंटरनेट वाले सामान्य फोन से भी अब पैसे हस्तांतरित हो सकेंगे। भारतीय रिजर्व बैंक ने मंगलवार को देश के 40 करोड़ फीचर फोन उपयोगकर्ताओं को डिजिटल भुगतान की सौगात देते हुए यूपीआई 123 प सेवा शुरू की।

इस मौके पर रिजर्व बैंक के गवर्नर शक्तिकांत दास ने कहा कि अब तक यूपीआई की सेवा में मुख्य रूप से स्मार्ट फोन पर ही उपलब्ध है, जिसके चलते निचले तबके के लोग इनका इस्तेमाल नहीं कर पा रहे थे।

उन्होंने कहा कि वित्त वर्ष 2021 से 2022 में अब तक यूपीआई लेनदेन क्षेत्र लाख करोड रुपए तक पहुंच गया है, जबकि पिछले वित्त वर्ष में यह आंकड़ा 4100000 करोड रुपए था। आरबीआई के डिप्टी गवर्नर रविशंकर ने कहा कि नई सेवा यूपीआई 123 पे में चार तकनीक अपनाई गई है।

इसमें आईवीआर, आप जैसे कार्य नजदीक से आवाज के आधार पर भुगतान और मिस्ड कॉल का तरीका शामिल है।

इस तरह से किया जा सकता है भुगतान

आईवीआर

इंटरएक्टिव वॉइस रिस्पांस के तहत उपयोगकर्ता को एक खास नंबर पर कॉल करके भुगतान करने की सुविधा मिलेगी। नंबर एनपीसीआई की ओर से उपलब्ध कराया जाएगा।

ध्वनि

फीचर फोन धारक ध्वनि आधारित भुगतान कर सकेंगे। इसमें किसी भी उपकरण पर संपर्क रहित, ऑफलाइन और निकटता डाटा संचार को सक्षम करने के लिए ध्वनि तरंगों का उपयोग होता है।

ऐप

इसके तहत फीचर फोन में यूपीआई भुगतान के लिए एक ऐप इंस्टॉल किया जाएगा। इस एप से स्कैन एंड पेमेंट फीचर को छोड़कर सभी प्रकार के लेनदेन किए जा सकेंगे।

मिस्ड कॉल

इसमें भुगतान प्राप्त करने वाले के नंबर पर मिस्ड कॉल देनी होगी। इसके बाद भुगतान के लिए वापस कॉल आएगी। इस कॉल पर भुगतान करने वाले को यूपीआई पिन स्थापित करना होगा।

जानिए क्या होता है फीचर फोन

फीचर फोन को सामान्य मोबाइल फोन भी कहा जाता है। इस फोन में सिर्फ कॉल करने कॉल रिसीव करने मैसेज भेजने और प्राप्त करने की सुविधा होती है। एक अनुमान के अनुसार आज भी देश की बड़ी आबादी फीचर फोन का इस्तेमाल करती है।

पेरू में 1000 साल पुरानी मम्मी की खोज

पेरू में 1000 साल पुरानी मम्मी के कुछ ऐसे अवशेष मिले हैं जिनसे पता चलता है कि उस समय वहां पर बच्चों की बलि दी जाती थी। यह एक पुरुष की मम्मी बताई जा रही है।

दरअसल लीमा से बाहर काजारमारकिला शहर में सदियों पुरानी एक मम्मी मिली। यह मम्मी घुटने को मोड़ कर लेटी हुई थी। इस मम्मी के मिलने की खबर पूरी दुनिया में चर्चा का विषय बन गई थी। जब यह मम्मी मिली तब यह माना जा रहा था कि मौत के समय इस पुरुष की उम्र करीब 18 से 22 साल के बीच रही होगी लेकिन बाद में जांच करके पता चला कि जब इसकी मम्मी बनाई गई तब यह करीब 35 साल का था। आरके लॉजिस्टिक मम्मी का नाम जब बेलो रखा है। बताया गया कि जब वे लोग के आसपास खनन का काम जारी था। इस बीच 8 बच्चों के अवशेष मिले जो अंतिम संस्कार की विधियों के तहत गोरे और रस्सियों में लिपटे हुए थे। इसके अलावा 12 बच्चों के कंकाल भी मिले हैं।

राजस्थान के एक शख्स ने चांद पर खरीदा प्लॉट

धरती पर घर बनाने के लिए जमीन खरीदना हर किसी का ख्वाब हो सकता है, लेकिन अगर चांद पर जमीन खरीदी जाए तो उसकी चर्चा होना लाजमी है। राजस्थान के झुंझुनू जिले के एक शख्स ने चांद पर 14 एकड़ जमीन खरीदी है।

व्यवसाई ओमप्रकाश जांगिड़ चांद पर इससे पहले 2012 में भी जमीन खरीदी थी जो 3 एकड़ थी। यह 3 एकड़ जमीन से ऑफ़ मस को भी मेथी। सी ऑफ मॉस्को वी में ही दिवंगत अभिनेता सुशांत राजपूत की जमीन भी है। इसके बाद उन्होंने 11 एकड़ जमीन 2018 में खरीदी थी, जिनके कागजात हाल ही में उन्हें मिले हैं। ओमप्रकाश ने बताया कि वह और उनका बेटा अभिलाष 2012 में अमेरिका में थे, उस समय यूएस में भूमि इंटरनेशनल लूनर लेंस से चांद पर जमीन खरीदी जा रही थी। इसी समय उन्होंने आवेदन किया था।

ट्रेन को टक्कर से बचाने का कवच सफल

पटरी पर सामने खड़े इंजन से 300 मीटर पहले लगी ऑटोमेटिक ब्रेक

दक्षिण मध्य रेलवे के लोको पायलट जी एच प्रसाद को शुक्रवार का दिन जीवन भर याद रहेगा।

वह ट्रेन के इंजन में रेल मंत्री अश्विनी वैष्णव और रेलवे के वरिष्ठ अधिकारियों को बिठाकर 100 किलोमीटर प्रति घंटे की रफ्तार पर हैदराबाद से मुंबई रेलवे मार्ग पर तेजी से बढ़े जा रहे थे।

मगर जिस पटरी पर यह ट्रेन चल रही थी उसी पर गलागुड्डा सेक्शन के पास एक दूसरी ट्रेन का इंजन खड़ा था। पर लोको पायलट को ब्रेक नहीं लगाने के निर्देश हैं। दूसरी ट्रेन के इंजन से 300 मीटर पहले ही कवच प्रणाली में इस ट्रेन में ऑटोमेटिक ब्रेक लगा दी। यह देख कर लोको पायलट की जान में जान आई। उनके मुंह से निकला ट्रेन की टक्कर नहीं हुई, यानी कवच सफल रहा।

हादसे रोकने में मदद मिलेगी

टेलीकॉम इंजीनियर प्रिया ने रेल मंत्री से कहा कि यह प्रणाली 60,000 से अधिक लोको पायलट के लिए एक तोहफा है। अश्विनी वैष्णव ने बताया कि प्रधानमंत्री नरेंद्र मोदी के आत्मनिर्भर भारत अभियान के तहत कवच तकनीक का विकास किया गया है। यह तकनीक ट्रेन की टक्कर होने की घटनाएं रोकेगी। इस प्रणाली के तहत रेलवे क्रॉसिंग पर ऑटोमेटिक हरण बजेगा वेस्टेड कम होगी इंजन के भीतर ही 2 से 3 किलोमीटर सिग्नल को देखा जा सकेगा।

यूरोपियन तकनीक से सस्ती है यह प्रणाली

यूरोपियन तकनीक में एक से डेढ़ करोड़ रुपए प्रति किलोमीटर के खर्च आता है कोमा जबकि कवच में 40 से 50 लाख रुपए प्रति किलो मीटर का खर्च आएगा। 180 किलोमीटर की रफ्तार पर कवच सफल रहा।

कवच की विशेषताएं

  • ओवरस्पीडिंग को रोकने के लिए प्रातः ब्रेक लग जाती है
  • समपार फाटक के पास पहुंचते समय स्वता सिटी बस जाएगी
  • सिग्नल खतरे की स्थिति में पार करने से रोकेगा
  • आपात स्थिति के दौरान एसओएस संदेश भेजेंगा
  • नेटवर्क मॉनिटर प्रणाली से ट्रेन परिचालन की केंद्रीकृत जीवंत निगरानी हो सकेगी

how to existing apps assign to business manager

How to add an app in business manager?Add apps to your Business Manager

  1. Open Business settings.
  2. Under Accounts, click Apps.
  3. Click the blue Add drop-down menu.
  4. Select whether you want to Connect an app ID or Request access to an app ID.
  5. Enter the Facebook app ID.
  6. Click Add app or Request app.

Get System User Access Token in WhatsApp

Graph API calls use access tokens for authentication. For more information, see Access Tokens. We recommend using your system user to generate your token.

To generate a system user access token:

  1. Go to Business Manager > Business Settings > Users > System Users to view the system user you created.
  2. Click on that user and select Add Assets. This action launches a new window.
  3. Under Select Asset Type on the left side pane, select Apps. Under Select Assets (in the middle pane), choose the Meta app you want to use (your app must have the correct permissions). Enable Develop App for that app.
  4. Select Save Changes to save your settings and return to the system user main screen.
  5. Now you are ready to generate your token. Still on the system user main screen, click Generate Token and, again, select your Meta app. After selecting the app, you see a list of available permissions. Select whatsapp_business_management and whatsapp_business_messaging and click Generate Token.
  6. A new window opens with your system user, assigned app and access token. Save your token.
  7. Optionally, you can click on your token and see the Token Debugger. In your debugger, you should see the two permissions you have selected. You can also directly paste your token into the Access Token Debugger.

Get Started WhatsApp Business API

This step-by-step tutorial provides information on how to send your first message. See Before You Start to get a list of the assets you need to have before completing this tutorial.

This guide is divided into three stages:

  • Stage 1: Prepare – First, get the access token you need to use in all of the following API calls. Then, you set up your Webhooks and subscribe to your WABA. Finally, get a phone number’s ID and register it.
  • Stage 2: Enable the customer service window – When certain customers send a message to a business, that business gets 24 hours of free messages with them. For testing purposes, we want to enable this window, so you can send as many messages as you would like. To do that, send a test message from the consumer app to the phone number you just registered. Once the message is received, you get a Webhook notification with that number’s WhatsApp ID.
  • Stage 3: Send a message – With a registered phone number, a system user access token, and the WhatsApp ID or the phone number for the person you want to reach, you can send your first message.

If you are a Business Service Provider (BSP), you need to have Embedded Sign Up integrated to use the Cloud API. For more information, see Embedded Signup Overview.

Before You Start

Businesses setting up their integration need to have the following assets:

AssetSpecific Instructions
Business ManagerYou can use an existing, or set up a new one. Save the Business Manager ID.
WhatsApp Business Account (WABA)See Create a WhatsApp Business Account for the WhatsApp Business API for help.
Meta AppIf you don’t have an app, you need to create one with the “Business” type. Remember to add a display name and a contact email to your app.
Your app must go through App Review and request Advanced Access to the following permissions:whatsapp_business_management — Used to manage phone numbers, message templates, registration, business profile under a WhatsApp Business Account. To get this permission, your app must go through App Review.whatsapp_business_messaging — Used to send/receive messages from WhatsApp users, upload/download media under a WhatsApp Business Account. To get access to this permission, reach out to your representative and provide your Meta app ID.If you’re working as a BSP (Business Solution Provider), feel free to use the same Meta app across different clients and WABAs. But be aware that each app can only have one webhook endpoint.
System UserSee Add System Users to Your Business Manager for help.
Currently, a Meta App with whatsapp_business_messaging and whatsapp_business_management permissions has access to up to:1 admin system user, and1 employee system userWe recommend using the admin system user for your production deployment. See About Business Manager Roles and Permissions for more information.
Business Phone NumberThis is the phone number the business will use to send messages. Businesses must use a test phone number for this release.
Use your existing WhatsApp Manager to add a phone number. Phone numbers need to be verified through SMS/voice call, either through Embedded Signup flow or manual verification. You cannot verify your phone with Graph API.
The verification status of a phone number doesn’t impact the migration between On-Premises and Cloud API. If you don’t have access to Embedded Signup to verify phone numbers, we recommend verifying the phone numbers using the On-Premises solution, and then migrating those numbers to the Cloud API.
There is no limit to the amount of business phone numbers that can be onboarded to the Cloud API.
A single phone number can only be used on one platform at a time: One phone number for Cloud API and another number for On-Premises. This means that you cannot use a production phone number with both the On-Premises and Cloud APIs. We recommend doing any testing with a test number (either an existing test number or a new one) and then moving your own phone number to the Cloud API when you’re confident you’re ready for production use.
Consumer Phone NumberThis is a phone number that is currently using the consumer WhatsApp app. This number will be receiving the messages sent by your business phone number.

Step 1: Get System User Access Token

Graph API calls use access tokens for authentication. For more information, see Access Tokens. We recommend using your system user to generate your token.

To generate a system user access token:

  1. Go to Business Manager > Business Settings > Users > System Users to view the system user you created.
  2. Click on that user and select Add Assets. This action launches a new window.
  3. Under Select Asset Type on the left side pane, select Apps. Under Select Assets (in the middle pane), choose the Meta app you want to use (your app must have the correct permissions). Enable Develop App for that app.
  4. Select Save Changes to save your settings and return to the system user main screen.
  5. Now you are ready to generate your token. Still on the system user main screen, click Generate Token and, again, select your Meta app. After selecting the app, you see a list of available permissions. Select whatsapp_business_management and whatsapp_business_messaging and click Generate Token.
  6. A new window opens with your system user, assigned app and access token. Save your token.
  7. Optionally, you can click on your token and see the Token Debugger. In your debugger, you should see the two permissions you have selected. You can also directly paste your token into the Access Token Debugger.

Step 2: Set up Webhooks

With Webhooks set up, you can receive real-time HTTP notifications from the WhatsApp Business Platform. This means you get notified when, for example, you get a message from a customer or there are changes to your WhatsApp Business Account (WABA).

To set up your Webhook, you need to create an internet-facing web server with a URL that meets Meta’s and WhatsApp’s requirements. See Creating an Endpoint for instructions on how to do that. If you need an endpoint for testing purposes, you can generate a test Webhooks endpoint.

App Setup

Once the endpoint is ready, configure it to be used by your Meta app:

In your App Dashboard, find the WhatsApp product and click Settings. Scroll down until you find the webhooks section and click Configure a webhook. After the click, a dialog appears on your screen and asks you for two items:

  • A callback URL: This is the URL Facebook will be sending the events to. See the Webhooks, Getting Started guide for information on creating the URL.
  • A verification token.

After adding the information, click Verify and Save.

Back in the settings section of your App Dashboard, you will see the Webhooks section has been updated with the information you just provided. Under the callback URL and the token, you will see the Webhook fields —those are the fields you want to get in your webhook notifications.

Under Webhook fields, click Manage. A dialog box will appear with all the current fields. Click Subscribe for the fields you want to be included in your notifications.

You only need to set up Webhooks once for every application you have. You can use the same Webhook to receive multiple event types from multiple WhatsApp Business Accounts. For more information, see our Webhooks section.