Which table is the main table?

|
Z_Yamin 2020-02-25 14:16:46
i am working write now with api, transfereing data between iocni app and laravel project
Z_Yamin 2020-02-25 14:17:31
there was lots of problem, but solved them, may be the be for you
Z_Yamin 2020-02-25 14:19:24
prime 2020-02-25 14:15:09
yaap laravel project…

read this for more information:

Z_Yamin 2020-02-25 14:19:26
https://laravel.com/docs/5.7/passport
Akshay Bhardwaj 2020-02-25 14:20:00
Akshay Bhardwaj 2020-02-25 12:08:58

Help please

prime 2020-02-25 14:20:13
Z_Yamin 2020-02-25 14:19:26
https://laravel.com/docs/5.7/passport

thanks brother..

Z_Yamin 2020-02-25 14:20:45
prime 2020-02-25 14:20:13
thanks brother..

welcome

Z_Yamin 2020-02-25 14:21:04
Akshay Bhardwaj 2020-02-25 14:20:00
Help please

i don’t know ecaxtly

Akshay Bhardwaj 2020-02-25 14:21:52
Can you tell me how can know what package are fowo
Akshay Bhardwaj 2020-02-25 14:21:55
Download
skys215 2020-02-25 14:22:35
Yannickshadownet 2020-02-25 14:13:10
hello everyone.I would like to write a request that uses 3 tables with which I will join with other tables then in a select select the data to display with query builder but I don’t know how to add the two additional tables in my DB :: table ( ‘artisans’) thank you for helping me

use eloquent relationship

skys215 2020-02-25 14:22:43
Akshay Bhardwaj 2020-02-25 14:21:52
Can you tell me how can know what package are fowo

what?

2020-02-25 14:31:45
laravel_discuss-27860.jpg
$ask
anyone can help how to overcome this?
skys215 2020-02-25 14:34:19
2020-02-25 14:31:45
$ask
anyone can help how to overcome this?

It’s obvious, you didn’t pass parameter to generate url for artikel.update

skys215 2020-02-25 14:34:34
it’s mostly you missed the id
2020-02-25 14:41:34
yes bro I forgot: v
sadeqi125 2020-02-25 15:01:31
expired page when i login to laravel system in laravel
sadeqi125 2020-02-25 15:02:13
can help me any
sadeqi125 2020-02-25 15:02:28
my system in online on cpanel
Suraz Ghimire 2020-02-25 15:37:15
We wud be starting our datascience course in next 2 months.
You wud be invited to our free course via YouTube.

In case you wud be interested, plz subscribe our YouTube channel

https://www.youtube.com/channel/UCL22nVSVTz0831V96vRw8mg

But don’t forget to click notification bell, so that you don’t miss the live event

Yannickshadownet 2020-02-25 15:38:30
skys215 2020-02-25 14:22:35
use eloquent relationship

laravel_discuss-27868.jpg

Yannickshadownet 2020-02-25 15:40:50
I want to use sections table to join another table
Z_Yamin 2020-02-25 15:43:00
send your query
Z_Yamin 2020-02-25 15:43:29
code not photo
Z_Yamin 2020-02-25 15:45:13
send your query then i solve it and send for you
Yannickshadownet 2020-02-25 15:45:31
ok
Yannickshadownet 2020-02-25 15:45:37
public function getActualite()
{
$totalEvent = DB::table(‘artisans’,’sections’)
->join(‘evenements’, ‘artisans.id’, ‘=’, ‘evenements.idArtisan’)
/* ->join(‘sections’, ‘sections.idSyndicat’, ‘=’, ‘syndicats.id’)
->join(‘artisan__sections’, ‘sections.id’, ‘=’, ‘artisan__sections.idSection’) */
->select(‘evenements.*’,’artisans.nom’,’artisans.prenom’)
->orderby(‘evenements.created_at’,’DESC’)
->get();
return view(‘actualite’,compact(‘totalEvent’));
}
Z_Yamin 2020-02-25 15:46:34
which table is your mani table
Z_Yamin 2020-02-25 15:46:45
main
Yannickshadownet 2020-02-25 15:47:21
artisans and sections
Z_Yamin 2020-02-25 15:48:27
join just tow table?
Z_Yamin 2020-02-25 15:49:03
your third table name?
Z_Yamin 2020-02-25 15:49:33
is this your third table?
artisan__section
Yannickshadownet 2020-02-25 15:50:06
Z_Yamin 2020-02-25 15:49:33
is this your third table?
artisan__section

yes

Z_Yamin 2020-02-25 15:52:13
public function getActualite()
{
$totalEvent = DB::table(‘artisans’)
->join(‘sections’, ‘artisans.id’, ‘=’, ‘sections.idArtisan’)
->join(‘artisan__sections as as’, ‘sections.id’, ‘=’, ‘as.idSection’)
->select(‘sections.*’,’artisans.nom’,’artisans.prenom’,’as.name’)
->orderby(‘artisans.created_at’,’DESC’)
->get();
return view(‘actualite’,compact(‘totalEvent’));
}
Z_Yamin 2020-02-25 15:52:25
use like this ihope it work for you
Z_Yamin 2020-02-25 15:52:39
change things acording to data you want
skys215 2020-02-25 16:08:00
Yannickshadownet 2020-02-25 15:40:50
I want to use sections table to join another table

It’s also ok

Yannickshadownet 2020-02-25 16:08:22
skys215 2020-02-25 16:08:00
It’s also ok

no

Yannickshadownet 2020-02-25 16:54:19
I had to write sql code to get what I want.
but I would like to have it in query builder form. Thank you for helping me
Yannickshadownet 2020-02-25 16:54:36
public function getActualite()
{
$totalEvent =DB::select(“select evenements.*,syndicats.nom as NomSyndicat,sections.
libelleSection as NomSection,artisans.nom,artisans.prenom
from artisans,evenements,syndicats,sections,artisan__sections
where artisan__sections.idArtisan=artisans.id
AND artisan__sections.idSection=sections.id
AND artisan__sections.idSyndicat=syndicats.id
AND evenements.idArtisan=artisans.id
ORDER BY evenements.created_at DESC

“);

return view(‘actualite’,compact(‘totalEvent’));
}

skys215 2020-02-25 17:09:30
Yannickshadownet 2020-02-25 16:54:36
public function getActualite()
{
$totalEvent =DB::select(“select evenements.*,syndicats.nom as NomSyndicat,sections.
libelleSection as NomSection,artisans.nom,artisans.prenom
from artisans,evenements,syndicats,sections,artisan__sections
where artisan__sections.idArtisan=artisans.id
AND artisan__sections.idSection=sections.id
AND artisan__sections.idSyndicat=syndicats.id
AND evenements.idArtisan=artisans.id
ORDER BY evenements.created_at DESC

“);

return view(‘actualite’,compact(‘totalEvent’));
}

which table is the main table?

Yannickshadownet 2020-02-25 17:14:37
Artisan__sections and artisans
skys215 2020-02-25 17:16:00
But you are ordering by evenments.created_at?
Yannickshadownet 2020-02-25 17:20:00
Sorry evenements is my main tables but i want to show somes data as the artisan who publish evenements and his syndicat and his sections …
skys215 2020-02-25 17:23:42
Yannickshadownet 2020-02-25 17:20:00
Sorry evenements is my main tables but i want to show somes data as the artisan who publish evenements and his syndicat and his sections …

Something like this should work
class HomeController extends Controller{
public function getActualite()
{
$totalEvent = Evenement::with([
‘artisan’,
‘artisan__sections’,
‘artisan__sections.sections’,
‘artisan__sections.syndicats’ => function($query){
return $query->select([
‘id’,
‘nom’ => ‘NomSyndicat’,
‘libelleSection’ => ‘NomSection’,
]);
},
‘artisan__sections.artisan’ => function($query){
return $query->select([
‘id’,
‘nom’,
‘prenom’,
]);
},
])
->orderBy(‘created_at’, ‘DESC’)
->get();

return view(‘actualite’,compact(‘totalEvent’));
}
}

class Evenement extends Model{
public function artisans(){
return $this->hasOne(‘AppArtisan’, ‘idArtisan’);
}
}

class ArtisanSection extends Model{
public function artisan(){
return $this->hasOne(‘AppArtisan’,’idArtisan’);
}
public function sections(){
return $this->hasMany(‘AppSection’,’idSection’);
}
public function syndicats(){
return $this->hasMany(‘AppSyndicat’, ‘idSyndicat’);
}
}

2020-02-25 17:28:58
Have anyone worked with the coinpayments api ?
vdzwasss 2020-02-25 17:33:21
laravel_discuss-27901.jpg
Hello everyone I am now headaching to get this parent attribute,
please tell me how to get this parent , thanks.
Yannickshadownet 2020-02-25 17:39:57
skys215 2020-02-25 17:23:42
Something like this should work
class HomeController extends Controller{
public function getActualite()
{
$totalEvent = Evenement::with([
‘artisan’,
‘artisan__sections’,
‘artisan__sections.sections’,
‘artisan__sections.syndicats’ => function($query){
return $query->select([
‘id’,
‘nom’ => ‘NomSyndicat’,
‘libelleSection’ => ‘NomSection’,
]);
},
‘artisan__sections.artisan’ => function($query){
return $query->select([
‘id’,
‘nom’,
‘prenom’,
]);
},
])
->orderBy(‘created_at’, ‘DESC’)
->get();

return view(‘actualite’,compact(‘totalEvent’));
}
}

class Evenement extends Model{
public function artisans(){
return $this->hasOne(‘AppArtisan’, ‘idArtisan’);
}
}

class ArtisanSection extends Model{
public function artisan(){
return $this->hasOne(‘AppArtisan’,’idArtisan’);
}
public function sections(){
return $this->hasMany(‘AppSection’,’idSection’);
}
public function syndicats(){
return $this->hasMany(‘AppSyndicat’, ‘idSyndicat’);
}
}

i will try it thank u

Yannickshadownet 2020-02-25 17:44:59
I get this error

IlluminateDatabaseQueryException
SQLSTATE[42S22]: Column not found: 1054 Champ ‘artisans.idArtisan’ inconnu dans where clause (SQL: select * from artisans where artisans.idArtisan in (1, 2))

|