Error: SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: ‘Leads’

If you are using SQL keywords as table column names, you can enable identifier quoting for your database connection in config/app.php.

Even after enable quoteIdentifiers to true still same issus help please

SQL Query:

SELECT Leads.id AS Leads__id, Leads.name_lead AS Leads__name_lead, Leads.forcecast_amount AS Leads__forcecast_amount, Leads.term AS Leads__term, Leads.next AS Leads__next, Leads.probability AS Leads__probability, Leads.description AS Leads__description, Leads.created AS Leads__created, Leads.modified AS Leads__modified, Leads.sale_phase_id AS Leads__sale_phase_id, Leads.campaign_id AS Leads__campaign_id, Leads.user_id AS Leads__user_id, Leads.account_id AS Leads__account_id, Leads.contact_id AS Leads__contact_id, Leads.paid_to_id AS Leads__paid_to_id, Leads.secteur_id AS Leads__secteur_id, Leads.lead_type_id AS Leads__lead_type_id, Leads.source_prospect_id AS Leads__source_prospect_id, SalePhases.id AS SalePhases__id, SalePhases.name_phase AS SalePhases__name_phase, SalePhases.user_id AS SalePhases__user_id, Campaigns.id AS Campaigns__id, Campaigns.name_campaign AS Campaigns__name_campaign, Campaigns.user_id AS Campaigns__user_id, Users.id AS Users__id, Users.full_name AS Users__full_name, Users.email AS Users__email, Users.password AS Users__password, Users.created AS Users__created, Users.modified AS Users__modified, Users.username AS Users__username, PaidTo.id AS PaidTo__id, PaidTo.percentage AS PaidTo__percentage, PaidTo.user_id AS PaidTo__user_id, Secteurs.id AS Secteurs__id, Secteurs.name_secteur AS Secteurs__name_secteur, Secteurs.user_id AS Secteurs__user_id, SourceProspects.id AS SourceProspects__id, SourceProspects.name_prospect AS SourceProspects__name_prospect, SourceProspects.user_id AS SourceProspects__user_id FROM leads Leads INNER JOIN sale_phases SalePhases ON SalePhases.id = (Leads.sale_phase_id) INNER JOIN campaigns Campaigns ON Campaigns.id = (Leads.campaign_id) INNER JOIN users Users ON Users.id = (Leads.user_id) INNER JOIN paid_to PaidTo ON PaidTo.id = (Leads.paid_to_id) INNER JOIN secteurs Secteurs ON Secteurs.id = (Leads.secteur_id) INNER JOIN leads Leads ON Leads.id = (Leads.lead_type_id) INNER JOIN source_prospects SourceProspects ON SourceProspects.id = (Leads.source_prospect_id) LIMIT 20 OFF

you need to alias one of the Leads table you have 2 aliases with same name and sql doesnt know what you mean:

FROM leads Leads
INNER JOIN leads Leads

in table associations you can ->setAlias()