Skip to content

Instantly share code, notes, and snippets.

@Mombuyish
Last active April 15, 2018 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mombuyish/b328d8c3964464fda5b3b5448be2c42f to your computer and use it in GitHub Desktop.
Save Mombuyish/b328d8c3964464fda5b3b5448be2c42f to your computer and use it in GitHub Desktop.
<?php
// passing array.
public function store(Request $request)
{
$data = $request->all();
//array_set, array_add and others way.
array_set($data, 'status', 'draft');
// accept array.
$this->postSevice->create($data);
}
// passing Request.
public function store(Request $request)
{
$request->request->set('status', 'draft');
// Instance of Request
$this->postSevice->create($request);
}
// set request layer, weird
class PostRequest extends FormRequest
{
public function rules()
{
$request->request->set('status', 'draft');
return [
//
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment