本文整理汇总了PHP中app\Task::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::save方法的具体用法?PHP Task::save怎么用?PHP Task::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Task
的用法示例。
在下文中一共展示了Task::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetTaskAssignedUser
function testSetTaskAssignedUser()
{
$user = factory(User::class)->create(['name' => "simo"]);
$this->task->assignee()->associate($user);
$this->task->save();
$this->assertEquals('simo', $this->task->assignee->name);
$this->assertEquals(2, $this->task->activity->count());
$this->assertEquals('user_id', $this->task->activity->get(1)->type);
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(TaskRequest $request)
{
$request->merge(['user_id' => Sentinel::getUser()->id]);
$task = new Task($request->except('_token'));
$task->save();
return $task->id;
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$a = new Task();
$a->fill(\Input::all());
$a->save();
return redirect()->back();
}
示例4: createTask
public function createTask(Request $request)
{
$task = new Task();
$task->task_name = $request->get('task_name');
$task->save();
return redirect()->back();
}
示例5: addTask
/**
* 添加任务,返回id
* @param $name
*/
public static function addTask($name)
{
$model = new Task();
$model->name = $name;
$model->save();
return $model->id;
}
示例6: createTask
public function createTask(Request $request)
{
$user_roll = $request->input('user_roll');
$task_name = $request->input('task_name');
$team_id = $request->input('team_id');
if (!CheckLevel::check(2, NULL, $user_roll)) {
return JSONResponse::response(401);
}
//get user id
$user_id = User::where('user_roll', '=', $user_roll)->pluck('user_id');
$user = User::where('user_roll', '=', $user_roll)->first();
if ($user->user_type != 1 && $user->user_type != 0) {
$team_member = TeamMember::where('user_id', '=', $user_id)->where('team_id', '=', $team_id)->first();
if ($team_member == NULL) {
return JSONResponse::response(401);
}
}
$task = new Task();
$task->task_name = $task_name;
$task->task_completed = 0;
$task->team_id = $team_id;
$success = $task->save();
if (!$success) {
return JSONResponse::response(200, false);
}
return JSONResponse::response(200, $task);
}
示例7: create
function create(Request $request)
{
$task = new Task();
$task->name = $request->name;
$task->save();
return redirect('/');
}
示例8: add
public function add(TaskRequest $request)
{
$task = new Task();
$task->taskName = $request->taskName;
$task->save();
return redirect('task');
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$task = new Task();
$task->title = self::capitalize(Input::get('title'));
$task->created_by = Auth::id();
if (Input::has('project_id')) {
$task->project_id = Input::get('project_id');
Session::set('project_id', $task->project_id);
}
$task->hours = Input::has('hours') ? Input::get('hours') : 0;
$task->closed_at = Input::has('closed_at') ? Input::get('closed_at') : null;
$task->urgent = Input::has('urgent') ? 1 : 0;
if (Input::has('closed_at')) {
$task->urgent = 0;
}
// closed tasks are not urgent
if (Input::has('fixed')) {
$task->fixed = 1;
$task->amount = Input::has('amount') ? $task->amount : 0;
} else {
$task->fixed = 0;
$task->amount = $task->hours * ($task->project->rate ?: 0);
}
$task->save();
ProjectController::updateTotals($task->project_id);
return redirect(Input::get('return_to'));
}
示例10: addTask
public function addTask()
{
$task = new Task();
$task->name = Input::get('name');
$task->save();
return redirect('sezgicraft/admin-panel');
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$task = new Task();
$task->name = $request->name;
$task->user_id = $request->user_id;
$task->save();
}
示例12: addTask
public function addTask(Request $req)
{
$task = new Task();
$task->task_content = $req->get('task_content');
$task->save();
return redirect()->route('tasks');
}
示例13: create
/**
* Show the form for creating a new resource.
* GET /tasks/create
*
* @return Response
*/
public function create()
{
// Rules
$rules = array('weight' => 'integer|between:1,5', 'name' => 'required');
// Custom messages
$messages = array('between' => 'The :attribute must be between :min - :max.', 'integer' => ':attribute must be a number');
// Create validation
$validator = Validator::make(Input::all(), $rules, $messages);
// Check validation
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
// Insert the task to database
$task = new Task();
$task->project_id = Input::get('projectId');
$task->user_id = Auth::id();
$task->name = Input::get('name');
$task->weight = Input::get('weight');
if (!Input::get('weight')) {
$task->weight = 1;
}
$task->state = "incomplete";
$task->save();
// Increase the users overall task count
$user = User::find(Auth::id());
$user->tasks_created = $user->tasks_created + 1;
$user->save();
return Redirect::back()->with('success', Input::get('name') . " has been created.");
}
示例14: store
public function store(Request $request, Task $task)
{
$task->addNote(new Note($request->all()));
$task->setUpdatedAt(Carbon::now()->toDateTimeString());
$task->save();
return back();
}
示例15: store
public function store()
{
$rules = ['name' => 'required', 'description' => 'required', 'estimateTime' => 'required', 'sequence' => 'required'];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
} else {
if (Input::has('task_id')) {
$id = Input::get('task_id');
$tasks = TaskModel::find($id);
$alert['msg'] = 'Task has been updated successfully';
} else {
$tasks = new TaskModel();
$tasks->project_id = Input::get('projectId');
$alert['msg'] = 'Task has been created successfully';
}
$tasks->name = Input::get('name');
$tasks->description = Input::get('description');
$tasks->estimateTime = Input::get('estimateTime');
$tasks->sequence = Input::get('sequence');
$tasks->save();
$alert['type'] = 'success';
return Redirect::route('project.view', $tasks->project_id)->with('alert', $alert);
}
}