PHP code example of tristanward / laravel-workable

1. Go to this page and download the library: Download tristanward/laravel-workable library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tristanward / laravel-workable example snippets


// App/Console/Kernel.php

use Tristanward\LaravelWorkable\Console\LaravelWorkableCache;

protected $commands = [
    ...
    LaravelWorkableCache::class,
];

protected function schedule(Schedule $schedule)
{
    ...
    $schedule->command('laravel-workable:cache')
        ->sundays()
        ->at('03:00');
}



use Tristanward\LaravelWorkable\Models\WorkableVacancy;

// Get all cached Workable vacancies
$vacancies = WorkableVacancy::all();

// Get an array of all unique vacancy locations
$locations = WorkableVacancy::uniqueLocations();

// Get an array of all unique vacancy positions
$positions = WorkableVacancy::uniquePositions();



use Tristanward\LaravelWorkable\Facades\LaravelWorkable;

// Get all published workable vacancies
$vacancies = LaravelWorkable::vacancies();

// Alternatively, a state may be provided
$vacancies = LaravelWorkable::vacancies($state = 'draft');

// Full data for a single vacancy can be accessed with it's $shortcode
$vacancy = LaravelWorkable::vacancy($shortcode = 'ABCDEFGHIJ');

php artisan migrate

php artisan laravel-workable:cache