Last active
April 15, 2018 09:10
-
-
Save Mombuyish/b328d8c3964464fda5b3b5448be2c42f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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