Laravel သည်တီထွင်ဖန်တီးသူများအားနေ့စဉ်အလုပ်များကိုပိုမိုလွယ်ကူစွာစီမံရန်အတွက် Laravel တွင်တည်ဆောက်ထားသည့်လက်တွေ့ကျသော PHP framework ဖြစ်သည်။ ၎င်းတို့အနက်အချိန်ဇယားလုပ်ငန်းလုပ်ငန်းသည်အထူးသဖြင့်လက်တွေ့ကျသည်, system ကိုသတ်မှတ်ထားသည့်ကာလအတွင်း systems သို့မဟုတ် command များကိုအလိုအလျောက်အကောင်အထည်ဖော်ရန်ခွင့်ပြုသည်။ ဤဆောင်းပါးသည် Laravel တွင်အချိန်ကိုက်အလုပ်များကိုအကောင်အထည်ဖော်ရန်အတွက်ပင်မနည်းလမ်းများကို အသုံးပြု. Periodab Task Scheduleing ကိုအကောင်အထည်ဖော်ရန်အတွက် cromperab tool ကို အသုံးပြု. Laravel မှပေးသောလုပ်ငန်းခွင်စာသင်ခန်းများမှတဆင့်ပြောင်းလွယ်ပြင်လွယ်ဖွဲ့စည်းပုံအခြေခံဥပဒေကိုအသုံးပြုသည်။
Crostab သည် Linux Systems ရှိ Task Management Tool ကို scripts သို့မဟုတ် command များကို periods or command များကိုထောက်ပံ့သည်။ Laravel တွင် Laravel's command tasks များကိုအစပျိုးရန် Crontab ကိုသုံးနိုင်သည်။ အောက်ပါတို့သည်တိကျသောစစ်ဆင်ရေးခြေလှမ်းများဖြစ်သည်။
Artisan command ကို execute မှ execute လုပ်ရန် Laravel Project ၏ရင်းမြစ်မှ root directory တွင် shell screen file တစ်ခုဖန်တီးပါ ။
#!/bin/bash
cd /path/to/project && php artisan my:task
Laravel command ကိုပုံမှန်ဟုခေါ်သော Pather root directory ကိုမှန်ကန်စွာညွှန်ပြရန်လမ်းကြောင်းကိုမှန်ကန်စွာညွှန်ပြရန်သေချာအောင်လုပ်ပါ။
အောက်ပါ command များကို terminal မှတဆင့် cromab တည်းဖြတ်ခြင်း mode ကိုရိုက်ထည့်ပါ။
<span class="fun">Crostab -e</span>
အောက်ပါ task scheduling configuration ကိုဖွင့်ထားသည့်အယ်ဒီတာသို့ထည့်ပါ။
<span class="fun">* / 10 * * * * * / wathpath/to/test.sh >> /path/to/Log/Log/TATOG/Contab.Log 2> & 1</span>
အထက်ဖော်ပြပါပြင်ဆင်မှုဆိုသည်မှာ Test.sh script.sh script ကို 10 မိနစ်တိုင်းကွပ်မျက်ခံရပြီး output ရလဒ်များကို log file သို့ထည့်သွင်းထားသည်။
Laravel သည် developer များက artisan commands များမှတဆင့် task level command များမှတဆင့် task ည့်သည်ကြိမ်နှုန်းဖြင့်ပြောင်းလွယ်ပြင်သည်
Add Task Command Scheduling Logic app / console / kernel.php ဖိုင်တွင်ကျန်းမာရေးယုတ္တိဗေဒဆိုင်ရာယုတ္တိဗေဒ။
// တိုင်းနှစ်မိနစ်လုပ်ဆောင်ပါ my:task အမိန့်
$schedule->command('my:task')->everyTwoMinutes();
ဤကုဒ်သည်နှစ်မိနစ်တိုင်းအစပျိုးထားသော Laravel command task တစ်ခုဖြစ်ပါတယ်။
Schedule configuration ကို kernel အတန်းအစား အချိန်ဇယား နည်းလမ်းသို့ထည့်ပါ။
protected function schedule(Schedule $schedule)
{
$schedule->command('my:task')->everyTwoMinutes();
}
ဤနည်းအားဖြင့် Laravel သည်သတ်မှတ်ထားသည့်ကြိမ်နှုန်းအရအလုပ်လုပ်ကိုင်ခွင့်ကိုအလိုအလျောက်စီစဉ်လိမ့်မည်။
Scheduler ကိုတစ်ပြိုင်တည်း နှိပ်. အောက်ပါ command ကိုသုံးပါ။
<span class="fun">PHP artisan ဇယား: Run</span>
Laravel သည်စံသတ်မှတ်ချက်များနှင့်ကိုက်ညီသောအချိန်ကိုက်အလုပ်များကိုစစ်ဆေးသည်။
ဤဆောင်းပါးတွင်မိတ်ဆက်နည်းစနစ်နှစ်ခုမှတစ်ဆင့် developer များက Laravel application များတွင်အချိန်ကာလလိုအပ်ချက်များကိုပြောင်းလဲစေနိုင်သည်။ Laravel's Scheduling Clates များသည်ပိုမိုကောင်းမွန်သောအစွမ်းသတ္တိနှင့်စီးပွားရေး ဦး စားပေးစီစဉ်ထားသည့်ထိန်းချုပ်မှုကိုထောက်ပံ့ပေးသည့်စနစ်အဆင့်တွင်ပုံမှန်စီစဉ်ခြင်းနှင့်ကိုက်ညီရန် crontab ကိုသုံးပါ။ အမှန်တကယ် application တစ်ခုအပေါ် အခြေခံ. အသင့်တော်ဆုံးအကောင်အထည်ဖော်မှုနည်းလမ်းကိုရွေးချယ်ရန်အကြံပြုသည်။