octal

octal

Software Engineer at France

Member Since 7 Months Ago

Experience Points
2,030
Total
Experience

2,970 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
7
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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.

Level 1
2,030 XP
Sep
09
1 month ago
Activity icon

Replied to Comment Blade Directives Starting With @

Ok I see. I was having problems with it, and in fact, I just checked it again, it works perfectly, BUT it does NOT support nested comments.

Thank you very much

Activity icon

Started a new Conversation Comment Blade Directives Starting With @

Hello, sometimes I have code like this


@if (Route::has('register'))
     <li class="nav-item">
          <a class="nav-link" href="{{ route('register') }}">{{ __('Register') }}</a>
     </li> 
 @endif

For blade code, I know I can use {{-- --}} to comment out blade output. But, how can I comment out directive starting with @ (like @if for example). ???

Sep
04
1 month ago
Activity icon

Started a new Conversation Ajax Queries With Https

Hello, I have a laravel website, and I have some ajax queries in some screens. When I call those queries directly in the browser or via ajax it works. I'm passing the website to https. Everything seems to work, and even those queries pass when I call them via the browser directly, but when called in ajax, I have a server error (500) .

Do you have any idea????

The minimum code that reproduce my problem is:

 $("#refreshmsglist").click(function(e)
        {
            $('#btngetmessages > i ').addClass('spinner');
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': '<?php echo csrf_token(); ?>'
                }
            });
            $.ajax({
                method: 'GET',
                url: '/trackers/{{ $tracker->id  }}/messages',
                data: {}, // a JSON object to send back
                
                success: function(response){ 
                    console.log(response);
                    document.location.reload(true);
                },
                error: function(jqXHR, textStatus, errorThrown) { 
                    console.log(JSON.stringify(jqXHR));
                    console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
                    $('#btngetmessages > i ').removeClass('spinner');
                },

                complete: function () {
                    $('#btngetmessages > i ').removeClass('spinner');
                }
            });
        });

on my brower if I put https://www.mywebsite.com/trackers/56/messages I got the messages of the tracker id 56. When using ajax it doesn't work (it was working ok on HTTP website, it doesnt work for HTTPS).

I'm passing correctly the X-CSRF-TOKEN. Is there something I'm missing with the headers to satisfy Laravel when using https?

Since I'm using Auth() engine provided by default by Laravel, I added

xhrFields: {
                     withCredentials: true
                },

But this doesn't change anything the error I'm getting is:

Request URL: https://www.mywebsite.com/trackers/57/messages
Request Method: GET
Status Code: 500 
Remote Address: 109.234.164.13:443
Referrer Policy: no-referrer-when-downgrade
Aug
29
1 month ago
Activity icon

Replied to Model With User Defined Fields And Properties

I'm looking at Rinvex https://github.com/rinvex/laravel-attributes

seems too complex

@tykus I'm using PostgreSQL. I'll check the JSON thing

Activity icon

Started a new Conversation Model With User Defined Fields And Properties

I would like to create a new Laravel app that will let users manage some items. For each item, users will have to possibility to add additional properties/fields.

Is there a good way to do that with Laravel/Eloquent? when a user add a new field to an item, is there a special API to add such fields to the model and (most problematic) to handle it automatically in forms validation? (I know I have to create the form dyanamically). Did anyone dealed with such problem?

Regards

May
01
5 months ago
Activity icon

Replied to Execute Artisan Command From Code

seems to me my controller method is not seeing any environment variable (the services are not registered nor loaded)

Activity icon

Replied to Execute Artisan Command From Code

From a static method in a controller. In fact the controller do a lot of maintenance work, and I added a static method to it in order to be able to instanciate it from Tinker envirnonment and refresh all my databse from scratch in order to automate unit-tests.

something like:

class MaintenanceController extends Controller
static public function initDB()
    {
        Artisan::call('migrate:fresh');
        App\Http\Controllers\MaintenanceController::setupDatabaseFromJSONFile('public/database/datasamples/samples.json');
    }
}

and from tinker environment I execute directly this method:

$ php artisan tinker
Psy Shell v0.9.9 (PHP 7.2.14 — cli) by Justin Hileman
>>> \App\Http\Controllers\MaintenanceController::initDB();
Symfony/Component/Console/Exception/NamespaceNotFoundException with message 'There are no commands defined in the "migrate" namespace.'
>>>
Activity icon

Replied to Execute Artisan Command From Code

@TYKUS - Thank you. I know, the script running this command will not run on server (will never be deployed) and on dev environment it requires special privileges to be run, so it's safe.

I used the Artisan::call('migrate:fresh') command and I'm having a new problem, in tinker environment I have this error:

Symfony/Component/Console/Exception/NamespaceNotFoundException with message 'There are no commands defined in the "migrate" namespace.'

From command line, the migrate:fresh comman run without any problem.

Is there a config file or location to update/register migrate:fresh commands ????

Activity icon

Started a new Conversation Execute Artisan Command From Code

Hello, I'm writing some maintenance functions for my website and I would like to know if there is a way to execute commands like

php artisan migrate:fresh

from a php script.

Apr
29
5 months ago
Activity icon

Replied to Update Vs Save Model After Form Validation

Ok, after having checked the Model::update/save methods I can see the pb. Save does not accept $attributes, only options and update do call ->fill(attributes)->save(options). .... so Save do not fill the model with the attributes !!!!

Activity icon

Started a new Conversation Update Vs Save Model After Form Validation

Hello, I'm having a strange behaviour (or I didn't understood something in laravel doc).

I have a simple form that has a PATCH action that trig my controller update method. The code is the following (simplified)

 public function update(Request $request, Product $product)
    {
        $attributes = $request->validate(
            [
                'label'       => ['required', 'min:3'],
                'description' => [],
                'category'    => []
            ]);

        $product->update($attributes);
        return redirect("/products/{$prodcut->id}");
    }

I have put all my three attributes in the $fillable field of my Product model.

When I use this code, everything works as exected (the model is updated). If I replace the $product->update with $product->save($attributes) the rediection occurs correctly and everything seems to work as expected, but when I check my database, the model is NOT UPDATED at all.

What's the real difference between save and update ????? what am I missing here?