skip to Main Content

Sum of sum in Laravel model

I'm building a tool that has the following hierarchy: Client > Projects > Stages Each stage has a 'price' value. The project has a 'value' attribute, which is just the dynamic sum of its stages. Now, I also want the…

VIEW QUESTION

Laravel Routing adding template name

I have a blade template called by Lodge.upload. Within that template I have the following code: <form name="app" action="storeSummons" enctype="multipart/form-data" method="post"> In my route files I have this: Route::post('/storeSummons',[AppHttpControllersLodgesController::class,'storeSummons'])->name('storeSummons'); When I try to post from this simple form (only two…

VIEW QUESTION

I am using laravel livewire 3 get page not found

when click I get page not found and in consle error : POST http://localhost/livewire/update 404 (Not Found) counter.blade.php <div> <h1>{{ $this->count }}</h1> <button wire:click="increment">+</button> <button wire:click="decrement">-</button> </div> in blade I have the following : @section('custom-js') @livewireScripts @endsection @section('custom-css') @livewireStyles @endsection…

VIEW QUESTION

Laravel – How To Distinct By Year and GroupBy Category On Same Query?

I want to make a result from query after distinct and groupby This is My Code $results = DB::table('dokumen') ->join('pengadaan', 'dokumen.id_jenis_pengadaan', '=', 'pengadaan.id') ->select( DB::raw('COUNT(nama_paket) AS jml'), DB::raw('jenis_pengadaan as jenis_pengadaan'), DB::raw('tahun as tahun') ) ->groupBy('jenis_pengadaan', 'tahun') ->orderBy('tahun') ->get(); $hasil =…

VIEW QUESTION

Illegal operator and value combination in Laravel 8

Why is there always an error when doing more than seven days? public function paginated(Request $request) { $fromDate = $request->fromDate ? Carbon::parse($request->fromDate) : Carbon::now(); $toDate = $request->toDate ? Carbon::parse($request->toDate) : Carbon::now(); $query = Vehicle::with('make') ->with('class') ->with([ 'status' => function ($query)…

VIEW QUESTION

OrderBy Laravel Eloquent Relationship

I would like to order listing_data based on listing_packages.order . Here is the query ListingData::with(['listing_package'])->orderBy('listing_package.order','desc')->paginate(24); I would like to order based on listing_package.order "DESCENDING" However, it returns SQLSTATE[42S22]: Column not found: 1054 Unknown column 'listing_package.order' in 'order clause' Here is…

VIEW QUESTION

Multiples queries (N+1) using Eager Loading – Laravel

I'm trying to load all the contacts with the conversation, and it's working unless I try to access the conversation attributes. $contatos = Contato::whereBelongsTo($conta)->with('Conversa')->get(); foreach ($contatos as $contato) { $saida_contato = new stdClass(); $saida_contato->nome_contato = $contato->nome; $saida_contato->id = $contato->id; $saida_contato->numero_contato…

VIEW QUESTION
Back To Top
Search