CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

30 April, 2024

Dismissibles for Laravel. Handle recurring modals/popups/notifications with ease.

 Programing Coderfunda     April 30, 2024     No comments   

​


https://preview.redd.it/h3zi0m63nmxc1.jpg?width=1254&format=pjpg&auto=webp&s=91a09bcfca986f45ded401b894c80d26973c36bb

Hi, all. I just released my first package: Dismissibles for Laravel. Hopefully it helps some people save time and manage recurring dismissibles with ease! Let me know what you think. submitted by /u/Rellix77
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel-excel Failed to load as a DOM Document 100% Worked

 Programing Coderfunda     April 30, 2024     Excel, Laravel     No comments   

  User the export file and controller function 

..

        libxml_use_internal_errors(true);

..Good To Go


 public function view(): View
    {
       
        $invoices = History::with('abc')->get();
     

        libxml_use_internal_errors(true);      


        return view('export.soaap',compact('invoices'));
       
    }


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

failed to load storage framework cache laravel excel

 Programing Coderfunda     April 30, 2024     Excel     No comments   

   User the export file and controller function 

..

        libxml_use_internal_errors(true);

..Good To Go


 public function view(): View
    {
       
        $invoices = History::with('abc')->get();
     

        libxml_use_internal_errors(true);      


        return view('export.soaap',compact('invoices'));
       
    }


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Failed to load C:\xampp\htdocs\amb\storage\framework\cache\laravel-excel\laravel-excel-qstLPEJphn1YP2RNamob7mesa927XVjT.html as a DOM Document

 Programing Coderfunda     April 30, 2024     Excel, Laravel     No comments   

 User the export file and controller function 

..

        libxml_use_internal_errors(true);

..Good To Go


 public function view(): View
    {
       
        $invoices = History::with('abc')->get();
     

        libxml_use_internal_errors(true);      


        return view('export.soaap',compact('invoices'));
       
    }


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Listing pods associated with a deployment

 Programing Coderfunda     April 30, 2024     No comments   

How do I get a list of all pods associated with a deployment? In the GUI, it's as simple as clicking on the deployment and checking the pods tab. However, I can't find a way using the CLI.


I've tried using a script that uses string matching to check if the pod name begins with the deployment name, but it's not really sufficient due to the possibility of deployments beginning with the same string.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

disable global middleware from some pages - nuxt 3

 Programing Coderfunda     April 30, 2024     No comments   

When you set the middleware as global, and let's say myMid.global.ts, there are some pages on which I do not want this middleware to work. I searched and found a way using route name, and I want a better way. For example, on the page where I do not want it to work, I put, for example:


some-ex-page.vue :


definePageMeta({
myMid : false
});





Or anything else. Most pages need this middleware, but there are pages that do not. I do not think it is a good idea to go through all of these pages and manually enter the name of the middleware:


some-ex-page.vue :


definePageMeta({
middleware : ["myMid"]
});





Or, for example, there is a way to add a new property to the page. In the middleware, I can check that if this property exists, I will avoid working from this page.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

29 April, 2024

HTML::Element endtag generates end tags for and

 Programing Coderfunda     April 29, 2024     No comments   

I'm using the following Perl code to traverse and format some HTML:
#!/usr/bin/env perl
use v5.38;
use HTML::TreeBuilder;
my $indent = 3;
my $content = do {local $/; };
my $tree = HTML::TreeBuilder->new();
$tree->parse_content($content);
visit($tree);

sub visit($x) {
my $depth = $x->depth;
my $in = ' ' x ($indent * $depth);
foreach my $e ($x->content_list) {
# element
if (ref ($e)) {
say $in . $e->starttag;
visit($e);
say $in . $e->endtag;
}
# text
else {
say $in . $e;
}
}
}
__DATA__







5/5/61 Bob & Jerry - Arroyo Lounge, Stanford University, Palo Alto, CA




(Robert Hunter and Jerry Garcia; source: McNally, Jackson research)





5/26/61 Bob & Jerry - Barbara Meier's 16th birthday party, Menlo Park, CA



Follow The Drinking Gourd, John Henry, Santy Anno*, Poor Paddy Works On The Railway


(*included on
Before The Dead
;
birthday doodle for Barbara by Jerry
;
the master tape

)







My problem is that each
is output as:






Both
and cause new lines to be rendered. I was surprised that endtag generated anything at all in the case of tag br (and img).


I avoided using HTML::Tree::traverse because the doc discourages its use:



[I]f you want to recursively visit every node in the tree, it's almost
always simpler to write a subroutine does just that, than it is to
bundle up the pre- and/or post-order code in callbacks for the
traverse method.



There are no examples given, so the above is what I cooked up.


Am I using starttag and endtag correctly? Should I detect when I'm displaying a tag that doesn't take an end tag and avoid calling endtag? What's the right/best/simplest way to traverse an HTML tree and prettify it?


Update:


As suggested by Stephen Ullrich, I tried to use as_HTML() for formatting:
#!/usr/bin/env perl
use v5.38;
use HTML::TreeBuilder;
say "\%HTML::Element::optionalEndTag= ",
join ', ', keys %HTML::Element::optionalEndTag;
my $content = do {local $/; };
my $tree = HTML::TreeBuilder->new();
$tree->parse_content($content);
# don't encode any entities; indent with three spaces;
say $tree->as_HTML('', ' ');
__DATA__







5/5/61 Bob & Jerry - Arroyo Lounge, Stanford University, Palo Alto, CA




(Robert Hunter and Jerry Garcia; source: McNally, Jackson research)





5/26/61 Bob & Jerry - Barbara Meier's 16th birthday party, Menlo Park, CA



Follow The Drinking Gourd, John Henry, Santy Anno*, Poor Paddy Works On The Railway


(*included on
Before The Dead
;
birthday doodle for Barbara by Jerry
;
the master tape

)







Output:
%HTML::Element::optionalEndTag= dt, dd, li, p





5/5/61 Bob & Jerry - Arroyo Lounge, Stanford University, Palo Alto, CA
(Robert Hunter and Jerry Garcia; source: McNally, Jackson research)


5/26/61 Bob & Jerry - Barbara Meier's 16th birthday party, Menlo Park, CA
Follow The Drinking Gourd, John Henry, Santy Anno*, Poor Paddy Works On The Railway
(*included on Before The Dead ; birthday doodle for Barbara by Jerry ; the master tape )








Unfortunately, this isn't "pretty" enough. I don't understand why the indenting leaves off after the first couple of levels. However, I do note that it doesn't generate or , despite the fact that neither of these tags is mentioned in %HTML::Element::optionalEndTag!
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How to prevent Firebase Authentication creating a new user implicitly on first sign-in?

 Programing Coderfunda     April 29, 2024     No comments   

I have a Firebase backed React Native application which allows customers to sign in via email/password, Google ID or Apple ID. It's mainly working fine but I've noticed a UX problem which stems from the behaviour of the signInWithCredential method which creates a new user implicitly on first sign in.



You create a new user in your Firebase project by calling the createUserWithEmailAndPassword method or by signing in a user for the first time using a federated identity provider, such as Google Sign-In or Facebook Login.

https://firebase.google.com/docs/auth/web/manage-users#create_a_user />


This seems handy and meant my "register" or "sign up" function was basically the same as my "login" function.


However from the customer's perspective it's confusing. E.g. if they come to the app and forget they used email/password to sign-up and click "Sign in with Google", click accept in the OAuth popup, then they get logged in to a brand new account they've never used before and of course their previous data/history/purchases are absent.


If a new customer signs in via OAuth, I want to receive the auth/user-not-found error as listed in the API docs here so that I can present the "normal" UX of saying "You don't have an account with those credentials, please sign up first" or similar to apply some friction and help the user to realise they're on the wrong path. i.e. I want sign up to be completely independent from sign in and prevent accidental, spurious accounts being created.


BTW I understand (and have tested) that if a customer subsequently uses a second provider which shares the same email address already registered, then Firebase does some clever stuff to migrate or unify the accounts. But I can't be sure a customer's Google ID would match the email they used with an email/password account creation (e.g. work vs personal or other reasons) so there would still be duplicate/spurious accounts. There's also the "one account per email" option to tweak this)


I actually find it curious that there don't seem to be any discussions about this, as the lack of a "don't auto-register" flag prevents a typical UX supporting a clear difference between "new here? signup" onboarding vs. "got an account? login" for existing customers. So perhaps I'm missing something obvious.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel vs. Next.js: Addressing Client Inquiries

 Programing Coderfunda     April 29, 2024     No comments   

Hey everyone,

Clients often inquire why I tend to favor Laravel over other frameworks for certain projects. Honestly, it often comes down to personal preference rather than a strictly technical decision. I simply have a fondness for Laravel's extensive ecosystem of packages, which not only streamlines development but also provides a robust backend solution.

That being said, there are instances where I could easily use Next.js for all aspects of a project. However, despite its versatility, I find myself gravitating towards Laravel for its familiarity and the comfort it brings to my workflow.

I'm curious to hear if clients have asked you why you choose Laravel and how do you articulate its benefits to them?

Looking forward to hearing your thoughts! 🚀 submitted by /u/One-Philosophy-1362
[link] [comments]
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

How do I run a scheduled AWS Fargate task as a one-off?

 Programing Coderfunda     April 29, 2024     No comments   

For a system I'm building, I have set up an AWS scheduled Fargate task through the python cdk. This task is started every hour and retrieves events from the past hour from some external endpoint to further process. This scheduled task works to satisfaction.


Now, I want to also be able to run this task on demand. This will be for initial loads where (much) more than one hour of event data is to be retrieved, or for corrective loads when the sheduled task has failed for any reason. These will probably not need to happen more than about once each two months.

---



Is there a way I can create a one-off task, preferably with altered environment variables, from my already-defined scheduled Fargate task? This one-off task should then be able to be started ad-hoc from the AWS dashboard.

---



As it stands, I can manually start a new one-off task from the task definition I created for the scheduled Fargate task. But this requires the user (which won't always be me) to specify all sorts of parameters like selecting the vpc, subnets, and environment variable overrides. I'd rather reuse those specified for the scheduled fargate tasks, or have them stored somewhere, so that these don't need be entered manually. Is this possible?


Related questions




I feel my question is similar to this one, but the page linked to in that answer does not really tell me how to accomplish a one-off or "standalone" task through the cdk.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Send message via CANBus

 Programing Coderfunda     April 29, 2024     No comments   

After some years developing for mobile devices, I've started developing for embedded devices, and I'm finding a new problem now.
This embedded device has the same peripherals as a mobile phone, ie, WiFi, BT, USB, etc. but it also has a CANBUS connector, and I need to communicate through it.


The problem I'm facing is that I don't find much information of how to do this.


I would appreciate if anyone who has experienced with it could show me the way of doing it, at least, how can I start with it. The basic functionality that I need to achieve is to send a basic message through CANBUS from the embedded.
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

11 April, 2024

Create Reusable Blade Components in Laravel

 Programing Coderfunda     April 11, 2024     No comments   

In Laravel, reusable Blade components provide a convenient way to encapsulate UI elements and logic for reuse across your application. Let's walk through creating and using reusable Blade components in Laravel: 1. **Create a Component:** To create a Blade component, you can use the `make:component` Artisan command: ```bash php artisan make:component Button ``` This command will generate a new Blade component class in the `app/View/Components` directory. 2. **Define Component Logic:** Open the generated component class (`Button.php` in this case) and define the logic for your component. This includes properties, methods, and rendering logic. ```php <?php namespace App\View\Components; use Illuminate\View\Component; class Button extends Component { public $type; public $text; public function __construct($type = 'primary', $text) { $this->type = $type; $this->text = $text; } public function render() { return view('components.button'); } } ``` 3. **Create the Blade View:** Next, create the Blade view file for your component. By default, Laravel expects this file to be located in `resources/views/components`. So create a file named `button.blade.php` in that directory. ```blade <button class="btn btn-{{ $type }}">{{ $text }}</button> ``` 4. **Use the Component:** You can now use your component in any Blade view by using its tag name. For example: ```blade <x-button type="primary" text="Click me" /> ``` This will render a button with the specified type and text. 5. **Passing Data to Components:** You can pass data to your component by adding public properties to the component class. These properties can be set when you include the component in your Blade views. 6. **Reusing Components:** You can reuse your component across your application wherever needed. Simply include the component tag with the desired properties. By following these steps, you can create reusable Blade components in Laravel to keep your UI code organized and DRY (Don't Repeat Yourself).

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Laravel Upgrading from Laravel 10 to Laravel 11

 Programing Coderfunda     April 11, 2024     No comments   

 The detailed upgrade document is available on the official Laravel document.

Also, read the Laravel 11 release notes. It will help us to upgrade our application.

1. PHP Version

Our first step is to upgrade your PHP version. Laravel 11 requires PHP 8.2.0 or greater.

2. Update Composer Dependencies

Now open our composer.json and update the following dependencies

  • php to^8.2
  • laravel/framework to ^11.0
  • Remove the guzzlehttp/guzzle package. Because it is already included in laravel/framework
  • nunomaduro/collision to ^8.1

I have updated some require-dev packages to match the Laravel 11 composer.json

diff --git a/composer.json b/composer.json
index 546a826..22a7942 100644
--- a/composer.json
+++ b/composer.json
@@ -5,25 +5,24 @@
"keywords": ["framework", "laravel", "boilerplate", "admin panel"],
"license": "MIT",
"require": {
- "php": "^8.1",
+ "php": "^8.2",
"balajidharma/laravel-admin-core": "^1.0",
- "guzzlehttp/guzzle": "^7.2",
- "laravel/framework": "^10.0",
- "laravel/sanctum": "^3.2",
- "laravel/tinker": "^2.8",
+ "laravel/framework": "^11.0",
+ "laravel/tinker": "^2.9",
"spatie/laravel-permission": "^5.5"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.7",
- "fakerphp/faker": "^1.9.1",
+ "fakerphp/faker": "^1.23",
"laravel/breeze": "^1.7",
"laravel/dusk": "^7.1",
- "laravel/pint": "^1.0",
- "laravel/sail": "^1.18",
- "mockery/mockery": "^1.4.4",
- "nunomaduro/collision": "^7.0",
- "phpunit/phpunit": "^10.0",
- "spatie/laravel-ignition": "^2.0"
+ "laravel/pint": "^1.13",
+ "laravel/sail": "^1.26",
+ "mockery/mockery": "^1.6",
+ "nunomaduro/collision": "^8.1",
+ "phpunit/phpunit": "^10.5",
+ "spatie/laravel-ignition": "^2.4"
},
"autoload": {
"psr-4": {

Also, update the below package if you have installed

  • laravel/cashier-stripe to ^15.0
  • laravel/passport to ^12.0
  • laravel/sanctum to ^4.0
  • laravel/spark-stripe to ^5.0
  • laravel/telescope to ^5.0

3. Run composer update

We have updated all the dependencies on composer.json. Now is the time to run the composer update

./vendor/bin/sail composer update

I am getting the below error due to the laravel/breeze not supporting Laravel 11.

So, we need to find the latest version of laravel/breeze and add it to the composer.json file

  • laravel/breeze to ^2.0

Now getting the same error forlaravel/dusk

so update Dusk to the latest version

  • laravel/dusk to ^8.0

Again we getting errors, this time on our admin panel supporting packages

So, I am going to include Laravel 11 on both Laravel Menu and Laravel Category packages.

"illuminate/support": "^8.71|^9.0|^10.0|^11.0"

Again, this error is due to the spatie/laravel-permission. I am included spatie/laravel-permission in the application and admin code package.

So, going to remove spatie/laravel-permission and update the latest version of the admin code package.

finally, the composer update worked.

4. Check Laravel Version

To check the Laravel version, run the below command

./vendor/bin/sail artisan -v

//or

./vendor/bin/sail artisan --version

//If you not using sail
php artisan --version

Now our Admin Panel is using the Laravel 11.

5. Updating Sanctum

Now open the application in the browser. It throws the Fatal Error.

We are currently not using the Laravel Sanctum on the Admin Panel. So, I am going to remove the HasApiTokens from the user model.

Laravel 11 no longer supports Laravel Sanctum 3.x. Therefore, you should update your application’s Laravel Sanctum dependency to ^4.0 in your composer.json file.

If you're using Sanctum follow the steps mentioned in the upgrade document.

Now the admin panel is loading without errors

6. Remove Config Files

Taylor has introduced a slimmer config version. So, in Laravel 11 below the config is missing

  • config/broadcasting.php
  • config/cors.php
  • config/hashing.php
  • config/sanctum.php
  • config/view.php

We can publish them manually, with this command

php artisan config:publish

OR

php artisan config:publish --all

So, we deleted the below config files similar to Laravel 11

        deleted:    config/broadcasting.php
deleted: config/cors.php
deleted: config/hashing.php
deleted: config/sanctum.php
deleted: config/view.php

7. Update package.json

Laravel 11 is using the Vite version 5. So, we are going to update the Vite version. Also, we going to add the type to the module on package.json.

Find below the updated package.json file.

diff --git a/package.json b/package.json
index 2effbfc..30feaba 100644
--- a/package.json
+++ b/package.json
@@ -1,20 +1,17 @@
{
"private": true,
+ "type": "module",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"devDependencies": {
"@tailwindcss/forms": "^0.5.2",
- "alpinejs": "^3.4.2",
"autoprefixer": "^10.4.2",
- "axios": "^1.1.2",
- "laravel-vite-plugin": "^0.8.0",
- "lodash": "^4.17.19",
- "postcss": "^8.4.6",
- "postcss-import": "^14.0.1",
+ "axios": "^1.6.4",
+ "laravel-vite-plugin": "^1.0",
"tailwindcss": "^3.2.4",
- "vite": "^4.0.0"
+ "vite": "^5.0"
},
"dependencies": {
"daisyui": "^3.0.0",

We have removed alpinejs, lodash as per Laravel 11 package.json. We need to remove the alpinejs, lodash includes in resources/js/app.js and resources/js/bootstrap.js. After the removal, our app.js and bootstrap.js will have below-slim code.

resources/js/app.js

import './bootstrap';

resources/js/bootstrap.js

import axios from 'axios';
window.axios = axios;

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

Now run the npm update after the npm update run the npm run dev

The fix the below error we need to update the postcss.config.js Because we updated the type as a module.

Add export default on postcss.config.js

export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};

Now our Laravel Admin Panel is upgraded with Laravel 11.

Thank you for reading.

Source : Balaji Dharma (Medium)

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • iOS 17 Force Screen Rotation not working on iPAD only
    I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devic...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...
  • Send message via CANBus
    After some years developing for mobile devices, I've started developing for embedded devices, and I'm finding a new problem now. Th...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda