skip to Main Content

Laravel eloquent multiple WHERE

I'm new in php/laravel. I'm trying to get one user with the userName of the user connected except if it's "Chuck NORRIS" This, is working. I'm getting the user connected information $oneUser= User::where('name', $userName)->get(); This, is not working. I'm getting…

VIEW QUESTION

How do I do pagination on my code in Laravel?

So my front-end Lists of Businesses are not in paginated style. But I do not know how to do it. Can anyone please help? The code I posted is in my BusinessListController.php BusinessListController.php `<?php namespace AppHttpControllers; use AppModelsBusiness; use AppModelsCategory;…

VIEW QUESTION

Laravel export file with dynamic name

I am running a script that stores the collected data in csv. It's working like that: $responce = Excel::store(new UsersExport($formatted_data), 'fileName.csv', null, MaatwebsiteExcelExcel::CSV); And that's my class: class UsersExport implements FromArray { protected $invoices; public function __construct(array $invoices) { $this->invoices…

VIEW QUESTION

Passing multiple variable using compact in Laravel

I have a function which return the view with multiple variable. The code is HomeController.php public function profilePage(){ $data = User::all(); $book = Library::all(); return view('page.profile' , compact(array('data', 'book'))); } profile.blade.php @include('layouts.sidebar') . . . @foreach($book as $Library) <tr> <td>{{$Library->book}}</td>…

VIEW QUESTION

I got this error on laravel project- Error Exception Trying to get property 'sales_price' of non-object

I get this error form helper.php. I need sale prices of product. but I get this error.And I dont understand when I get this error. helper.php public static function getSalesPriceUsingProductIDCode($id, $customerId) { $data = PosCustomerProducts::valid()->where('complete_status',0)->where('customer_id', $customerId)->where('product_id', $id) ->select('product_id', 'sales_price') ->first()->sales_price;…

VIEW QUESTION

laravel 9 anchor button returning error 404

Im using an achor to click a button to navigate to other page. However, it doesnt work and return a 404 error not found. My destination blade is : inventory.blade.php: <a class="d-xl-flex align-items-xl-center" href="{{ url('inventory/add')}}" style="padding-right: 0px;margin-right: 15px;"><button class="btn btn-primary…

VIEW QUESTION
Back To Top
Search