hello guys anyone could help me please, i am trying to make a component which will output some html by reading from modal "Word" by picking one entery randomly. so far i am able to make the part of randomly picking up and outputting using default.html via components onRun() method like this
public function onRun()
{
$this->test = 'Running Word of the day in Cro job ...';
$this->words = $this->loadWords();
}
/**
* Function to load words from the Word Model
* @use Yeoman\Wordbank\Models\Word
* @return Array [description]
*/
public function loadWords()
{
$query = Word::orderBy(DB::raw('RAND()'))->first();
return $query;
// return wordofday::renderPartial('word.htm');
}
i tried to setup cron job in plugin.php using registerSchedule method. I tried to call by making static method from component in cron job and used sendOutputTo( storage_path('app/testing.txt') ) to see if cron job will out put something but all in vain. I setup cron job in my virtual machine as well and i am using this command php /var//www/public/artisan schedule:run to see if something will output but i also see in response of the command "Running scheduled command: Closure" but nothing in app/testing.txt file. My plugin.php is containing this
public function registerSchedule($schedule)
{
// $schedule->call('Yeoman\Wordbank\Components\Wordofday@loadWords')
// ->everyMinute()
// ->sendOutPutTo( storage_path('app/testing.txt') );
//
$schedule->call(function() {
// wordofday::loadWords();
$wordofday = new wordofday;
$wordofday->loadWords();
// $Wordofday = new Wordofday;
// $Wordofday->loadWords();
})
->everyMinute()
->sendOutputTo( storage_path('app/testing.txt') );
}
anyone could give me direction or idea how to make a component which will daily pick a random entry from my "word modal" and output it on daily bases. I don't know where to go from here....:/