Skip to content

Instantly share code, notes, and snippets.

@joshforbes
Last active April 29, 2017 01:57
Show Gist options
  • Save joshforbes/dda2c5af7074c04ad49d739b99964514 to your computer and use it in GitHub Desktop.
Save joshforbes/dda2c5af7074c04ad49d739b99964514 to your computer and use it in GitHub Desktop.
<?php
public function open()
{
if ($this->publishable_type === 'credit') {
// verify credit is available and anything else that
// needs to be done before a credit job is opened
} elseif ($this->publishable_type === 'daily) {
// charge credit card or anything that needs to be
// done before a daily job is opened
} elseif ($this->publishable_type === 'plan' {
// an elseif for any other types
}
$this->status = 'open';
$this->save();
// and any other code that has to be executed when a job is
// opened regardless of which publishable type is chosen
if ($this->publishable_type === 'credit') {
// assign credit to job
} elseif ($this->publishable_type === 'daily) {
// whatever needs to be done for daily job
} elseif ($this->publishable_type === 'plan' {
// an elseif for any other types
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment