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
Showing posts with label Laravel. Show all posts
Showing posts with label Laravel. Show all posts

30 April, 2024

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 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

27 September, 2023

Solved max_user_connections in laravel

 Programing Coderfunda     September 27, 2023     Laravel     No comments   

 

max_user_connections and other problems!!

Go the Config folder then open database then change only options after your problem will be solved

/abc/config/database.php

abc = is a folder name where you install the laravel 
'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            //'strict' => true,
            'strict' => false,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                // PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
                PDO::ATTR_PERSISTENT => false
            ]) : [],
        ],

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

29 August, 2023

Laravel Ajax Cross-Origin Request Blocked ?

 Programing Coderfunda     August 29, 2023     Ajax, Laravel     No comments   

 

You can enable CORS in Laravel by adding the following code to the app/Http/Middleware/VerifyCsrfToken.php file:

protected $addHttpCookie = true;

protected $except = [

'/*'

];

This code tells Laravel to exclude all routes from CSRF protection, allowing cross-origin requests to be made without being blocked.

You can also use this Alternatively way.

Step 1: Install Compose Package

Alternatively, you can install the barryvdh/laravel-cors package using Composer to enable CORS in your Laravel application. This package provides a middleware that you can add to your Laravel application to allow cross-origin requests. Here are the steps to install and use the package:

Install the package using Composer:

composer require barryvdh/laravel-cors

Step 2: Add Middleware

Add the following code to the $middleware array in the app/Http/Kernel.php file:

\Barryvdh\Cors\HandleCors::class

Step 2: Configure CORS

Add the following code to the config/cors.php file to specify the domains that are allowed to make cross-origin requests:


'allowed_origins' => [

'*',

],

'allowed_methods' => [

'POST',

'GET',

'OPTIONS',

'PUT',

'PATCH',

'DELETE',

],

'allowed_headers' => [

'Content-Type',

'X-Requested-With',

'Authorization',

],

With these steps,

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

25 May, 2023

On Click Submit Button Save Data by Ajax Laravel

 Programing Coderfunda     May 25, 2023     Ajax, Laravel     No comments   

 


    View Page blade page

         <div class="button like" value="{{ $color->id}}">
            <div class="icon" icon="like"></div>
             <span> {{ isset($color->likecount) ? $color->likecount : Null }}</span>
        </div>

            <script>
                        $('.like').on('click',function(e){
                            let likeid = $(this).attr('value');
                            $(".like").removeClass('active');
                            $(this).addClass('active');
                           
                            $.ajax({
                            url: "{{url('/like')}}",
                            type:"POST",
                            data:{
                                "_token": "{{ csrf_token() }}",
                                likeid:likeid,
                            },
                            success:function(response){
                            $(".like.active span").text(response);
                            }
                            });
                            });
                    </script>

    Web.php
        URL
    
    Route::post('/like',[MainSettingController::class, 'likebtn']);

Controller :


 public function  likebtn(Request $request){
   
    $like = Color::where('id', $request->likeid)->first();
   
    if(empty($like)){
        $oldcount =  1;
        // $oldcount = $like->likecount;
        $statusid = $oldcount+1;
        $ab =  Color::where('id', $request->likeid)->update(['likecount'=>$statusid]);
       
    }else{
        $oldcount = $like->likecount;
        $statusid = $oldcount+1;
       
        $ab =  Color::where('id', $request->likeid)->update(['likecount'=>$statusid]);
    }
   
    $totallike = Color::where('id', $request->likeid)->first();
    return $totallike->likecount;
   
}

Example : https://colorshunt.com/palette/ffebbc5da7ae543d46292830
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

18 May, 2023

Small but powerful CLI apps with Minicli

 Programing Coderfunda     May 18, 2023     Laravel     No comments   

 Minicli is a lightweight PHP structure for building order line applications. While it gives a moderate methodology, you can in any case make strong CLI applications with it. Here are some little yet strong CLI application thoughts that you can carry out utilizing Minicli:


Schedule Director: Make an order line application that permits clients to deal with their errands and plans for the day. Clients can add undertakings, mark them as finished, erase errands, and view their rundown.


Climate Correspondent: Foster a CLI application that gets climate information from a climate Programming interface in view of client input (e.g., city or Postal division). It can show current atmospheric conditions, figures, and other important data.


Document Coordinator: Fabricate a CLI application that sorts out records in a registry in light of their sort, expansion, or different models. Clients can determine the source and objective catalogs, and the application will move or duplicate documents in like manner.


Secret phrase Generator: Make a CLI application that produces solid, irregular passwords in view of client characterized models like length, consideration of extraordinary characters, or explicit person sets.


URL Shortener: Foster a CLI application that interfaces with a URL shortening administration Programming interface to abbreviate long URLs and give an abbreviated variant to more straightforward sharing.


Word Counter: Form a CLI application that takes a text document or contribution from the client and counts the quantity of words, characters, lines, or other pertinent insights.


ASCII Workmanship Generator: Foster a CLI application that changes over a picture or text input into ASCII craftsmanship. Clients can determine the information record, textual style, and other customization choices.


Markdown to HTML Converter: Make a CLI application that changes over Markdown documents to HTML. Clients can indicate the information record and alternatively tweak the result document area and arrangement.


Keep in mind, these are only a few guides to kick you off. With Minicli, you have the adaptability to make different sorts of order line applications in view of your particular prerequisites. You can use the effortlessness and extensibility of Minicli to fabricate little yet strong CLI applications custom fitted to your requirements.


Here new way ....

Building CLI applications can be a lot of fun. We don't have to worry about the UI, and we can write beautiful PHP code that doesn't need any build steps.

When building CLI applications in PHP, we aren't as spoilt for choice as in building web applications - but there are some solid contenders. From using the defacto standard Symfony Console component or the extra spicy Laravel Zero. However, when building a CLI application, you may want to be as dependency free as possible - which is where Minicli comes in. Minicli was released a while ago by Erika Heidi as an experiment to build a dependency-free CLI framework that leaned on PHPs readline extension as its only dependency.

I have been spending a lot of time investigating CLI options for a project I am working on. At first, I started with my usual choice: Laravel Zero. It is familiar to me and any other developer who knows Laravel. Then I started questioning the portability aspect and requiring PHP for people who want to use it. This is for work, and not all of our users have PHP installed. So I dived into the world of compiled languages, looking at both GoLang and Rust. While there aren't many options available, the options out there are excellent.

There has been a lot of talk about native PHP recently, which drew my attention back toward the PHP space. What if I could build a lightweight, easy-to-maintain, and portable PHP CLI application? This was when I took another look at Minicli. Having played with it when it first came out, I was impressed with how nice it was to use for something dependency free - but also how easy it was to get started!

The recommended approach for building a Minicli application is to use the application skeleton and composer to set everything up and ready for you.

composer create-project --prefer-dist minicli/application my-awesome-idea

The directories should be familiar enough for you as Laravel developers, having an app directory and namespace. The commands you can create are recommended to be built as Command Controllers, which are class-based commands.

We create a command namespace under app/Commands, where you keep your commands.

mkdir app/Commands/LaravelNews

Under each namespace, you can add multiple commands for different variations. It is inferred that if no arguments are passed, you will want to use the DefaultController. Let's have a look at how to create a command.

declare(strict_types=1);
 
namespace App\Command\LaravelNews;
 
use Minicli\Command\CommandController;
 
final class DefaultController extends CommandController
{
public function handle(): void
{
$this->getPrinter()->display("Laravel News rocks");
}
}

Each command controller must be handled and doesn't have to return anything - unlike in Symfony or Laravel Zero, where an exit code is expected. To interact with output, you get the printer - and ask it to output something.

So, if we want to add an alternative version - we can create another command controller in our namespace.

declare(strict_types=1);
 
namespace App\Command\LaravelNews;
 
use Minicli\Command\CommandController;
 
final class InfoController extends CommandController
{
public function handle(): void
{
$this->getPrinter()->info("Laravel News rocks");
}
}

Now we can call our command:

./minicli laravel-news info

Which will give a different view to the default command, and we can use the following other options:

display(): A simple text output.
info(): An informative text output.
error(): An error formatted text output.
success(): A success formatted text output.

Each option accepts a second argument as alt for alternative output, which will do a block color output with writing instead of colored writing.

It isn't as pretty as something like Laravel Zero using Termwind - but sometimes you don't need pretty!

Usually, when building a CLI application, we want to interact with a third-party API or another service to perform an action or logic. In Minicli, this is done by creating services.

// minicli
$app = new App();
$app->registerService(
'email',
new MyEmailImplementation(),
);

Then within our commands, we can get the app instance and call our service directly:

public function handle(): void
{
$service = $this->getApp()->email;
 
try {
$service->send(new EmailTemplate());
} catch (Throwable $exception) {
$this->getPrinter()->error($exception->getMessage());
}
}

So we have a lightweight, powerful CLI framework that we can leverage to aid in our development workflow - that has no dependencies allowing us to write beautiful PHP.



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

Meta

Popular Posts

  • Sitaare Zameen Par Full Movie Review
     Here’s a  complete Vue.js tutorial for beginners to master level , structured in a progressive and simple way. It covers all essential topi...
  • 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...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...
  • 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...
  • 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...

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 (69)
  • 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

  • July (4)
  • 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