Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
need to put one more element to show in controller laravel, today 'status_viagem','=','VIAGEM' works finne but need´s 'VIAGEM' and 'DESCARGA'.
My controller:
public function listaPainel(Request $request)
{
$lista = Cco::where('status_viagem','=','VIAGEM')->get();
$data['lista'] = $lista;
return view('rast.lista_painel', $data);
}
Your question is not clear. I am guessing you want to compare with more data in where condition. In this case, you may need like this:
$lista = Cco::whereIn('status_viagem', ['VIAGEM', 'DESCARGA'])->get();
You need to be more clear about your problem.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
The problem when I write get and rand, I do not get it right
tried yt and many websites and still don't do it
public function roll() {
}
It's not clear what you want, but:
<?php
class Number{
public function getRandNumber($min, $max) {
echo(rand($min,$max));
}
}
$number = new Number();
$number->getRandNumber(0, 100);
?>
rand()
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Is there a way to make something like this:
$bob = $request->bob;
return $bob in_array()....
to resolve to something like
return ! in_array()....
or
return in_array()....
base on the variable value...
You can use ?:
return $variable ? in_array('x', $some_arr) : !in_array('x', $some_arr);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Way 1:
public $foo = 1;
function(){
return $this->foo+1;
}
Way 2:
// with $foo = 1 in other function
function($foo){
return $foo+1;
}
Sorry for a 'dumb' question, someone can tell me what is the better way?
Second way is better and it is more canonical than first one. For more information please read this doc http://php.net/manual/en/functions.arguments.php
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
http://example.com/geturl.php?url=http://example.org/index.php?parafile=1698%3A1562%3A0%3A0¶_action=print_ticket¶file=dance://here.kodas/print&token=3ec2b0d3e6e0ca152bc024cc3f30f16c
So i want each of this parameters in a different varaible in the geturl.php file. I am using the regular get url
You can use anything like this :
$url = "http://example.com/geturl.php?url=".urlencode($urlPart);
$_server[QUERY_STRING] solved my problem
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I do not know how to insert POST data to mongodb collection. I try to do it like this:
$collection ->insert($_POST);
But in this case I get An Internal Server Error. What is the best and most concise way to do it?
Better way to make an array of all post data and pass it to insert like
<?php
$post = array("username" =>$_POST['username'], "password" => $_POST['password']);
$collection->insert($post);
?>