NicolasJ

Member Since 2 Months Ago

Experience Points
830
Total
Experience

4,170 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
1
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 1
830 XP
Dec
30
2 weeks ago
Activity icon

Replied to CreatePDF

Hi @guybrush_threepwood

this simply a method called from a button.

But I found the solution :

return response()->streamDownload(function () {
            $pdf = App::make('dompdf.wrapper');
            $pdf->loadHTML('<h1>Test</h1>');
            echo $pdf->stream();
        }, 'test.pdf');

Hope It helps

Activity icon

Started a new Conversation CreatePDF

Hi try to use https://github.com/barryvdh/laravel-dompdf to download a pdf.

I simply do this to test :

$pdf = App::make('dompdf.wrapper');
$pdf->loadHTML('<h1>Test</h1>');
return $pdf->stream('test.pdf');

But when I click on the button nothing append.

Is anyone have ever use this library with Livewire and could help ?

Dec
28
2 weeks ago
Activity icon

Replied to Livewire Mask Input

wire:ignore is my friend ;)

Activity icon

Replied to Livewire Mask Input

Hi @chaudigv

ok, this was a general question.

Thus I just implement IMask.js which is a complet front library. On a Livewire component, I simply instantiate it like that :

x-data
x-init="IMask($el, {mask: Number, min: 0, max: 100000});"

Now, the problem I have is : if the Livewire component is refreshed from the backend (changes on other input for example), then the mask is not applied. I need to write on the input to see the mask applied again.

This is certainly due to the lifecycle of IMask et Livewire. IMask does not have the correct value and the mask is not applied.

I saw this warning in the console : Element value was changed outside of mask. Syncronize mask using mask.updateValue() to work properly.

But where and how to call mask.updateValue() ?

Thus, I still do not know how to resolve it.

Dec
23
3 weeks ago
Activity icon

Started a new Conversation Livewire Mask Input

Hi there,

I am looking for a library to mask input in a Laravel Livewire project.

Any suggestions ?

Dec
15
1 month ago
Activity icon

Replied to Alpine : Populate Input When Click On List Result

In other words : after search a list appear and when the user click, the input is fill with the value

Activity icon

Started a new Conversation Alpine : Populate Input When Click On List Result

Hi,

I iterate over items to create inputs. For these inputs I create search with completion When there is results, I try to fill the input when the user click on an item of the completion list.

The problem is to bind an array with AlpineJS

The number of inputs could change

Hope to be clear enough

Activity icon

Replied to Postcss-import 13 & Tailwindcss 2

Ok, but I really do not know to adjust the configuration. If I delete "tailwindcss": "^1.9.6" there is an error : Error: Cannot find module 'tailwindcss'

Activity icon

Replied to Postcss-import 13 & Tailwindcss 2

@ma I have several node installed, from 8 to 15 and ever did the test. But clearly the master branch of the repo provided by @thinkverse help me, thanks.

I first tried to install the repo and make test : everything was ok. Tried to installed Jetstream with Livewire and also it was ok

I tried to start from a fresh installation :

laravel new test;
cd test;
composer require laravel/jetstream;
composer install;
php artisan jetstream:install livewire --teams;
npm uninstall tailwindcss postcss autoprefixer
npm install [email protected]:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat [email protected]^7 [email protected]^9

And also everything was ok.

I compared package.json, webpack.mix.js etc ... from those 2 tests with my project

There were small differences (as --hide-modules in scripts) but did not see any big differences.

Then I simply used the package.json and webpack.mix.js from the fresh installation to my project and tried.

But it failed because the file webpack.config.js was missing. Due to the line .webpackConfig(require('./webpack.config')); in webpack.mix.js

Then I simply create this file (same as fresh install or your repo @thinkverse), and it compiles perfectly

I upgraded some versions in package.json and get this one now :

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "npm run development -- --watch",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --disable-host-check --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "@tailwindcss/ui": "^0.7.2",
        "alpinejs": "^2.7.3",
        "axios": "^0.21",
        "cross-env": "^7.0",
        "laravel-mix": "^5.0.9",
        "lodash": "^4.17.20",
        "postcss-import": "^12.0.1",
        "resolve-url-loader": "^3.1.2",
        "sass-loader": "^10.1.0",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "@tailwindcss/postcss7-compat": "^2.0.2",
        "autoprefixer": "^10.1.0",
        "moment": "^2.29.1",
        "pikaday": "^1.8.2",
        "postcss": "^8.2.1",
        "supermask-js": "^1.0.0",
        "tailwindcss": "^1.9.6"
    }
}

webpack.mix.js looks like that :

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [
        require('postcss-import'),
        require('tailwindcss'),
    ])
    .webpackConfig(require('./webpack.config'));

webpack.config.js looks like that :

const path = require('path');

module.exports = {
    resolve: {
        alias: {
            '@': path.resolve('resources/js'),
        },
    },
};

The compilation is OK !

You see sass-loader because I need to compile extra css

mix.sass('resources/sass/my-custom.scss', 'public/css'); in webpack.mix.js

Is there a better way ?

again thanks for your replies and the time you spent !

Dec
14
1 month ago
Activity icon

Replied to Postcss-import 13 & Tailwindcss 2

Thanks @thinkverse and @keizah for your replies.

@keizah : in your repo you use tawildincss 1.5. Here the aim is to use tailwindcss 2 ;)

@thinkverse : in your repo you use "laravel-mix": "^6.0.0-beta.14", and I think that's why it is ok

I still do not find a solution, but as everything are still new and I hope that solutions will come soon I also do not test yours repos, but I will (looking for time .... :) )

Thanks

Dec
13
1 month ago
Activity icon

Replied to Vapor Permanent Load And Results

Thanks for reply, waiting for others standpoint ; if others would like to give theirs feedbacks

Activity icon

Replied to Postcss-import 13 & Tailwindcss 2

Hi @thinkverse thanks for reply, I ever tried and retry again with postcss-import 12 but stil have the error. Here the package.json :

    "devDependencies": {
        "@tailwindcss/ui": "^0.7.2",
        "alpinejs": "^2.7.3",
        "axios": "^0.21",
        "cross-env": "^7.0",
        "laravel-mix": "^5.0.9",
        "lodash": "^4.17.20",
        "postcss-import": "^12.0.1",
        "resolve-url-loader": "^3.1.2",
        "tailwindcss": "^2.0.2",
        "vue-template-compiler": "^2.6.12"
    }

I do not know how to use tailwindcss 2. I tried this : https://tailwindcss.com/docs/installation#post-css-7-compatibility-build

pacckage.json becomes :

    "devDependencies": {
        "@tailwindcss/ui": "^0.7.2",
        "alpinejs": "^2.7.3",
        "axios": "^0.21",
        "cross-env": "^7.0",
        "laravel-mix": "^5.0.9",
        "lodash": "^4.17.20",
        "postcss-import": "^12.0.1",
        "resolve-url-loader": "^3.1.2",
        "vue-template-compiler": "^2.6.12"
    },
    "dependencies": {
        "autoprefixer": "^9.8.6",
        "postcss": "^7.0.35",
        "tailwindcss": "npm:@tailwindcss/[email protected]^2.0.2"
    }

But got this error now :

ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: value.charCodeAt is not a function

Still do not know how to use tailwindcss 2 with Laravel

Dec
12
1 month ago
Activity icon

Started a new Conversation Postcss-import 13 & Tailwindcss 2

Hi,

I tried to use tailwindcss 2 but it seems that we need postcss-import 13

And when I compile I have this error : Error: PostCSS plugin postcss-import requires PostCSS 8

Is anyone know how to solve this issue ?

Activity icon

Replied to PHP Script Send Scheduled Firebase Notification

Hi @byswadi if you need to delay the notification, I think that the best is to use Jobs

https://laravel.com/docs/8.x/queues#delayed-dispatching

Activity icon

Replied to Undefined Variable: Data

Hi @ajaxtest you have the information here https://laravel.com/docs/8.x/views#passing-data-to-views

public function edit(todo $todo) { 
    $data = todo::all(); 
    return view('layouts.edit', ['data' => $data]); 
}
Activity icon

Started a new Conversation Vapor Permanent Load And Results

Hi, I wonder if it is a good choice to use Vapor if an application permanently run jobs ?

Perhaps it would be interesting to test something with L. Vapor, for example a set of tasks that would run continuously, calls to URLs or some kind of calculation that would be called every minute.

Obviously there is a cost issue behind all this. But above all I would like to know how far it is possible to go.

The underlying question is of course whether using Laravel Vapor for an application that performs a lot of tasks in the background all the time is a good idea, especially when the number of users increases over time.

I realise that my question may be a little naive, and I have gone through the various documents, but feedback will always make the difference.

So if you have any ....

Dec
10
1 month ago
Activity icon

Replied to Data Binding Of Item In Array

In fact, I was looking for which input is filling and not the entire array

I posted a response below in same time you write ;)

Thanks for reply

Activity icon

Replied to Data Binding Of Item In Array

Okay It could be managed with :

    public function updating($name, $value)
    {
    }

That provide in the name the index of the array ;)

That's it ! Hope it helps

Activity icon

Started a new Conversation Data Binding Of Item In Array

Hello,

I wonder how to achieve this.

In the blade livewire component there is an iteration over items for which there is binding, for example :

@foreach ($items as $item)
   <x-input wire:model="data.{{ $item->id }}" type="text" />
@endforeach

And in the livewire component the public property $data

Thus, in the component you can retrieve the informations in the array $data.

But what I try to do is that foreach item of $data I would like to add completion. For example, when the user start to write in an input there is a result depending on the content write by the user.

The problem is : how to achieve independently each item of the array as it is the total array that is bind ?

Of course the number of item in data is not always the same.

Hope to be clear enough.

There is no information on this page : https://laravel-livewire.com/docs/2.x/properties#binding-models

If someone have any suggestions ?

Nov
26
1 month ago
Activity icon

Replied to Jetstream With Teams & Policies

Hi @gm thanks for reply :)

Nov
23
1 month ago
Activity icon

Replied to Flash Message After $this->validate()

Not sure to understand exactly your question. This is a Laravel behavior that throw the error with $this->validate(). This error is catch by Livewire. That's why we can use $errors in LiveWire template. But in my case I needed not to emit an event but to dispatch a browser event. That's why I need to make a custom validator and throw myself the error, after the dispatch of the browser event.

I just resume this post and hope to answer Thanks snapey for time spent on this thread ++

Nov
20
1 month ago
Activity icon

Replied to Flash Message After $this->validate()

@snapey to be clear the livewire component I made use flash in case of redirection and dispatchBrowserEvent then. But, if there is no redirection as we discussed in this post, this is simply a dispatchBrowserEvent. For instance, it is not exactly that, it store message in session (flash), then used it to dispatchBrowserEvent, I have know to optimize this part.

Activity icon

Replied to Flash Message After $this->validate()

Hi all :) Many thanks for your answers. @marianomoreyra your solution works, thanks. Maybe it could be adjust as there two validations first with custom validator and second with $this->validate()

Nov
17
2 months ago
Activity icon

Replied to Flash Message After $this->validate()

Hi @marianomoreyra thanks for reply. I know all you mentioned and also that I do not need flash to handle validation message. I ever integrate this validations for fields.

But for UX reasons I want to use flash message. The fact is that I have a flash component that is triggered on dispatchBrowserEvent and display a notification (like toast message)

If you have a long form and the validation trigger an error for a field at the beginning of the form you won't see the error as there is no automatic scroll to the first error in the form. I do not want to use "required" in input as the design of default tooltip from browser are not nice.

Probably I need to use my component in @if ($errors->any()) @endif But still do not know how to achieve it.

I hope to be clear enough and quite sure that several persons wonder the same question.

Nov
16
2 months ago
Activity icon

Started a new Conversation Flash Message After $this->validate()

Hi,

this post https://stackoverflow.com/questions/63986147/how-in-laravel-livewire-set-flash-message-with-validation-erros has exactly the same problem I try to solved.

Is anyone have successfully send flash message after the call of $this->validate() :

Not coded like that :

                @if ($errors->any())
		...
                @endif

But clearly using flash

Best R.

Activity icon

Replied to Jetstream With Teams & Policies

Is anyone have a suggestion ?

Nov
06
2 months ago
Activity icon

Replied to Jetstream With Teams & Policies

More information, if I do thing like that in the template : @if (Gate::check('create', App\Models\Customer::class))

The policy of Customer id called, but the TeamPolicy is also called. How it could be as I commented this policy in AuthServiceProvider

Activity icon

Started a new Conversation Jetstream With Teams & Policies

Hi,

I try to had policies to Laravel Jetstream.

For example, I create a Policy CustomerPolicy In AuthServiceProvider I simply add it and comment Team::class => TeamPolicy::class:

class AuthServiceProvider extends ServiceProvider
{
    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        Customer::class => CustomerPolicy::class,
       // Team::class => TeamPolicy::class,
    ];

    /**
     * Register any authentication / authorization services.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerPolicies();

        //
    }
}

I call it in a Blade template : @if (Gate::check('create')) ...

But my policy is never used. I add a debug trace in TeamPolicy (which is normally not used anymore) :

    public function create(User $user)
    {
        Log::debug('HERE');
        return true;
    }

And I see this trace in log I also add a debug trace in CustomerPolicy but it is never called.

I clear all cache etc ...

Is there a problem or did I miss something ?

Activity icon

Replied to Livewire : Call A Method Of A Component After Some Seconds

Hi Snapey, thanks for reply. You're right, but doing it only with alpine will only hide the component and I want to remove it from the DOM.

Nov
04
2 months ago
Activity icon

Replied to Livewire : Call A Method Of A Component After Some Seconds

Ok, thus the answser is :

1 : to call component method in JS there $wire

2 : need to instanciate x-data

Then, the code comes :

x-data="{}"
x-init="setTimeout(() => { $wire.closeComponent() }, 2000);"

Any suggestions or optimization ?

Activity icon

Started a new Conversation Livewire : Call A Method Of A Component After Some Seconds

Hi all,

still not familar with alpinejs (because I think I need to use it), I start to create a Livewire component with Laravel that is displayed on success action (saved model, etc ...).

When this component is displayed it could be closed with a button, but I would also like to close it automatically after 2 or 3 seconds. I really do not know how to achieve it.

I tried :

x-init="clearTimeout(timeout); timeout = setTimeout(() => { closeComponent }, 2000);"

where closeComponent is a method of the component that is also called on the button :

<button wire:click="closeComponent">Close</button>

help would be welcome :)