本文整理汇总了PHP中Task::fill方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::fill方法的具体用法?PHP Task::fill怎么用?PHP Task::fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Task
的用法示例。
在下文中一共展示了Task::fill方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createtask_POST
function createtask_POST(Web &$w)
{
$w->Task->navigation($w, "Create Task");
// unserialise input from step I and store in array: arr_req
$arr_req = unserialize($w->request('formone'));
// set relevant dt variables with: Today.
$arr_req['dt_assigned'] = Date('c');
$arr_req['dt_first_assigned'] = Date('c');
// insert Task into database
$task = new Task($w);
$task->fill($arr_req);
$task->insert();
// if insert is successful, store additional fields as task data
// we do not want to store data from step I, the task_id (as a key=>value pair) nor the FLOW_SID
if ($task->id) {
foreach ($_POST as $name => $value) {
if ($name != "formone" && $name != "FLOW_SID" && $name != "task_id" && $name !== CSRF::getTokenID()) {
$tdata = new TaskData($w);
$arr = array("task_id" => $task->id, "key" => $name, "value" => $value);
$tdata->fill($arr);
$tdata->insert();
unset($arr);
}
}
// return to task dashboard
$w->msg("Task " . $task->title . " added", "/task/viewtask/" . $task->id);
} else {
// if task insert was unsuccessful, say as much
$w->msg("The Task could not be created. Please inform the IT Group", "/task/index/");
}
}
示例2: update
/**
* Update the specified resource in storage.
* PUT /tasks/{id}
*
* @param Project $project, Task $task
* @return Response
*/
public function update(Project $project, Task $task)
{
$input = array_except(Input::all(), '_method');
$task->fill($input);
if ($task->updateUniques()) {
return Redirect::route('projects.tasks.show', [$project->slug, $task->slug])->with('message', 'Task updated.');
} else {
return Redirect::route('projects.tasks.edit', [$project->slug, array_get($task->getOriginal(), 'slug')])->withInput()->withErrors($task->errors());
}
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$task = new Task();
$task->unguard();
$task->fill(Input::only(['name', 'user_id', 'description', 'status']));
$task->deadline = new DateTime(Input::get('deadline'));
if ($task->validate()) {
$task->save();
} else {
return View::make('tasks.edit', ['task' => $task])->withErrors($task->validator());
}
return Redirect::to(route('tasks.index'))->with('message', ['content' => 'Taak met succes aangemaakt!', 'class' => 'success']);
}
示例4: Project
<?php
# new_task.php
# 1. logic
$project = new Project();
$project->load(['slug' => Route::param('slug')]);
if (Input::posted()) {
$task = new Task();
$task->fill(Input::all());
$task->user_id = Auth::user_id();
$task->project_id = $project->id;
if (Input::get('name') != "" || Input::get('description') != "") {
$task->save();
}
}
URL::redirect('/' . $project->slug);