Category : sql-server

I use Laravel Framework 8.54.0 and livewire. I want to call data for my dropdown form. But I get sqlstate error. Could anyone help me find a way to solve this issue? Model: class Item extends Model { protected $table = ‘item’; protected $primaryKey = ‘idx’; public $timestamps = false; public const CREATED_AT = ‘d_in’; ..

Read more

I’m trying to connect mssql database with php 7.4 and ubuntu 20.04. I installed odbc driver still getting this error. SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver for SQL Server for x64: https://go.microsoft.com/fwlink/?LinkId=163712 (SQL: select distinct [ID], ..

Read more

Laravel: 8.55.0 SqlSrv: 2017 I have a query whose basic structure is like this SELECT [main].* FROM (SELECT TOP 50 [person_view].[person_id] FROM [person_view] GROUP BY [person_view].[person_id] ORDER BY [person_id] ) AS [pagination] LEFT JOIN (SELECT * FROM [person_view]) AS main ON [pagination].[person_id] = [main].[person_id] I accomplish this query using laravel and pagination on the subquery ..

Read more

I want to delete data through the api but it is showing an error because it is necessary to delete records in the properties table. { "message": "SQLSTATE[23000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The DELETE statement conflicted with the REFERENCE constraint "FK_Interests_Properties_User". The conflict occurred in database "PORTALESTADAO_CADASTRO", table "dbo.Interests_Properties", column ‘interests_user_id’. (SQL: delete ..

Read more

I am trying to creating a blog post with Laravel using views (blog.blade.php) inside HTML. The code in my laravel web.php fetches the blog posts from my local mssql server looks as follow (and works): Route::get(‘/blog/{id}’, function($id){ $posts = DB::table(‘blog_posts’)->get(); return view(‘blog’, [‘id’=>$id], [‘posts’=>$posts]); }); In the laravel views dir home.blade.php my code works with ..

Read more

How can i make this query in Laravel? SELECT GS_CONTRATOS.*,GS_ACESSOS.* from GS_CONTRATOS full outer join GS_ACESSOS on GS_ACESSOS.CONTRATO_ID=GS_CONTRATOS.ID where EMPRESA_ID=’1′ and (WEBUSER=’ec’ or WEBUSER is null) i got my one like this and its not working.. $contratos = Contrato::query() ->join(‘GS_ACESSOS’,’GS_ACESSOS.CONTRATO_ID’,’=’,’GS_CONTRATOS.ID’,’full outer’) ->where(‘GS_ACESSOS.WEBUSER’,’=’,$id)->orWhere(‘EMPRESA_ID’,’=’,$emp) ->get([‘GS_CONTRATOS.*’,’GS_ACESSOS.*’]); Sourc..

Read more

I need your help, I’m having problems when migrating table to sql server database, I’ve added the driver in the php/ext folder but when the migration always fails, I don’t forget to change the php.ini file and add extension: php_pdo_sqlsrv.dll but it still fails to migrate please help code PDO::__construct() PS D:kerjaINDOPRIMAERPerpindowire> php artisan migrate ..

Read more

I have two models in a Laravel application Ft and Fi. Ft contains the following code: protected $table = ‘ft’; protected $connection = ‘XXX’; protected $keyType = ‘string’; public function lines() { return $this->hasMany(‘AppFi’, ‘ftstamp’, ‘ftstamp’); } Fi contains the following code: protected $table = ‘fi’; In my controller I have the following code Ft::select($fields)->with([‘lines’]) ..

Read more

The problem is that I have made a relationship between 3 tables and I want to list the result in the view by grouping it only by barcode. My controller function is as follows; public function index(Request $request){ $data = DB::table(‘orderItems as SS’) ->select(DB::raw(‘SS.barcode, MAX(SS.productName) as productName, SUM(SS.quantity) as quantity, COALESCE(NULLIF(MAX(B.salePrice),0), MAX(B.regularPrice)) as unitPrice’)) ->leftJoin(‘products ..

Read more

The problem is that I have made a relationship between 3 tables and I want to list the result in the view by grouping it only by barcode. My controller function is as follows; public function index(Request $request){ $data = DB::table(‘orderItems as SS’) ->select(DB::raw(‘SS.barcode, MAX(SS.productName) as productName, SUM(SS.quantity) as quantity, COALESCE(NULLIF(MAX(B.salePrice),0), MAX(B.regularPrice)) as unitPrice’)) ->leftJoin(‘products ..

Read more