Category : laravel-7

Hi there, I’m using laravel 7 and cashier (paddle) package. I want to send the product id as an array with Laravel cashier (paddle) passthrough and after payment succeeded, I want to store it in the database. But how to send passthrough and how to store that passthrough data after payment succeeded? Here is myController ..

Read more

Order ID example i have order id = 51 like in this route => /admin/order/51 how to call the order id from routes to Helpers.PHP this my Helpers.PHP public static function getAllProductFromOrderItem($user_id = ”, $order_id = ”) { if (Auth::check()) { if ($user_id == "") $user_id = auth()->user()->id; return OrderItem::with(‘product’)->where(‘user_id’, $user_id)->where(‘order_id’, $order_id)->get(); } else { ..

Read more

I want to show the same category’s subcategory on my images page. But when I am using foreach loop then all subcategory view is happening. demo- https://oyewallpaper.com/photo/28529/rashmika-mandanna-saree-whatsapp-dp-pics-images <h4 style="margin-top:-5px;">Related</h4> <div class="projects-catalog" style=" margin-bottom: -15px;margin-top: -10px;"> <div class="catalog-cover"> <i class="left-button"></i> <ul class="sliderWrapper1 sliderscroll"> @foreach( AppModelsSubCategories::where(‘subcategories_id’, $response->categories_id)->get() as $subcategories ) <?php if( $subcategories->thumbnail == ” ) { ..

Read more

I want to install this code editor on my project: https://ckeditor.com/docs/ckeditor5/latest/builds/guides/predefined-builds/quick-start.html However, for some reason I cannot do so, I want to add the WYSIWYG to my text areas mainly Education and Bio, Here is my app.blade.php file : <!doctype html> <html lang="{{ str_replace(‘_’, ‘-‘, app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!– ..

Read more

basically I want to update this table in one go or bulk update. I wanted to update the "image_id" field on this table. This is my code in the Controller public function storebulk(Request $request,$id) { $ids= [‘8′,’9′,’10’]; //sent from the front-end $barcode = Barcode::where(‘id’, $ids)->update([‘image_id’=>$id]); return ‘Done’; } but for some reason it doesn’t work. ..

Read more

I changed my PC and installed a new xampp where php version is 8+. Now I clone my git laravel project, which one laravel 7. When commend artisan serve it shows me some error like that PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of IlluminateSupportCollection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed ..

Read more

I copied fresh new laravel project from my repository and was having trouble with ArrayAccess functions. As this will be depricated with version PHP 8.0 and PHP 8.1. Does anyone have a quick guide to fix this for legacy projects? Deprecated: Return type of IlluminateConfigRepository::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the ..

Read more

I got this message each time I tape php artisan serve the message: Fatal error: Uncaught Error: Class ‘IlluminateFoundationApplication’ not found in C:laragonwwwmonblogbootstrapapp.php:14 Stack trace: #0 C:laragonwwwmonblogartisan(20): require_once() #1 {main} thrown in C:laragonwwwmonblogbootstrapapp.php on line 14enter code here Sourc..

Read more

$test = DB::table(‘serviceorders’) ->select(‘serviceorders.service_id’, DB::raw(‘COUNT(services.id) AS count’)) ->join(‘services’, ‘serviceorders.service_id’, ‘=’, ‘services.id’) ->groupBy(‘serviceorders.service_id’) ->whereMonth(‘serviceorders.created_at’,Carbon::now("Asia/Kuala_Lumpur")->month) ->get(); this query that i did is to fetch service_id and its count in ServiceOrder model. I have no idea how to fetch the name of an id since it is at another model here’s the result when i dd($test) dd result ..

Read more

I have used JWT in Laravel for user Authentication Auth Controller: <?php namespace AppHttpControllers; use IlluminateHttpRequest; use IlluminateSupportFacadesAuth; use AppModelsUser; use IlluminateAuthEventsVerified; use Validator; use IlluminateSupportStr; use IlluminateSupportFacadesHash; use IlluminateSupportFacadesNotification; class AuthController extends Controller { public function __construct() { $this->middleware(‘auth:api’, [‘except’ => [‘login’, ‘register’]]); } /** * Get a JWT via given credentials. * * ..

Read more

I currently have a resources table : Resources table has the columns: id – title- description – path and a resource_user_role_restrictions table resource_user_role_restrictionstable has the columns: id – resource_id – role_id – viewable My model contains the following function that checks the resource_user_role_restrictions table and returns all resources whose resource_user_role_restrictions.role_id matches the passed in $userRoleId ..

Read more

I want to fetch user who has most points. I’ve two tables users and points. $top10pp = Points::orderBy(‘points’, ‘DESC’)->limit(10)->get(‘ppid’); I’m getting user id as per there points correctly by above query. Then I’m fetching the users by their user id that im getting in $top10pp variable. $psname = $this->getpp($top10pp); I’m calling a function to return ..

Read more

I have following 3 tables Classrooms id subject RegisteredStudents id user_id class_id Posts id class_id type attachment Models Classroom.php public function posts() { return $this->hasMany(Post::class); } RegisteredStudents.php public function classroom() { return $this->belongsTo(Classroom::class); } Post.php public function classroom() { return $this->belongsTo(Classroom::class); } Now I need to get all the posts of particular class, under which ..

Read more

I am facing an issue with laravel 7 while truncating table, even I have used FOREIGN_KEY_CHECKS enable and disable still is return this type of error "Syntax error or access violation: 1701 Cannot truncate a table referenced in a foreign key constraint". Method DB::statement("SET FOREIGN_KEY_CHECKS=0;"); Artisan::call(‘db:seed’, ["–database" => ‘DBNAME’, ‘–force’ => true, "–class" => ‘StatusTableSeeder’]); ..

Read more

In my Laravel project I have used the PhpOffice Spreadsheet for downloading data as excel format from a datatable. For doing that I need to add code in my controller, route and view. Controller I have used below namespaces in my controller <?php namespace AppHttpControllers; use PhpOfficephpspreadsheetsrcPhpSpreadsheetSpreadsheet; use PhpOfficephpspreadsheetsrcPhpSpreadsheetWriterXlsx; use PhpOfficephpspreadsheetsrcPhpSpreadsheetWriterXls; use AppOfferCustomersDataTbl; public function ..

Read more