octal

octal

Member Since 4 Months Ago

Software Engineer at France

Experience Points 2,110
Experience Level 1

2,890 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 10
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.

01 May
2 months ago

octal left a reply on Execute Artisan Command From Code

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

octal left a reply on Execute Artisan Command From Code

From a static method in a controller

octal left a reply on 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.

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

29 Apr
2 months ago

octal left a reply on 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 !!!!

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

14 Apr
3 months ago

octal left a reply on Error While Publishing A Laravel Application

@RAVENFARAMOND - I had to to disable the line

App\Providers\TelescopeServiceProvider::class,

from config/app.php file in order to make things work. @snapey the idea was to have Telescope only available on my dev station and not available in the published production application, so it was effectively only in the "require-dev" section of composer.json (but this was intentional).

octal started a new conversation Error While Publishing A Laravel Application

Hello, I'm trying to publish my first laravel app on a shared webhosting (mainly to learn the deployment process) and I'm having a problem.

I created a new folder, got all files their with git clone and copied all public folder to the webhosting public_html folder. And I adjusted the content of the index.php file accordingly.

Up to that everything is OK.

Now I launched the command

''' composer install --no-dev --optimize-autoloader '''

and I got the error

''' ...

  • Installing dnoegel/php-xdg-base-dir (0.1): Downloading (100%)
  • Installing psy/psysh (v0.9.9): Downloading (100%)
  • Installing laravel/tinker (v1.0.8): Downloading (100%) Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover --ansi

In TelescopeServiceProvider.php line 10:

Class 'Laravel\Telescope\TelescopeApplicationServiceProvider' not found

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255 '''

Can you point me to the origin of this error? is it related to Telescope installation (when I installed Telescope package I specified that it was for dev only).

Regards

27 Mar
3 months ago

octal left a reply on EDIT Form Validation And Old( .. )

@FTIERSCH - Excellent. Thank you very much. This worked perfectly.

octal started a new conversation EDIT Form Validation And Old( .. )

Hello, I'm using a form with this code

<input type="text" name="username" value="{{ old('username') }}">

WHEN THERE ARE VALIDATION ERRORS ....

When in CREATE (new) mode, this works fine and old(..) fills the form field with the data typed in the form before submitting it.

How do you handle that when in EDIT mode (modification of existing model) ? In Edit mode I fill the form with data comming from my model. How can I push the user entered data into the instance binded to the form when validation go in error mode and redirect automatically to the form. (using $request->validate(.....) ).

octal left a reply on Laravel Must Provide A Mean To Disable View Caching

@FTIERSCH - The view changes when u have to add additional js files (via hrefs) in the head of your html.

octal left a reply on Laravel Must Provide A Mean To Disable View Caching

Yes the path is not changing in the view

octal left a reply on Laravel Must Provide A Mean To Disable View Caching

I'm asking for a new feature that makes debugging and developping pages easier. This feature exists in other frameworks and really makes sens. Why doesn't Laravel provide such feature?

octal left a reply on Laravel Must Provide A Mean To Disable View Caching

@TOKOIWESLEY - Caching in the browser is NOT the problem. As I said, I always refresh the browser using Ctrl+Click_On_Refresh_Button which (on Chrome at least) reloads everything. I have to clear the Views Cache with artisan everytime. This slows up the dev process. In Symfony we can simply say

    cache:  false

This disables the views cache definitely in dev environment.

We need such mechanism in Laravel.

Somone proposed this nice solution

http://easylaravel.com/how-to-disable-views-cache

but this is so heavy to deal with when switching regularly between dev and prod, and it adds an additional layer that we can get rid of if we had the good property in Laravel to deal with that.

Actual solution I found is to simply set the CACHE_DRIVER=array in the .env file (instead of having CACHE_DRIVER=file).

This works but it's still a "fiddling" way to do clean things.

octal left a reply on Laravel Must Provide A Mean To Disable View Caching

Just using an href on the file (using asset(...) helper) and the js files resides in their own assets/pages/js//.js

in order to get the cached view to integrate the new js file.

In the browser I have to click on Ctrl+PageRefresh_Icon in order to get the browser download the new cached view. If I don't clear the view cache, the browser always download the old cached view with its old js files :(

octal started a new conversation Laravel Must Provide A Mean To Disable View Caching

Hello, I can't find any way to disable Views caching during development (like in Symfony). I have a problem because I have to integrate some js files in my blade files. The problem is that when I change those js files, the cached view is not aware of that, so laravel do not update it.

14 Mar
4 months ago

octal started a new conversation Trimming Functions Missing In Str::class

Amazingly, Trim functions are missing in Str::class.

I think it can be nice to have

Str::ltrim( ..)

Str::rtrim ( )

Str::trim ( )

and maybe some filling functions depending on pattern

Str::fill ($char, $len) which will generate a string filled with "len" times "char"

Str::rfill and Str::rfill( ) do the same to make a string match a certain length

octal left a reply on How Does Laravel/Blade Handle Assets ?

@NASH - My problem is not with how HTML works or expect the references to css/js/img to be provided. My problem is how can I force those links to be independent of the relative path of my views blade files.

Well, I had to use the asset(..) helper function and even of the assets are in a global directory at the root of my website (in public folder in laravel) I had to define the ASSET_URL= in the .ENV file (in my case it's simply a blank).

Now everything works as expected.

octal started a new conversation How Does Laravel/Blade Handle Assets ?

Hello, I'm having a problem with my assets (images and js files).

I have created a global_asset folder inside my public folder.

I have created a resource controller ProjectController to route user either to the list of projects (index.blade.php) or to view a single project (show.blade.php)

Both index.blade.php and show.blade.php extends the same initial layout (my template.blade.php).

The PROBLEM:

in the template.blade.php I have included some assets like this:

<script src="global_assets/js/plugins/visualization/d3/d3.min.js"></script>

When the controller routes me to the index ( /domain/projects) (to show all projects), this works and all assets are accessed correctly.

When the controller routes me to the create.blade.php file to show only a single project ( /domain/projects/{idOfProject} ) this doesn't work, in telescope it shows that the assest are accessed as if they were in "/projects/global_assets/...."

09 Mar
4 months ago

octal left a reply on THE LARAVEL WAY Of Http Get Requests To External API

Thank you. I'm using Guzzle v6 and it's working very well. I have had to setup Wampserver curl extension to use the correct cacert.pem from mozilla website because I was calling an https url and I was gotting the famous error

cURL error 60: SSL certificate: unable to get local issuer certificate

Now it's working :)

08 Mar
4 months ago

octal left a reply on THE LARAVEL WAY Of Http Get Requests To External API

@MANELGAVALDA - So I'm not wrong, Laravel doesn't provide any library for that. It's really strange, because in the test framework almost all resquest kind are available.

octal started a new conversation THE LARAVEL WAY Of Http Get Requests To External API

Hello, I need to call an external API doing GET request. I need to set a special key in the header and do the get request and then handle the result.

Actually I'm creating my options array and I'm calling the simple Php file_get_contents(..) to do it.

What's THE LARAVEL way of doing that?

06 Mar
4 months ago

octal left a reply on Laravel Extremely Slow

Well, I configured PHPStorm to debug the wamp served laravel application (Telescope enabled). It works perfectly and most of the requests are arround 90~95ms. Witch is really acceptable for me at least caue it's really quick enough to not bother me and it gives me the power of Telescope with the power of xdebug through phpstorm.

Perfect!!!

octal left a reply on Laravel Extremely Slow

Amazing!!!! I modified wampserver root folder to point to my "laravel-project/public" folder, and tried again, almost all requests are arround 80ms up to 90ms now !!!

I'll try to see if xdebug still works with phpstorm

octal left a reply on Laravel Extremely Slow

I'm monitoring using Telescope. Will disable it and try again

octal started a new conversation Laravel Extremely Slow

Hello, I installed Telescope and I'm testing my Laravel website in dev mode, locally, using php installed locally and launched using command line (artisan serve).

I just created a simple webpage and I'm loading it. I don't deal with any model right now and I have no authentification.

Almost all requests takes arround 350ms to execute. Are Laravel applications that slow? Is there a solution to speed up the thing in dev environment?

Regards

octal left a reply on What's The Difference Between @yield And @include

@COBS - @include is nice for static content fragments

octal left a reply on What's The Difference Between @yield And @include

@PRINCEOO7 - Ok, thanks. That answers my question.

So with include we blindly imports a full file and insert its content to the location of the @include directive.

With yield, we specify the file that serves as a (html page) content provider, and the yield will only consume the @section that has the name provided in the @yield directive.

octal started a new conversation What's The Difference Between @yield And @include

Hello, what's the difference between @yield and @include directives in blade?

I can't see any.

05 Mar
4 months ago

octal left a reply on Possible To Add Warning When Changing Laravel Version?

@CRONIX - I really should stop working when I'm very tired :(

I just checked the gitignore and in fact I modified it on my home PC, but not at work. Since I don't push this file to git, this explains why I didn't got the the vendor files pushed.

My idea behind pushing the vendor is to have absolutely the same project content without relying on composer repo, as for security reasons, at deployment time on customer servers, we won't be able to get those files via composer (blocked by firewall).

As I said (regarding composer.lock) I really will take time next weekend to master composer!!!

octal left a reply on Utility Of Component/Slot Model

@JLRDW - I'm used to use Twig (with symfony), so blade looks familiar.

I'm really don't like having numerous keywords in a Domain Specific Language to achieve the same thing. This is the best way to finish up having a huge mess to maintain, and it makes learning and using the language extremely difficult (C++ is a good example).

octal left a reply on Possible To Add Warning When Changing Laravel Version?

@SNAPEY - this was a stupid move from me. In fact, to make long story short, yesturday I started a full new project from scratch and before I write any line of code, I just configured my env file, and then installed Telescope. I pushed everything on Git in order to get a clean copy at each stage of the development of my project.

Everything was working correctly.

today, when I got home, I had a fresh install of laravel (from yesturday) without Telescope. So I just feteched everything from git on my desktop PC. I tought everything was ok. I launched migrate in order to create all Telescope needed migrations.

When I lauched the project (artisan serve), I got an error saying

In TelescopeServiceProvider.php line 10: Class 'Laravel\Telescope\TelescopeApplicationServiceProvider' not found

So I checked my app folder and this file was really missing. So I tought that by launching "Composer update" I could get all missing files installed. This happened as expected BUT in the meantime it installed Laravel v5.8.3.

This is the story.

I really don't understant right now why the Laravel\Telescope* was not there despite the fact that I'm sure I pushed everything on my Laptop, and there were no exclusions on the vendor folder.

Mystery !!! I really need to understand everything about Composer internals and files/projects/dependencies management.

octal left a reply on Utility Of Component/Slot Model

@JLRDW - But even for alerts, warning ... we can just use a section and inject the needed variables. This is where I can't see the utility of such new feature. It's more confusing that really useful (at least for me).

octal left a reply on Possible To Add Warning When Changing Laravel Version?

@SNAPEY - Yes, please read again my question. I wanted to know how to trigger a warning on such conditions.

I'll use composer outdated and filter the output and send warning depending on that. This the best I can do for now. I know now that I have to spend a bit of time on composer to be able to get more control and (mainly) more feedback about the update process.

octal left a reply on Possible To Add Warning When Changing Laravel Version?

I'm new to Laravel, so sorry if my questions seems stupid. But I really don't understand both the previous answers.

In my previous post, I said that I can lock the version so this is not a problem, I just want to know if it's possible to trigger a warning on such change.

I can't understand @jlrdw response/

You say that this updates the framework, not laravel? what does it mean? for me laravel is a/the framework. Am I wrong?

When I ask the version I got:

$ php artisan laravel --version

Laravel Framework 5.8.3

I was getting 5.8.2 yesturday. So what happens? is this a new version of laravel or not? patch, small change .... anyway, it's a migration to a new minor version. Am I wrong?

Regards

octal started a new conversation Possible To Add Warning When Changing Laravel Version?

Hello, I launched today a composer update on my project, and I was estonished to see that it has downloaded a new laravel version (5.8.3). I'm not against having the framework updated (at least for my current project) and I know I can lock the laravel version to 5.8.2 in the composer.json file. But, is it possible to have a warning when such change in version happens? if I was not in front of my PC I would have never see that I have been migrated to a new version of the framework. This is not so cool.

octal started a new conversation Utility Of Component/Slot Model

What's the utility of the Component/Slot model in blade? I can't see any figure where it can be better than the simple model of yield/section couple.

How do you use them?

02 Mar
4 months ago

octal left a reply on Why Does Generated Controller With Make:model Has Bad Name?

Good point. You'r absolutely right!!!

octal left a reply on Why Does Generated Controller With Make:model Has Bad Name?

Ok.

I have been fooled by all the examples in laracast videos. All controllers use plural form, and it's, from my point of view, more logical as we usually, in REST, handle a set of resources (models) and got to the single elements via the index/id passed in the URL.

octal left a reply on Which Version Of Laravel For A Fresh New Project?

Thank you for all those notes. I'll for sure check the API. I'm used to check mainly the source codes and as you mentioned it, they are really very well self documented. But as any other framework, it takes time to get used to use most of its features.

octal left a reply on Which Version Of Laravel For A Fresh New Project?

@JLRDW - I also still use JQuery+Bootstrap only. With blade templates, I learnt a bit of Vue.js but never used it for effective project. I use TDD for all my developments, and since I'm not yet up to do that correctly on Vue.js. For long term projects, TDD is really mandatory if you want to keep control on the sanity of your project, especially when you work with a very small team (2 or 3 developpers only).

As for Laravel, while I already figure out the global architecture and how most parts fits, as usually the devil is in the details. I'm still reading actively each part of the documentation, and I'll order the new edition of the book Laravel Up and Running (will be effectively available in few weeks from amazon).

octal left a reply on Which Version Of Laravel For A Fresh New Project?

I'm not a specialist, I'm new to Laravel, but I have good experience with Symfony, and I watched all videos about laravel 5.7 (and took a numerous notes), and I can't see something blocking.

I started making wy website, and I already have users authorizations working, routing of main 5 forms already working, 6 models already handled with their controllers, eloquent relations and forms. I need to tweek my forms (I need to inject our company special web assets like log, header, check responsivness of the design on small devices, ...).

I need to add notifications and events management (mainly mail alerts on special cases). I also need to learn and create scheduled tasks to interact with a partner services (I mainly need to learn how security and auth works in this case).

That's it :)

octal left a reply on Which Version Of Laravel For A Fresh New Project?

I can see that v5.8 is not that much different from v5.7 (from architectural point of view), and by the end of this year, I think v5.8 will be almost as stable/safe as actual v5.7.

I'll go for v5.8

octal left a reply on Which Version Of Laravel For A Fresh New Project?

The situation is that I'm going to create a portal to let users access information related to special devices we make in our company. We are a small startup and we don't have any constraint as for the choice. The main constraint I have in my mind are those I learnt from about 15 years of development, this is why I'm asking.

I effectively studied the new features of v5.8 but didn't saw the "upgrade guide" mentioned by Cronix (thanks very much btw). Effectively, upgrading from v5.7 to v5.8 may take time that I'm not inclined to dedicate to such operation. I prefer to use v5.8 and spend more time on small fixes. My website will be in very restricted usage on June, and in mass usage by the end of the year, so I think it would be wise to use v5.8 directly, as at that time, v5.7 will no more be maintained.

octal left a reply on Which Version Of Laravel For A Fresh New Project?

@JLRDW - "Users promote the latest" is not what I expect. I expect a "professional" response to a professional user as we are accostumed to on StackOverflow or other serious forums.

Sorry, I'm new user of Laravel and I don't know quite well the laravel community. It clearly looks like the Laravel community is very dynamic and very enthousiastic, but I certainly hate "emotionally charged" answers.

octal started a new conversation Which Version Of Laravel For A Fresh New Project?

Hello, this week I'm going to start a new project (for the company I work for), and I'll be, of course, using Laravel. I wanted to know which version do you suggest me to use?

I'm inclined to use v5.7 as it's mature, but I see that its support will stop by august of this year. And in the mean time, I really don't like to use extremely fresh new versions for production, i.e. v5.8.

My website will be in production by the start of June. Do you consider that v5.8 will be as mature as v5.7 at this time? even if it needs some patches regularly this is not a problem for me.

octal left a reply on Why Does Generated Controller With Make:model Has Bad Name?

@SNAPEY - Thank you Snapey, but it's not the point. The point is to keep ALL laravel tools homogenious. In ALL laravel doc and tutorials we are encouraged to keep the name of the model singular and the controller in plural form. When I create a controller, I usually use the model as a starting point, as from my point of view, the model is THE ENTITY that we are going to manipulate, protect, show, edit, .... so when I add a new entity that will interract with my other models, I prefer to use the same command line tool making this entity (make:model) to generate all the other needed stuff arround it, mainly the controller and the migration. This tool EXISTS, it's make:model, so I can't understand that this tool doesn't respect the recommandations of the documentation and the tutorials provided by the creators of Laravel. I know that this is only a convention, but if we want it to be respected as much as possible, we need that the tools reenforce its usage. If, for any reason, we can't do that, we can still change the command, as I suggested, by adding the posisbility to provide the controller name inline.

01 Mar
4 months ago

octal left a reply on Why Does Generated Controller With Make:model Has Bad Name?

It would be nice to be able to give/propose the name in the make:model command, something like

$php artisan make:model Project --migration --controller=ProjectsController -r

This will make it also easier to create controllers inside subdirectories

octal started a new conversation Why Does Generated Controller Has Bad Name?

In Laravel, for a model named let's say

  • Product (model in singular) I'm assumed to have a
  • migration for a table Products -and a controller named ProductsController (note plural form).

The usual way I make all three is: 1- make the migration $php artisan make:migration create_products 2- make the model $php artisan make:model Product 3- make the conroller $php artisan make:controller ProductsController -m=Product

This works as expected. But when I check the artisan make:model command, I can see that it can create the migration and the controller in one shot. So I tried $php artisan make:model Product --controller --migration The problem is with this, is that: 1- The created controller doesn't have all the nice REST verbs with Product model already injected 2- The controller name is wrong, it's ProductController (singular) instead of ProductsController (plural form).

Am I wrong with using this command? or is the controller created with this command intended to be different from the one we create with make:controller ???

Regards

octal left a reply on Can We Subscribe Using Paypal Payment Method?

Ok. Thanks. Got my answer