Комментарии:
❤❤❤
Ответитьplease use the simple method for example the following code is simpler
use App\Models\Stud;
class devicecontroller extends Controller
{
//
function Index(Stud $key){
return $key;
}
It's not good to use % at begining of search
Ответитьfunction search($model) {
$result = Car::where("model","like","%".$model."%")->get();
if(!$result->isEmpty()){
return $result;
}else{
return ['Result' =>'No result found'];
}
}
function search($name)
{
$result = Test::where("name", "like", "%" . $name . "%")->get();
if(count($result))
{
return $result;
}
else
{
return ['Result'=>'No records found'];
}
}
The answer is to simply find a way to check if the array is empty as any value returned by the get statement is in form of an array , so a very simple way to check will be as shown below .
function search($firstname)
{
$result = Member::where("firstname", $firstname)->get();
if(sizeof($result) == 0)
{
return "There are no Match";
}
else
{
return $result;
}
}
Your can also do the same if you are checking for a character .
soo helpfull
ОтветитьTq u so much luv u sir
Ответитьfunction search($name){
$data = Organizations::where("name","like","%".$name."%")->get();
if($data)
{
return $data;
}
else{
return ["Result"=>"no data found"];
}
}
Another Answer:
public function search($name){
$result = Devices::where("name",$name)->get();
if(!$result->isEmpty()){
return $result;
}
else{
return response()->json([
'response'=>'No data found'
]);
}
}
Crack
Ответитьfunction search($name)
{
$devices = Device::where("name","like", "%".$name."%")->get();
return count($devices)?$devices:["message"=>"".$name." not found"];
}
$data = Data::where('name','like','%'.$q.'%')->get();
if (count($data)) {
return $data;
}else{
return [
'status' =>false,
'message' => 'not found',
];
}
function search($key){
$result = Device::where("name", "LIKE", "%".$key."%")->get();
if($result->count()>0){
return $result;
}else{
return ["Result"=>"No records found"];
}
}
i think this is the shortest, lol
if ($result == '[]') {
return 'bruh...';
} else {
return $result;
}
Sir, how to fetch data from multiple endpoints in single endpoint
ОтветитьMake tutorial with number list
Ответитьpublic function search($name)
{
$result= Device::where('name',"like","%".$name."%")->get();
return(isset($result))?$result:['Result'=>'No Records found'];
}
return count($result)? $result:"Not matched";
ОтветитьAnswer:
public function search ($name){
$result = User::where('username', 'like', '%'.$name.'%')->get();
if(count($result)){
return $result;
} else {
return array('Result', 'No records found');
}
}
function search($haider){
$member= Member::where("name",$haider)->get();
$result = $member;
if($result){
return $result;
}
else{
return ['result'=>'Your searching data does not matched!!'];
}
}
but dont show message !!
Interview answer:
$result = (Devices::where("name", "like", "%" . $name . "%")->get());
if ($result->count() > 0) {
return $result;
}
return [
"result" => "There is no result found"
];
Would it be possible to show how to implement SOAP API's using laravel please
Ответитьfunction search($name)
{
$result= Device::where("name",$name)->get();
if (!count($result))
{
return ["result"=>"no result found"];
}
else
{
return $result;
}
}
bro how integrate laravel with reactjs
ОтветитьInterview question:
function search($name){
$result = Device::where('name', 'like', '%'.$name.'%')->get();
if(count($result) > 0){
return $result;
}else{
return $name." is not found";
}
}
thank you very much
ОтветитьIf($device→count() > 0)
ОтветитьSir how to create api key for nobody can use Ower api
ОтветитьCan we use post method here
ОтветитьSir ek html template ko kaise laravel me integrate karenge plz ospe ek video banado
Ответитьplease make videos on the Role management based Multiple Authentication system...... It's really indeed..
Ответить