Those tables should have uuids as ids, right?

|
Shijinsubramanniam 2020-08-29 15:07:17
Is there anybody here me to help regarding API
2020-08-29 15:14:40
Hello, I have 3 diferent laravel projects but I want to create a single sign on application for all systems. any idea please
mrbiryani 2020-08-29 15:15:33
Patricklab 2020-01-01 21:53:27
hello everyone well starting up a new company looking forward to getting someone willing to join and partner as a co-founder incase anyone is or would be interested Market is fresh and we would build up business togerther looking out for full stack mean stack or mobile app guys if interested inbox for more info

Location??

praneet81 2020-08-29 15:23:11
GistOf 2020-08-29 12:35:32
May we see what you already have?

Okay so here are my codes

praneet81 2020-08-29 15:23:26
So I’ve a listing model
praneet81 2020-08-29 15:23:39
public function user()
{
return $this->belongsTo(‘AppUser’);
}
praneet81 2020-08-29 15:23:50
praneet81 2020-08-29 15:23:39
public function user()
{
return $this->belongsTo(‘AppUser’);
}

And this is the relationship

praneet81 2020-08-29 15:24:12
And in the model itself I’ve created couple of scopes
praneet81 2020-08-29 15:24:23
public function scopeDistance($query,$lat,$lng)
{
$radius = 10;

return $this->select(
DB::raw(“id, user_id, location, lat, lng, property_type, number_of_rooms, room_type, number_of_flatmates, roomates_living, amenities, rent_deposit, monthly_rent, description, created_at, updated_at, ROUND((
6371 * acos(
cos( radians( ? ) ) *
cos( radians( lat ) ) *
cos( radians( lng ) – radians(?) ) +
sin( radians( ? ) ) *
sin( radians( lat ) )
)
)) AS distance”)
)
->having(“distance”, “<“, “?”)
->orderBy(“distance”)
->take(20)
->addBinding([$lat, $lng, $lat, $radius]);

}

praneet81 2020-08-29 15:24:49
This is one for distance, when user enters their preferred location
praneet81 2020-08-29 15:25:04
public function scopeMulti($query,$search)
{
return $this->whereHas(‘user’, function($query) use($search){
$query->where(‘gender’,$search)
->orWhere(‘budget’,$search);
});
}
praneet81 2020-08-29 15:25:25
praneet81 2020-08-29 15:25:04
public function scopeMulti($query,$search)
{
return $this->whereHas(‘user’, function($query) use($search){
$query->where(‘gender’,$search)
->orWhere(‘budget’,$search);
});
}

While this scope is for optional filter

praneet81 2020-08-29 15:25:39
public function index(Request $request)
{

$lat= $request->query(‘lat’);
$lng= $request->query(‘lng’);
$search= $request->query(‘search’);

$data = Listing::distance($lat,$lng)->multi($search)->get();

return response()->json($data);

}

praneet81 2020-08-29 15:25:50
praneet81 2020-08-29 15:25:39
public function index(Request $request)
{

$lat= $request->query(‘lat’);
$lng= $request->query(‘lng’);
$search= $request->query(‘search’);

$data = Listing::distance($lat,$lng)->multi($search)->get();

return response()->json($data);

}

This is my code in controller

praneet81 2020-08-29 15:26:33
Now when i only do Listing::distance($lat,$lng)->get(); i get the desired result
praneet81 2020-08-29 15:26:56
But when i go further to filter and chain the second scope i get an empty array
Billa_Bongg 2020-08-29 15:41:21
2020-08-29 15:14:40
Hello, I have 3 diferent laravel projects but I want to create a single sign on application for all systems. any idea please

Research on SimpleSAML

GistOf 2020-08-29 15:59:37
praneet81 2020-08-29 15:24:23
public function scopeDistance($query,$lat,$lng)
{
$radius = 10;

return $this->select(
DB::raw(“id, user_id, location, lat, lng, property_type, number_of_rooms, room_type, number_of_flatmates, roomates_living, amenities, rent_deposit, monthly_rent, description, created_at, updated_at, ROUND((
6371 * acos(
cos( radians( ? ) ) *
cos( radians( lat ) ) *
cos( radians( lng ) – radians(?) ) +
sin( radians( ? ) ) *
sin( radians( lat ) )
)
)) AS distance”)
)
->having(“distance”, “<“, “?”)
->orderBy(“distance”)
->take(20)
->addBinding([$lat, $lng, $lat, $radius]);

}

I’ve used ->toSql() to output the query and analyse it. I don’t see anything wrong, but then I’m not a pro with MySQL

praneet81 2020-08-29 16:01:11
GistOf 2020-08-29 15:59:37
I’ve used ->toSql() to output the query and analyse it. I don’t see anything wrong, but then I’m not a pro with MySQL

So you mean Listing::distance($lat,$lng)->multi ($search)->toSql()->get();

??

GistOf 2020-08-29 16:05:36
->toSql() should be the lat thing in the chain. Store the whole thing in a variable and user exit( $the_variable ). dd() will give you a formatted output. That’s why I use exit() in this case. When you get the text, you can use it to tinker in your DB browser
GistOf 2020-08-29 16:16:22
praneet81 2020-08-29 16:01:11
So you mean Listing::distance($lat,$lng)->multi ($search)->toSql()->get();

??

Also, do not ->get() when what you want is the query text

praneet81 2020-08-29 16:16:50
No i see the confusion
praneet81 2020-08-29 16:17:28
I don’t need the query text bro

I want the filter to work

I need it to filter the table according to search query

GistOf 2020-08-29 16:20:22
Are you sure you don’t want to know what Eloquent is saying to the DB and what the actual DB result looks like?
cayetanohosma 2020-08-29 16:20:31
Can someone explain me, why in Passport migrations the tables have the Ids as bigincrements instead UUIDs when I did php artisan passport:install –uuids
cayetanohosma 2020-08-29 16:20:55
I cannot understand it. Those tables should have uuids as ids, right?
bee_amour 2020-08-29 16:47:00
hello,
$userId = Auth::guard(‘halls’)->id;
$hall_save = hall_person::where([‘user_id’ => $userId])->get(); but i got error in “Undefined property: Illuminate\Auth\SessionGuard::$id
bee_amour 2020-08-29 16:48:04
how to mentlon guards in laravel use curd
GistOf 2020-08-29 16:59:57
What’s wrong with auth()->user()->id?
GistOf 2020-08-29 17:00:23
You want the user’s id, right?
eL7alfa 2020-08-29 17:24:49
$userId = Auth::guard(‘halls’)->user()->id;
RajkotRocks 2020-08-29 17:37:42
eL7alfa 2020-08-29 17:24:49
$userId = Auth::guard(‘halls’)->user()->id;

Easily Auth::Id() it’s easy

eL7alfa 2020-08-29 17:47:17
RajkotRocks 2020-08-29 17:37:42
Easily Auth::Id() it’s easy

๐Ÿคฃ ๐Ÿ‘

mayurtekwani 2020-08-29 19:08:37
Hello Friends
I want to make an login page in larvel where I want to get data from already existed table

Please help me

JoaquinVilchez 2020-08-29 19:30:35
laravel_discuss-49185.jpg

JoaquinVilchez 2020-08-29 19:31:11
Hi! im trying to deploy my Laravel app to Heroku but when execute git push heroku master i have this problem
JoaquinVilchez 2020-08-29 19:33:11
Does anyone know what it could be? its my first time deploying an app in heroku
hey_archer 2020-08-29 19:34:20
Hello LaraPeeps,

Would love hear about upcoming Laravel 8 feature of Time travel
, if anyone knows pls put some light on it.

smartnathan2020 2020-08-29 19:54:42
JoaquinVilchez 2020-08-29 19:33:11
Does anyone know what it could be? its my first time deploying an app in heroku

Delete the vendor folder and run the composer install again

JoaquinVilchez 2020-08-29 20:07:23
i did it but it keeps giving me the same error ๐Ÿ™
JoaquinVilchez 2020-08-29 20:07:49
laravel_discuss-49193.jpg

JoaquinVilchez 2020-08-29 20:08:02
this is the error file
anthon_go 2020-08-29 20:36:46
I just installed laravel 7 when I add this line in my app.js file *window.Vue = require(‘Vue’)* i get this error
anthon_go 2020-08-29 20:36:57
ERROR in ./resources/js/app.js
Module not found: Error: Can’t resolve ‘Vue’ in ‘/home/alex-gobe/Projet-laravel/yalcam-4.1/resources/js’
@ ./resources/js/app.js 3:13-27
@ multi ./resources/js/app.js ./resources/sass/app.scss
anthon_go 2020-08-29 20:37:42
help me please to understand
ikudratov 2020-08-29 21:30:27
anthon_go 2020-08-29 20:36:46
I just installed laravel 7 when I add this line in my app.js file *window.Vue = require(‘Vue’)* i get this error

Don’t write the code like this,
This is a pretty code:
โ€”โ€”
import Vue from ‘vue’
new Vue({
el: ‘#app’,
})

anthon_go 2020-08-29 21:49:18
bullshit thank you I’m going to get some sleep
pratik0099 2020-08-29 21:54:28
I ย want to be able to develop Android & iOS app as well as web apps. At first I started learning JavaScript but then switched to PHP, as I thought it will be easy to learn and Laravel will help me create backend of websites (also I’ll be able to make WordPress plugins). But I’m confused. As I stated earlier, my goal is to make cross-platform applications.

Is there any other language should I learn? or I should learn PHP then JS or just JS? (I think JS has got awesome libraries & frameworks through which I’ll be a able to accomplish a lot of things). Help me out please.

ps: I’m a novice programmer, I’ve just started my journey of becoming a developer.

natghi2010 2020-08-29 23:07:02
pratik0099 2020-08-29 21:54:28
I ย want to be able to develop Android & iOS app as well as web apps. At first I started learning JavaScript but then switched to PHP, as I thought it will be easy to learn and Laravel will help me create backend of websites (also I’ll be able to make WordPress plugins). But I’m confused. As I stated earlier, my goal is to make cross-platform applications.

Is there any other language should I learn? or I should learn PHP then JS or just JS? (I think JS has got awesome libraries & frameworks through which I’ll be a able to accomplish a lot of things). Help me out please.

ps: I’m a novice programmer, I’ve just started my journey of becoming a developer.

Maybe keep it in the family. Vue/Reactjs(web)/React-native/Vue-native(app)/NodeJs(Server)

mrbiryani 2020-08-30 00:20:29
Is react and react native similar??
|