class PostController extends Controller
{
public $postJobReturn;
public function create()
{
//
$data = new PostFormFields($this);
$this->dispatch($data);
$result = $this->postJobReturn;
dd($result);
return view('admin.post.create',$data);
}
Class job {
public function __construct(Controller $controller,$id = null)
{
$this->id = $id;
$this->controller = $controller;
}
public function handle()
{
$fields = $this->fieldList;
if ($this->id) {
$fields = $this->fieldsFromModel($this->id, $fields);
} else {
$when = Carbon::now()->addHour();
$fields['publish_date'] = $when->format('M-j-Y');
$fields['publish_time'] = $when->format('g:i A');
}
foreach ($fields as $fieldName => $fieldValue) {
$fields[$fieldName] = old($fieldName, $fieldValue);
}
$this->controller->postJobReturn = array_merge(
$fields,
['allTags' => Tag::lists('tag')->all()]
);
}
}