Giolf

Member Since 3 Years Ago

Lugano

Web Developer at Impress Sagl

Experience Points 6,655
Experience Level 2

3,345 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 34
Lessons
Completed
Best Reply Awards 2
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.

02 Sep
2 years ago

Giolf left a reply on Dusk Won't Install On Laravel 5.4

same story here!

20 May
2 years ago

Giolf left a reply on Laravel 5.4 Won't Validate JSON From RAW Data

@mstnorris Ok, yes maybe in your context has more sense doing in your way. To come back to your issue: Did you try to fetch the json and try on an online service to check if it's valid ? Can you attach on here what exactly you have in $requestand $requestData ? Thx

19 May
2 years ago

Giolf left a reply on Laravel 5.4 Won't Validate JSON From RAW Data

yes i would try to follow the advice of @tim_jespers

And by my side i suggest to you to introduce an elegant FormRequestValidation to inject into your controller

05 May
2 years ago

Giolf left a reply on API - Disabling Sessions And CSRF

@SP1966 If you are using your API internally ... there is no sense to use JWT. JWT it's usefull when you expose some API for thirdy party services/WebApp.

because in that way you will not have issues regarding (for example) the "session cookie domain scope". So in that case have sense to implement JWT auth.

But in your case... where everything works internally ... well ... sessions fit better.

05 Apr
2 years ago

Giolf left a reply on Laravel CI Testing With GitLab

Hi all,

While i was reading this topic

i was thinking if it's possibile to have this kind of test functionality into the docker container:

 public function testBasicExample()
    {
        $this->visit('/')
             ->see('Laravel 5')
             ->dontSee('Rails');
    }

If not what i would need ? maybe a webserver that runs into the docker container ?

thank you

26 Mar
2 years ago

Giolf left a reply on Why Am I Finding It Difficult To Use A Framework?

Honestly i found Laravel one of the simplest PHP framework. the main reasons are:

  1. Really nice and elegant code.
  2. Stunning documentation.
  3. Amazing laracast video lessons
  4. A powerful ecosystem (Forge, Lumen, ect)
  5. A wonderful community

Giolf started a new conversation Laravel CI Testing With GitLab

Hi all,

While i was reading this topic: https://laracasts.com/discuss/channels/testing/laravel-ci-testing-with-gitlab

i was thinking if it's possibile to have this kind of test functionality into the docker container:

 public function testBasicExample()
    {
        $this->visit('/')
             ->see('Laravel 5')
             ->dontSee('Rails');
    }

If not what i would need ? maybe a webserver that runs into the docker container ?

thank you

28 Feb
2 years ago

Giolf left a reply on Scheduling Jobs

@tam1 thank you !! i was asking exactly that: if it's a bad abitude do that... so isn't ... perfect :)

27 Feb
2 years ago

Giolf left a reply on Scheduling Jobs

@tam1 thank you for your answer.

the problem is SendMailToAllCustomers it's a Job that is already in use in my app. But i would like to use it also into my scheduler. So i was thinking:

How can i schedule a job ???

Giolf left a reply on Scheduling Jobs

someone can help me ? thank you

26 Feb
2 years ago

Giolf started a new conversation Scheduling Jobs

Hi all,

I have a question about the laravel's scheduler: Imagine that previously i have written a SendMailToAllCustomers job that send a simple mail to all customers when the user click on a "send" button on a specific view.

Then imagine also that i need to schedule the same job every day.

It is possible in Laravel schedule a job in the order to don't write again the same logic of my job into the schedule method ?

I mean: it's possible doing something like that ?

protected function schedule(Schedule $schedule)
{
    $schedule->call(function () {
         $this->dispatch(new SendMailToAllCustomers ());
    })->daily();
}

In that way i don't have to write again the same logic written in the job and the scheduler every day append this task in the same queue.

And this is the most important question: It is a bad approach or it's fine what am i asking ?

thank you

04 Jan
2 years ago

Giolf left a reply on Homestead - Grunt Not Found

@supernova09 thank you for your reply. At the moment I attached that command on the after.sh script ... so in a future if I need to destroy my box ... on the new one it will be ready to use. By the way I'm happy to know that it will be integrated with an official update. Yes probably you re right about the ram resource .... but honestly I prefer to keep my host machine as clean as possible and delegate to homestead all this kind of stuffs (build, bundle, sass compiling, etc).

Giolf left a reply on Homestead - Grunt Not Found

Hi @vangelis,

So for which strange reason Homestead provides npm with grunt, bower and gulp ?

Giolf left a reply on Homestead - Grunt Not Found

@ejdelmonico you are wrong. On my homestead VM if I type:

'vagrant ssh'

and then

'npm' or 'gulp'

I get their classic output (it mean they are provided by homestead).

But if I type these commands on my host machine I get 'command not found'

That mean on my host machine they are not installed but on the guest machine yes. And this is exactly what I want: all this kind of stuff only on homestead in the order to keep my host machine as clean as possible.

By the way i know the purpose of homestead and which benefits it can provides to develop.

03 Jan
2 years ago

Giolf left a reply on Homestead - Grunt Not Found

ok i figured out the problem: Homestead provides grunt with the version mentioned before. what is not provided is the command line, that you have to install with: npm install -g grunt-cli

Giolf left a reply on Homestead - Grunt Not Found

this is what i get on the homestead documentation:

Included Software

  • Ubuntu 16.04
  • Git
  • PHP 7.1
  • Nginx
  • MySQL
  • MariaDB
  • Sqlite3
  • Postgres
  • Composer
  • Node (With Yarn, PM2, Bower, Grunt, and Gulp)
  • Redis
  • Memcached
  • Beanstalkd

i think grunt is already on the homestead VM because if i run:

npm grunt -v

i get this output:

3.10.8

Giolf left a reply on Homestead - Grunt Not Found

@vangelis of course on Homestead

Giolf started a new conversation Homestead - Grunt Not Found

Hi all, after installing several projects on my homestead VM (where all are using gulp as a tasks runner) i never had problems.

But this project instead of gulp is using grunt. If i understand correctly homestead should already have it right? so after run npm install to get all the project's dependencies, if i type grunt i get this output: -bash: grunt: command not found

why that?

thank you

26 Oct
2 years ago

Giolf left a reply on How To Encapsulate Common Functionality In Vuejs?

@neeravp if you use webpack and you configure it properly you will be able to share a module by his ID. so each time you need that module the 'webpack_require' function will ask the same module ID. so at the end in your bundle.js file you will have only 1 module with his unique ID.

In my honest opinion, the option 1 (mixin) is the best way. If you want to push yourself a little higher begin to learn vuex.

if you don't want configure webpack try to do it:

// import MyMixin from './mixin';
export default{
    template:require('./my-component-template.html'),
    mixins:[require( './mixin')], // it will be in your bundle something like:  mixins:[webpack_require( ID_module)]
    data(){
        return{
            name:'John Doe'
        }
    }
21 Aug
3 years ago

Giolf started a new conversation Localization

Hi all,

I've a question about laravel's localization. when, for example, is called this function: App::setLocale('en')

The app's lang will be changed to 'en', fine but ... this function will change the language ONLY to the 'client-thread' on the web server or it set globally the language (every client-trhead on the web server will see the language's changment) ?

What happen if more users at the sime time are making requests that return a view and, in the while, another user decide to change language with that funcion ? only that user will see the app with the new language or all the users ?

so i'm trying to get the fact if that function is thread safe or not. i mean: works only to a single thread without share informations with the others. thanks and sorry for my english

02 Aug
3 years ago

Giolf started a new conversation How To Install Laravel-snappy

Hi all, I can't figure out how to install laravel-snappy correctly.

First of all i've to install wkhtmltopdf/wkhtmltoimage, right ? I've seen that it's possible by composer. So again, if i understand correctly i've to run this 2 commands:

composer require h4cc/wkhtmltopdf-amd64 0.12.x
composer require h4cc/wkhtmltoimage-amd64 0.12.x

Then the guide says: After installing, verify first if wkhtmltopdf works correctly when invoked from the command line / shell. Ok, but with which command can i test it ?

Then the guide says: The package provides $app['snappy.pdf'] and $app['snappy.image']. You have to set the binary location in the config file. Copy config/snappy.php to your own config, or use your ConfigServiceProvider so set the config keys. and then adapt the "binary" line in the published config file (afer publishing should be present in: app/config/packages/barryvdh/laravel-snappy/config.php). What ? what he mean ? what i've to do with snappy.php file ? How can i publish my config file if he didn't explain how to download his package ?

Maybe he means that before i've to install his package? with: composer require barryvdh/laravel-snappy

thank you

09 Jun
3 years ago

Giolf left a reply on Messages File - Render A String In HTML

@Snapey thank you. i all time use {{ trans(...) }}

i'm still a noob :)

Giolf started a new conversation Messages File - Render A String In HTML

Hi all,

i'm having some troubles to render a string in HTML saved in messages.php file.

My messages.php file has this array:

'alert'         => array(
    'delete-item'   => 'Sei sicuro di volerlo fare? </br> Questa azione รจ <strong>irreversibile</strong>!'
),

has you can see... i need to render:

trans('messages.alert.delete-item?')

in HTML instead of pure text. Some advice?

thanks

01 Jan
3 years ago

Giolf started a new conversation User Settings

Hi all, i'm making this post because i would like to have some "tips" about a way to develop in my app a way to let the users to choose some settings inside my app. For example the format of the date: i would like to allow the users to choose in which format show the date. For example an user prefer to use a format like: "dd/mm/yyyy" another one prefer "mm/dd/yyyy". So i was thinking to create an "options page" in my app.
Then a new table like "options" where each record contain all the options of a specific user. Then in the models ... for example with the accessors, before to retrieve the value of the model i can retrieve the logged user and then by him with a relation retrieve all his settings and with this setting format the value, then finally return it.
But i don't know if this is the right technique so i prefer to ask to someone that of course now better then me how to reach this goal.
thank you guys
Happy new year

28 Dec
3 years ago

Giolf left a reply on [L5] Where To Add Custom Validation Function?

@bestmomo yes but i think the best thing it's to create a specific ServiceProvider instead to use the AppServiceProvider ... u could create something like ValidatorServiceProvider.

it's more elegant.

Giolf left a reply on Form Request Validation

yes ... i was thinking that exists a rule like ... not_between :-D

Giolf started a new conversation Form Request Validation

Hi all, I'm trying to write a rule on my CreateAccountRequest that accept just number bigger than 'x' and smaller than 'y' where inside in this range some numbers are excluded.
this is my rule at the moment:

'number' => 'unique:accounts|integer|min:0|max:100|required

So at the moment are allowed numbers between 0 and 100, perfect! now i need also that some numbers in this range are not allowed!. For example from 20 to 80, so the allowed numbers are just from 0 to 19 and from 81 to 100. I know exists the not_in rule, the problem i can't write hard coded all the numbers NOT included... so ... there is a way to say something like: From 'k' to 'i' i the numbers are not allowed.

Thank you

21 Dec
3 years ago

Giolf left a reply on Problem With 'max' Rule Validation

Solved, i ve just to change the: upload_max_filesize parameter in the php.ini file.

Giolf started a new conversation Problem With 'max' Rule Validation

Hi all,
I've a strange problem with "max" rule validation in my FormRequestValidation.

This is my form:

 {!! Form::open(['route' => [$route . '::upload', $person->id], 'files' => true, 'id'  => 'form']) !!}
<div class="row">
    <div class="form-group col-sm-12">
        {!! Form::label('name', 'Nome') !!}
        {!! Form::text('name', null, ['class' => 'form-control', 'pattern' => '[a-zA-Z\s]+', 'required' => "true", 'placeholder' => "Nome dell'allegato"]) !!}
    </div>
</div>
<div class="row">
    <div class="form-group col-sm-12">
        {!! Form::label('file', 'File') !!}
        {!! Form::file('file', ['required' => "true"]) !!}
    </div>
</div>
<div class="row">
    <div class="form-group col-sm-12">
        {!! Form::label('description', 'Descrizione') !!}
        {!! Form::textarea('description', null, ['class' => 'form-control', 'rows' => 3, 'placeholder' => "Descrizione dell'allegato"]) !!}
    </div>
</div>
{!! Form::close() !!}

And in UploadAttachmentRequest i've these rules:

    public function rules()
    {
        return [
            'name' =>  ['required', 'regex:/[a-zA-Z\s]+/'],
            'file' => 'required|max:3000'
        ];
    }

Now if i try to upload a file bigger than 3000 KB the error that come back is coming from the 'file' => 'required' rule but not from the max rule. In fact i get back the message: "file is a required field".
how it is possibile?
thank you

14 Dec
3 years ago

Giolf left a reply on One To Many To One

Thank you BRO !!!

Giolf started a new conversation One To Many To One

Hi all, In my project i've a person that can have many subscriptions where each subscription has one course.

at the moment if i want all the course of 1 person i need to do something like this:

$personCourses = $person->subscriptions->each(function($subscription) {
    return $subscription->course;
});

The goal that i would like to reach is to create a relation beteween person and course. and so if i type something like that:

$personCourses = $person->courses;

i will get all the courses of this person
It is possible to define a relation to do that ?
i read about hasManyThrough but this works if you have a one to many to many, for example a country has many users where each users has many posts and so i can get all the posts of a specific country. But this is not my case ... because one person has many subscriptions but each subscription has just one course.


thank you

08 Dec
3 years ago

Giolf left a reply on PHP 7 On Ubuntu 14.04?

@EliasSoares Honestly i don't know ... in this case like i said before i would create a new test environment. Think to the future: you could use it again for other tests ...

Giolf left a reply on PHP 7 On Ubuntu 14.04?

My advice: Build a separate test server with PHP7 that listen on a different PORT. And why don't you prefer to do it in that way ? i think is more clean and elegant than mix fish and steak in the same plate.

28 Nov
3 years ago

Giolf started a new conversation Date_format Validation

I hall, i have a form with 2 input text fields:
'timeStart', 'timeEnd'

In these fields the user can insert a time for example (14:00)
now in my FormRequestValidation i would like to check that the 'timeStart' is before then 'timeEnd'.
for example if 'timeStart' = 12:00 and 'timeEnd' = 11:00 this is not allowed.
i'm reading in the doc of laravel that it's possible to use the 'before|date' but i'm not sure how exactly to use it.

this is my FormRequest:

        return [
            'room_id'      => 'integer|required',
            'dateTimeFrom' => 'date_format:"d-m-Y"|required',
            'timeStart'    => 'date_format:"H:i"|required', // i need that this hour come before then timeEnd
            'timeEnd'      => 'date_format:"H:i"|required',
            'active'       => 'integer|required'
        ];

thank you

21 Nov
3 years ago

Giolf started a new conversation Stunning Phpstorm Template

just 1 word to describe it: amazing https://laracasts.com/series/laravel-5-fundamentals/episodes/12

someone know if jeffrey way has released it ? or maybe somebody else could replicate it ?

10 Nov
3 years ago

Giolf left a reply on From Orange To Blue ???

Wait wait @JeffreyWay i like much more the new features and layout! about it big up and nice job! i was just speaking about the color: why blue ? but it's completely a personal opinion.

Giolf started a new conversation From Orange To Blue ???

Whaaaaat ... ? I would like to have back the old forum :)

09 Nov
3 years ago

Giolf left a reply on Migration Foreign Key Constraint Error On The Pivot Table With Combined Primary Key

which is the order of your tables migration ? be sure that first are created the tables: lectures and users, then watched table.

Giolf left a reply on Is There A Way To Pass Links To Custom Error Messages?

Inside your validation.php file you can do something like this:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Custom Validation Language Lines
    |--------------------------------------------------------------------------
    |
    | Here you may specify custom validation messages for attributes using the
    | convention "attribute.rule" to name the lines. This makes it quick to
    | specify a specific custom language line for a given attribute rule.
    |
    */

        'custom' => array(
            'attribute' => array(
                    'ruleName' => 'message'
            )
    )
];

In your case you can do something like this:

'custom' => array(
        'email' => array(
            'unique' => 'Email has already been used, click <a href="http://link-you-want">here</a> 
                            to see your stuff'
        )
)

Giolf left a reply on Integrated Testing

are you using the DB class in this file ?

use DB;

Giolf left a reply on Integrated Testing

mmmhh can i see your code ?

08 Nov
3 years ago

Giolf left a reply on Eloquent Relationship Not Working From Query Builder Results

try to use the foreign key inside your relationship:

    /**
     * Get the type that owns the person
     */
    public function type()
    {
        return $this->belongsTo(
            // the model you want create the relationship
            'App\Models\PersonType', 
            // the foreign key in your 'local' table of the model you want create the relationship
            'personType_id'                                               
        );
    }

Giolf left a reply on How To Combine Firstname Lastname And Middlename

@ModestasV i'm not a big fun of them, especially if you need to use them for rendering view (just show data), and in the forms (for edit the same data).
I prefer to write my own function in the model.

Giolf left a reply on ErrorException

another question:
this is the register method of the serviceProvider of the country-list package:

    public function register()
    {
        $this->app['countrylist'] = $this->app->share(function($app)
        {
            return new CountryList;
        });
    }

in my accessor:

getBirthPlaceAttribute($value)

i need an instance of CountryList ... how can i inject this dependency as a parameter? like:

getBirthPlaceAttribute($value, CountryList $country)

Because inside the accessor i need to use the getOne method.

Giolf left a reply on ErrorException

yes .. it works ... i can use it without problem. But when i use the method getOne in my view if a user doesnt have a birthPlace (is not a required field) the method getOne throw an exception (and this is perfectly normal) because it's trying to find a country that doesnt exist ... the problem is handle this exception without usin 3838383 times getPrevious()

Giolf left a reply on ErrorException

It's a package: https://github.com/Monarobase/country-list

I'm little bit scared that maybe it's for laravel 4 and me i'm using laravel 5 ... but it works perfectly ... i've just this problem with the exception ...