本文整理汇总了PHP中app\models\Task::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Task::create方法的具体用法?PHP Task::create怎么用?PHP Task::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Task
的用法示例。
在下文中一共展示了Task::create方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage via ajax.
*/
public function store(TaskRequest $request)
{
if ($request->ajax()) {
return Task::create($request->all());
}
return view('errors.404');
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
//接受任务创建表单的数据
//$date = $request->all();
//dd($date);//测试数据正确性
Task::create($request->all());
return redirect('/feature/project/' . $request->input('project_id') . '/task');
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @param Project $project
* @param \Illuminate\Http\Request $request
* @return Response
*/
public function store(Project $project, Request $request)
{
$this->validate($request, $this->rules);
$input = Input::all();
$input['project_id'] = $project->id;
Task::create($input);
return Redirect::route('projects.show', $project->slug)->with('message', 'Nova tarefa criada.');
}
示例4: postCreate
public function postCreate(Request $request)
{
$input = $request->only(['name']);
$input['user_id'] = Auth::id();
$input['course_id'] = Auth::user()->course_id;
Task::create($input);
flash()->message('Zadanie bolo vytvorené');
return redirect()->back();
}
示例5: store
public function store()
{
$data = Input::all();
if (is_array($data) && !empty($data)) {
unset($data['_token']);
$task = Task::create(array("title" => $data['title'], "description" => $data['description'], "due_date" => date("Y-m-d h:i:s", strtotime($data['due_date'])), "status" => $data['status']));
return response()->json(['status' => 'success', 'data' => $task]);
} else {
return response()->json(['status' => 'error', 'msg' => "Invalid data!"]);
}
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @param Project $project
* @param \Illuminate\Http\Request $request
* @return Response
*/
public function store(Project $project, Request $request)
{
$this->middleware('auth');
if ($project->ismember(auth()->user()) || access()->hasRole('Administrator')) {
$this->validate($request, $this->rules);
$input = $this->filter_task_input();
$input['slug'] = $this->makeSlugFromTitle($input['name']);
$input['project_id'] = $project->id;
Task::create($input);
return Redirect::route('projects.show', $project->slug)->with('message', 'Nova tarefa criada.');
} else {
return Redirect::route('home')->with('flash_danger', 'Operação não permitida.');
}
}
示例7: store
/**
* Store a newly created resource in storage.
* POST /tasks
*
* @return Response
*/
public function store($project, TasksRequest $request)
{
$task = Task::create($request->all());
return Redirect::back()->with('okmessage', 'New task has been added');
}
示例8: run
public function run()
{
Task::create(['name' => 'Task example', 'deadline' => date("H:i:s"), 'progress' => false]);
}
示例9: import_xls
/**
* static function to read the xls and store
*
* @param int $id
* @return Response*/
public static function import_xls($pathname, $card_id = false, $camp_id = false)
{
Excel::load($pathname, function ($reader) use($card_id, $camp_id) {
// Getting all results
$results = $reader->get();
$cnt = 1;
foreach ($results as $result) {
//checking existing Ditrict in db
if ($cnt < 6) {
if ($card_id) {
$exitdist = Card::where('id', $card_id)->first();
} else {
$exitdist = Card::where('name', $result->card)->first();
}
if ($camp_id) {
$camp = Camp::where('id', $camp_id)->first();
} else {
$camp = Camp::where('name', $result->camp)->first();
}
$save['card_id'] = @$exitdist->id;
$save['camp_id'] = @$camp->id;
$save['title'] = $result->title;
$save['description'] = ' Order Id :' . $result->order_id . ', Ship date:' . $result->ship_date;
$save['added_by'] = Auth::user()->id;
$save['status'] = $result->status;
$save['order_amount'] = $result->order_amount;
$save['actual_time_to_deliver'] = $result->actual_time_to_deliver;
$save['payment_method'] = $result->payment_method;
$save['address_type'] = $result->address_type;
$save['address'] = ' Customer_name:' . $result->customer_name . ', Status:' . $result->status . ', City:' . $result->city . ', District' . $result->district . ', Province' . $result->province . ', Customer Phone' . $result->customer_phone;
Task::create($save);
if (@$camp->title) {
$timeline['description'] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the task for <a href="javascript:;">' . $camp->title . '</a>';
$timeline['object_type'] = 6;
$timeline['object_id'] = $camp->id;
Timeline::create($timeline);
}
if (@$exitdist->name) {
$timeline['description'] = Auth::user()->first_name . ' ' . Auth::user()->last_name . ' has imported the task for <a href="javascript:;">' . @$exitdist->name . '</a>';
$timeline['object_type'] = 6;
$timeline['object_id'] = $exitdist->id;
Timeline::create($timeline);
}
unset($save);
}
$cnt++;
}
});
}
示例10: trades
/**
* Migrate Trades
*/
public function trades()
{
echo "<h1>Migrating Trades</h1>";
DB::table('z_lookup_trades')->truncate();
DB::table('z_lookup_tasks')->truncate();
// Create initial records
$notrade = Trade::create(array('name' => 'No Trade', 'status' => '1', 'company_id' => '1', 'created_by' => '1', 'updated_by' => '1'));
$trades = zTrade::all();
$trades->each(function ($trade) {
$active_trade = '0';
if ($trade->active == "y") {
$active_trade = '1';
}
$newtrade = Trade::create(array('name' => reformatOldStr($trade->name), 'status' => $active_trade, 'company_id' => '3', 'created_by' => '1', 'updated_by' => '1'));
zLookupTrade::create(array('old' => $trade->id, 'new' => $newtrade->id));
echo "<b> {$trade->name} [{$trade->id}]->[{$newtrade->id}]</b><br>";
$tasks = zTask::where('trade_id', '=', $trade->id)->get();
foreach ($tasks as $task) {
$active_task = '0';
if ($task->active == "y") {
$active_task = '1';
}
$upcoming_task = '0';
if ($task->upcoming == "y") {
$upcoming_task = '1';
}
$newtask = Task::create(array('name' => reformatOldStr($task->name), 'code' => reformatOldStr($task->code), 'upcoming' => $upcoming_task, 'status' => $active_task, 'trade_id' => $newtrade->id, 'created_by' => '1', 'updated_by' => '1'));
zLookupTask::create(array('old' => $task->id, 'new' => $newtask->id));
echo "<b> {$task->name} [{$task->id}]->[{$newtask->id}]</b><br>";
}
echo "<br>";
});
echo "<h1>Completed</h1>";
}
示例11: create
public function create(Request $request)
{
Task::create(['name' => $request->name, 'deadline' => $request->deadline, 'user_id' => $request->user()->id]);
}