Laravel

npm rebuild node-sass

// Sometimes this will throw an error along these lines
gyp ERR! stack Error: `make` failed with exit code: 2

// The most likely thing is that the version of node-sass installed on your project is incompatible to your version of Node

// To fix this, visit https://github.com/sass/node-sass#supported-nodejs-versions-vary-by-release-please-consult-the-releases-page-below-is-a-quick-guide-for-minimum-support to confirm whether this is the case. If so, install n (the interactive version manager) by running:

npm install -g n
// make cache folder (if missing) and take ownership
sudo mkdir -p /usr/local/n
sudo chown -R $(whoami) /usr/local/n

// Install the appropriate version of node
n 10.16.0 
// or 
n lts // for the most recent stable release with long term support

// If it throws a sudo error along these lines,

Error: sudo required (or change ownership, or define N_PREFIX)

// Take ownership of node install destination folders
sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share
php artisan passport:keys

php artisan passport:client --personal
 $query->with(['report', 'report.customer'])
* * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1


// To create the crontab file, run crontab -e in your project folder
<button type="submit" id="customers_filter" onclick="checkWhetherTheTableContainsSearchResults()"
                                class="btn filter-button d-inline-block ml-3">
                                Filter
                            </button>
                            
<input id="search-hidden-input" hidden name="searchValue">

<script>
function checkWhetherTheTableContainsSearchResults() {
        let search = location.search.substring(1)
            searchInputElement = document.getElementById('search-hidden-input');
        
        if(search != '') {
            searchInputElement.setAttribute('value', search);
        }
    }
</script>
    
// If the filter is to work on search results, the original search parameter has to be passed into the request array.
        // Thus, the request array will return more than one parameter 
        // AND
        // one of the parameters will be searchValue
        // WHICH
        // will contain the entire search parameter (key + value)

        if ((count($request->all()) > 1) && (isset($request->searchValue))) {
            if (strpos($request->searchValue, '=')) {
                $string = $request->searchValue;
                $array = explode('=', $string);
                $request->searchValue = $array[1];
            }
        }
// you could use the invokable flag so you don't use the index

php artisan make:controller PagesController --invokable

// and then use this route:
Route::get('/{any?}', App\Http\Controllers\PagesController::class)->where('any', '.*');

// it tells Laravel routing to respond to any route provided or nothing with the question mark "?" and responds with an invokable controller

    public function __invoke()
    {
        return view('welcome');
    }
// Route code

Route::get('/test/excel', function() {
    $zip_file = 'invoices.zip'; // Name of our archive to download

    // Initializing PHP class
    $zip = new \ZipArchive();
    $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);

    $invoice_file = 'app/exports/file.xls'; // This is a storage file path - as in, storage/app/exports/file.xls

    // Adding file: second parameter is what will the path inside of the archive
    // So it will create another folder called "storage/" inside ZIP, and put the file there.
    $zip->addFile(storage_path($invoice_file), $invoice_file);
    $zip->close();

    // We return the file immediately after download
    event(new TestExcel($zip_file));

    flash()->success('test');

    return redirect('/contacts');
});

// Event code

<?php

namespace App\Events;

use App\Events\Event;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class TestExcel extends Event
{
    use SerializesModels;

    /*
     * get the require info for sending email
     */
    public $contact;
    public $errors;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct($zip_file)
    {
        $this->zip_file = $zip_file;
    }

    /**
     * Get the channels the event should be broadcast on.
     *
     * @return array
     */
    public function broadcastOn()
    {
        return [];
    }
}

// Listener code

<?php

namespace App\Listeners;

use App\Events\Interactions\InteractionsEmailError;
use App\Events\TestExcel;
use App\Mail\Mailers\ComplexMailable;
use App\Mail\Mailers\SimpleMailable;
use Illuminate\Support\Facades\Mail;

class WhenTestExcel
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  InteractionsEmailError $event
     * @return void
     */
    public function handle(TestExcel $event)
    {
        $this->sendInteractionsEmail($event->zip_file);
    }

    public function sendInteractionsEmail($zip_file)
    {
        $data = [
            'view' => 'emails.leads.referrals.referrers_to_be_contacted',
            'subject' => 'CRM Lead Referrers Report',
            'attachments' => $zip_file,
            'content' => 'Find attached details of the referrers who requested to be contacted.',
            'to' => 'clientservice@cytonn.com',
        ];

        Mail::send(new ComplexMailable($data));
    }
}

Similiar Collections

Python strftime reference pandas.Period.strftime python - Formatting Quarter time in pandas columns - Stack Overflow python - Pandas: Change day - Stack Overflow python - Check if multiple columns exist in a df - Stack Overflow Pandas DataFrame apply() - sending arguments examples python - How to filter a dataframe of dates by a particular month/day? - Stack Overflow python - replace a value in the entire pandas data frame - Stack Overflow python - Replacing blank values (white space) with NaN in pandas - Stack Overflow python - get list from pandas dataframe column - Stack Overflow python - How to drop rows of Pandas DataFrame whose value in a certain column is NaN - Stack Overflow python - How to drop rows of Pandas DataFrame whose value in a certain column is NaN - Stack Overflow python - How to lowercase a pandas dataframe string column if it has missing values? - Stack Overflow How to Convert Integers to Strings in Pandas DataFrame - Data to Fish How to Convert Integers to Strings in Pandas DataFrame - Data to Fish create a dictionary of two pandas Dataframe columns? - Stack Overflow python - ValueError: No axis named node2 for object type <class 'pandas.core.frame.DataFrame'> - Stack Overflow Python Pandas iterate over rows and access column names - Stack Overflow python - Creating dataframe from a dictionary where entries have different lengths - Stack Overflow python - Deleting DataFrame row in Pandas based on column value - Stack Overflow python - How to check if a column exists in Pandas - Stack Overflow python - Import pandas dataframe column as string not int - Stack Overflow