# shiftcontroller/4.9.85/sh4/shifts/controller/publish.php

ShiftController Employee Shift Scheduling, version 4.9.85. 30 lines.

- Page: https://pluginprobe.com/plugins/shiftcontroller/4.9.85/code/sh4/shifts/controller/publish.php
- Raw: https://pluginprobe.com/plugins/shiftcontroller/4.9.85/raw/sh4/shifts/controller/publish.php
- Modified: 2023-05-29T12:46:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shiftcontroller/4.9.85/code/sh4/shifts/controller/publish.php#L10-L20`.

```php
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
#[AllowDynamicProperties]
class SH4_Shifts_Controller_Publish
{
	public function __construct(
		HC3_Hooks $hooks,
		HC3_Post $post,

		SH4_Shifts_Query $shiftsQuery,
		SH4_Shifts_Command $shiftsCommand
		)
	{
		$this->post = $post;
		$this->shiftsQuery = $hooks->wrap( $shiftsQuery );
		$this->shiftsCommand = $hooks->wrap( $shiftsCommand );
	}

	public function execute( $id )
	{
		$model = $this->shiftsQuery->findById( $id );

		$this->shiftsCommand->publish( $model );

		$date = $model->getDateStart();
		$to = 'schedule';

		$return = array( $to, '__Shift Published__' );
		return $return;
	}
}
```
