PHP Snippet 1:
... ('2016-12-06 06:56:01',27, null, '2016-12-06 06:56:01'))
PHP Snippet 2:
insert into product_prices (created_at, product_id, unit_id, updated_at)
values (2016-12-06 06:56:01, 27, 1,2016-12-06 06:56:01),
(2016-12-06 06:56:01,27,null, 2016-12-06 06:56:01);
PHP Snippet 3:
if(!isset($unit_id) || empty($unit_id)) $unit_id = 0;
.
.
//insert query rest code
PHP Snippet 4:
public function store($id, Request $request) {
$post = Post::find($id);
$comment = new Comment;
$comment->text = $request->comment;
$comment->post_id = $post; <--- HERE IS THE MISTAKE
$comment->post_id = $post->id; <--- HERE IS THE FIX
$comment->user_id = Auth::id();
$comment->save();
return back();
}
PHP Snippet 5:
intval($unit_id);
PHP Snippet 6:
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('airline');
$table->timestamps();
});
}
PHP Snippet 7:
{
...,
"item":1
}
PHP Snippet 8:
{
...,
"item":[{"id"=1}]
}
PHP Snippet 9:
$item= Item::find($request->input('item'));
$client->item()->associate($item);
PHP Snippet 10:
function if_set($v)
if (isset($_POST[$v]) and $_POST[$v] != '')
$data_to_db[$v] = $_POST[$v];