Welcome Guest, Not a member yet? Register   Sign In
task scheduler
#1

Hello everyone,

So I am trying to create a task by using PHP library lavary/crunz

and I have set it up with Codeigniter but I am facing a little issue and I can't find it on the internet or may I am searching by the right keyword but anyways here is the issue

I have created my task file into project/application/libraries/tasks filename FirstTasks.php

PHP Code:
<?php
/**
 * Created by PhpStorm.
 * User: MubashirKhan
 * Date: 15-Mar-20
 * Time: 3:29 AM
 */

use Crunz\Schedule;


$noticeJobObj = new NoticeJob();
$task $schedule->run(function () use ($noticeJobObj){
    $noticeJobObj->index();
});
$task
    
->everyMinute()
    ->description('Copying the project directory')
    ->appendOutputTo('output.log');

return 
$schedule

in the above code I initialize NoticeJob which is located into project/application/libraries/ filename NoticeJob.php and it is a plan class like writing a new library

PHP Code:
<?php
/**
 * Created by PhpStorm.
 * User: MubashirKhan
 * Date: 17-Mar-20
 * Time: 2:44 AM
 */

class NoticeJob
{
    public function index()
    {
        echo "hellow world";
    }



now I want to call this class function into my task file which is just a php script

and as you see I have already tried to call it.

can any help me into this ?

please let me know if you need more information

Thank you
Reply




Theme © iAndrew 2016 - Forum software by © MyBB