rabol

rabol

Member Since 3 Years Ago

Experience Points 26,430
Experience Level 6

3,570 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 249
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

14 May
1 week ago

rabol started a new conversation Getmxrr Not Working On Homestead Box

Hi

the function getmxrr() does not work on the Homestead dev box nor does nslookup

is that a VirtualBox issue or ?

Thanks in advance

09 May
2 weeks ago

rabol left a reply on Scheduler Not Working As Expected

on the Homestead (Ubuntu?), one also need to specify the user

* * * * * root /usr/bin/php /home/vagrant/code/blog/artisan schedule:run >>/tmp/blog_cron.log 2>>/tmp/blog_cron_err.log

root should of course be replaced with a more appropriate user

rabol left a reply on Scheduler Not Working As Expected

@SNAPEY - thanks, I will give it a try

Then the documentation should be updated :)

I copied the crontab entry from:

https://laravel.com/docs/5.8/scheduling#defining-schedules

rabol started a new conversation Scheduler Not Working As Expected

Hi

I'm trying to setup some jobs to be executed daily and hourly

for the test I'm using a local Homestead box

Cron is running Crontab looks like this:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
* * * * * cd /home/vagrant/code/blog && php artisan schedule:run >> /dev/null Z>&1
```

app/console/Kernel.php looks like this:

```
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('inspire')->hourly();
        $schedule->job(new MyJob())->daily();
        $schedule->job(new MyJob())->hourly();
        $schedule->command('telescope:prune')->daily();
        $schedule->job(new Heartbeat)->everyFiveMinutes();
    }

```

I have rebooted the server

but still nothing is happening

I'm sure I miss something, but what

Thanks in advance
07 May
2 weeks ago

rabol left a reply on Is Supervisor Installed By Default In The Homestead Box

Hi

I have tried my best to follow the update, but a small thing 'bugs' me

according to Github, the latest release is 8.4.0 when I do a git checkout v8.4.0 i get this: HEAD is now at c1e194b Tag v8.3.4

I added the "laravel/homestead": "^8" to my composer.jason and did a composer update

vagrant destroy vagrant up

and then when I log into homestead it say:

  • Homestead 8.4.0 released!
  • Settler v7.2.1 released! Make sure you update

supervisord -v 3.3.1 which is from 2016

I would not mind installing a new version of supervisor myself, but using the 'normal' way does not work, and as I'm not a Linux guy I'm kind of lost.

By 'normal' i mean pip install --upgrade supervisor New version is downloaded, it say that it's installed but it's not working

rabol started a new conversation Is Supervisor Installed By Default In The Homestead Box

Hi

Is the supervisor tool installed by default in the Homestead Vagrant box?

I ask because I thought that I installed it, but now I have 'destroyed' the VM and created a new and Supervisor is still there - but in a old version the same goes for pip and it's difficult to update.

sure, pip install --upgrade supervisor should work, but it does not, it say that a new version is installed, but executing supervisord -v shows 3.3.1 and the downloaded version is 4.0.2

If supervisor is installed by default, why then a old version ?

if it is not installed by default, why is it then running on my box after a : vagrant destroy and vagrant up command?

23 Apr
1 month ago

rabol left a reply on Why Does \Log Not Work In Jobs

@SNAPEY - After a good night's sleep, I doubled checked all configuration and ensured that Supervisor was properly restarted - Now it works.

Lessons learned: Make sure that Supervisor is 'restarted' correctly, otherwise it does not pick up any code changes

22 Apr
1 month ago

rabol left a reply on Why Does \Log Not Work In Jobs

@SNAPEY - Job is run by Supervisor

rabol left a reply on Why Does \Log Not Work In Jobs

Changing owner did not solve the issue

rabol left a reply on Why Does \Log Not Work In Jobs

@RONON - I'm using homestead so I assume that it is www-data, I will give it a try

21 Apr
1 month ago

rabol left a reply on Route-Model Binding Doesn't Work

And you are sure the parameter in the controller is called exactly the same as in the route definition?

rabol started a new conversation Why Does \Log Not Work In Jobs

Hi

What can I do to log actions or error in jobs?

I use \Log::Info() but nothing is logged

02 Apr
1 month ago

rabol started a new conversation How To Enable XML-RPC On Homestead

Hi

How can I enable XML-RPC in the Vagrant/Homestead dev environment ?

01 Apr
1 month ago

rabol left a reply on How To Make The --force Work On Generator Command

this is the code in the GeneartorCommand - handle()

if ((! $this->hasOption('force') || ! $this->option('force')) && $this->alreadyExists($this->getNameInput())) { $this->error($this->type.' already exists!');

        return false;
    }

so if I parse 'force' in the 'options', then the above should not be executed

rabol left a reply on How To Make The --force Work On Generator Command

@SNAPEY - No, but by own command ask and the values are passed to the Artisan call

rabol started a new conversation How To Make The --force Work On Generator Command

Hi

I'm trying to create a artisan command will generate some code based on stub's

parameters are collected and parsed to Artisan::call()

but for some reason the --force does not have any effect

Is there something special one have to do to make the --force work when creating e.g. a controller class?

21 Mar
2 months ago

rabol left a reply on Method Illuminate\Validation\Validator::validateRequired|date|before Does Not Exist.

@TOMOPONGRAC - Thanks! Almost okay

the start date is now validated correctly

but... end date is 'optional' so it should only be validated if entered

so if no end date I get this:

rabol started a new conversation Method Illuminate\Validation\Validator::validateRequired|date|before Does Not Exist.

Hi

In a form request I try to validate that the start date is before today and the end date is before the start date in my FormRequest derived class i have this: public function rules() { return [

        'start_date'    => ['required|date|before:today'],
        'end_date'      => ['date|before:start_date']
     ];

}

public function messages() { return [ 'start_date.required' => 'The :attribute field is required.', 'start_date.before' => 'The :attribute field must be before today', ]; }

when I submit my form I get this error:

Method Illuminate\Validation\Validator::validateRequired|date|before does not exist.

What did I miss ?

Thanks

14 Mar
2 months ago

rabol left a reply on Why Does Storage::disk('local')->deleteDirectory($directory); Not Work

Crap.... When I save, i have the 'public' as second parameter so that should also be included when deleting

rabol started a new conversation Why Does Storage::disk('local')->deleteDirectory($directory); Not Work

Hi

The user upload a picture and I save it using the Uploadfile from a form.

image is saver in a subfolder like this: $image->store('/user/' . auth()->user()->id . '/' . $doc->id, 'public'); returned path is correct and everything is fine.

Then later I want to delete the user and his images but it does not work.

$directory = '/user/' . auth()->user()->id; Storage::disk('local')->deleteDirectory($directory);

nothing is deleted

Any hints ?

15 Feb
3 months ago

rabol left a reply on Homestead Acting Strange

and debugging is not working

rabol started a new conversation Homestead Acting Strange

Hi

I have just made a new installation on my MBP of Vagrant and Homestead Mapped 3 folders and created 3 Sites

did a index.php with only phpinfo(); code and all 3 sites worked

Then I want to install OctoberCMS, I downloaded the installer, and then at the end I get this: LARAVEL_START already defined

I do understand that one might say that it is a problem of OctoberCMS, but...

If I do php artisan key:generate I get this:

Application key [base64:jkL0wB5oW5M6tYUPTnv32S5krDA6nKToPQRfV0AQWX8=] set successfully.

however the .env file is not updated

Any hints?

19 Oct
1 year ago

rabol left a reply on My Laravel App Does Not Work Any More...

damn.... mod_rewrite was not enabled...

rabol started a new conversation My Laravel App Does Not Work Any More...

Hi

For the last 2 months I have not done any Laravel dev on my Mac, but today I wanted to play around, but none of my local Laravel apps was working any more

Sure, the 'main' url like laravel.dev showed the main page, but as soon as I tried something like laravel.dev/login i get a 404

php artisan route:list shows that the route is correct

I have followed this: https://mallinson.ca/osx-web-development/

Now, the first thing one would ask is: What changes have happened to the system, and I would say, none... but that is not completely true as I have installed latest Mac Updates

so, system is like this: macOS High Sierra, v 10.13 MySQL php 7.1.5

There is no errors in my apache config files There is no information in my apache error_log

I do know that it might not be a laravel error, but something in my system, but what?

Any help or hint would be highly appriciated

Thanks in advance

08 Jun
1 year ago

rabol started a new conversation Npm Run Dev Does Not Work

Hi

Environment: Mac OsX 10.12.5 php 7.1.0 node v8.0.0 npm 5.0.1 laravel installer 1.3.6

Did the following

laravel new mytest cd mytest npm install npm run dev

> @ dev /Users/steenrabol/Sites/mytest
> npm run development


> @ development /Users/steenrabol/Sites/mytest
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

fs.js:638
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

Error: ENOENT: no such file or directory, open '/Users/steenrabol/Sites/mytest/schema/loader.json'
    at Object.fs.openSync (fs.js:638:18)
    at Object.fs.readFileSync (fs.js:540:33)
    at validateOptions (/Users/steenrabol/Sites/mytest/node_modules/schema-utils/dist/validateOptions.js:35:27)
    at ExtractTextPlugin.extract (/Users/steenrabol/Sites/mytest/node_modules/extract-text-webpack-plugin/index.js:206:3)
    at Sass.rules (/Users/steenrabol/Sites/mytest/node_modules/laravel-mix/src/Preprocessors/Preprocessor.js:46:42)
    at Mix.preprocessors.forEach.preprocessor (/Users/steenrabol/Sites/mytest/node_modules/laravel-mix/setup/webpack.config.js:243:33)
    at Array.forEach (native)
    at Object.<anonymous> (/Users/steenrabol/Sites/mytest/node_modules/laravel-mix/setup/webpack.config.js:242:23)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/steenrabol/.npm/_logs/2017-06-08T06_41_37_119Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/steenrabol/.npm/_logs/2017-06-08T06_41_37_205Z-debug.log

30 Mar
2 years ago

rabol left a reply on How Do I Include NPM Installed JS Library E.g JQuery UI

Trust me, I would not annoy YOU if i could find the answer

I looked at that thread and as others report it did not work, which is why I asked the question

rabol started a new conversation How Do I Include NPM Installed JS Library E.g JQuery UI

Hi

Sorry to ask here, but there is no mix channel

What is the correct / best way to include jQuery-UI in my project so that I can run npm run dev/production to generate appropriate files

First I do

npm install jquery-ui

then.. What ?

I tried to look at the videos, but did not really find the answer

Thanks in advance

27 Feb
2 years ago

rabol left a reply on How To Implement Sequential Numbers For Records

hmmm doctrine2/lib/Doctrine/ORM/Id/SequenceGenerator.php

but that is not part of Laravel

rabol left a reply on How To Implement Sequential Numbers For Records

yes, but the $nr is the one that I need, not the formatting :)

in good old ADO PHP, there was a GenId()

/**
 * Generates a sequence id and stores it in $this->genID;
 * GenID is only available if $this->hasGenID = true;
 *
 * @param seqname       name of sequence to use
 * @param startID       if sequence does not exist, start at this ID
 * @return      0 if not supported, otherwise a sequence id
 */

I was hoping that Laravel had something similar

rabol started a new conversation How To Implement Sequential Numbers For Records

Hi

Is there a easy way to implement sequential numbering for records?

What I need is:

on a table i have a string field, let's say seqId

and in every form I would like to initialise the field with the next number in in the sequence, but as the same time format it like INV-000001, INV-000002 etc.

It should be DB independent :)

Thanks in advance

22 Jan
2 years ago

rabol started a new conversation How To Extend Or Replace App\User At Run-time

Hi

Is there a way to extend or replace the App\User at runtime?

My goal is to add extra features to the App\User and have it available everywhere in the application.

Thanks in advance.

Kind regards Steen

26 Dec
2 years ago

rabol started a new conversation How To Do Multiple

Hi

How do I add multiple where clauses

e.g

$bmr = Bmr::where('gender', '=', $this->gender)->where('age_from', '<=', $this->age)->where('age_to', '=>', $this->age)->first();

the sql fro this is: select * from bmr where gender = '1' and age_from <= '50' and age_to = '=>' limit 1

it seems like the last where is not tanslated correctly

rabol left a reply on How To Add A User Profile

Thanks!

rabol started a new conversation How To Add A User Profile

Hi

For a new project I would like to add a 'User profile' to the user, however I do not want to add 20+ new fields to the users table

so i did the following: created a new migration (no foreign key constraint) created a new controller created a new model

modified the User model to create a new UserProfile when created Added a new function(relation) to my User model like this:

public function userProfile()
{
    $this->hasOne(UserProfile::class,'user_id','id');
}

then to test I did this in my home.blade.php

{{ auth()->user()->userProfile()->age }}

but... I get an exception:

Trying to get property of non-object (View: /Users/steenrabol/Sites/laravel/resources/views/home.blade.php)

What did I miss ?

25 Dec
2 years ago

rabol left a reply on How To Exclude Index From Route::resource

damn... i had ['Except' => 'index']... that did not work, but I did not think that the Capital E was the problem.

Thanks!!

rabol started a new conversation How To Exclude Index From Route::resource

Hi

i would like to exclude the 'index' of the Route::resource() How to do that ?

07 Nov
2 years ago
03 Nov
2 years ago

rabol left a reply on Createdb: Database Creation Failed: ERROR: Database "homestead" Already Exists

Actually I just updated the box and I saw that the error exists by default, not just because I am doing 'pr. project'

rabol left a reply on Createdb: Database Creation Failed: ERROR: Database "homestead" Already Exists

I mean... pr. project means that I have a new VM pr. project, not the same :)

rabol left a reply on Createdb: Database Creation Failed: ERROR: Database "homestead" Already Exists

yes, but I get the error when I do the vagrant up command I'm not trying to create a new database myself

rabol started a new conversation Createdb: Database Creation Failed: ERROR: Database "homestead" Already Exists

Hi

I have been doing a few 'Pr. project' Homestead VM's and doing my last I noticed this error: createdb: database creation failed: ERROR: database "homestead" already exists How can I have the database if I do a new VM pr. project ?

26 Oct
2 years ago

rabol left a reply on Homestead Installation On Mac OS X 10.12

I used this one: https://github.com/rlerdorf/php7dev

made it work in less than 10 minutes

rabol left a reply on Homestead Installation On Mac OS X 10.12

I'm giving this one a shot: https://github.com/rlerdorf/php7dev Homestead is way to 'complicated' :)

rabol left a reply on Homestead Installation On Mac OS X 10.12

yes, originally it was 192.168.10.10, but then I get this error ยดยดยด The specified host network collides with a non-hostonly network! This will cause your specified IP to be inaccessible. Please change the IP or name of your host only network so that it no longer matches that of a bridged or non-hostonly network

and I found another post describing that problem and the solution was to use something like this - not really sure why it would be a problem as my LAN is 192.168.10.xxx so adding another machine should be fine

with the 10.x.x.x the vm can start but does not respond on any of the 3 IP it have
I also added the network section to Homestead yaml due to the fact that my iMac is using WiFi

I'm actually puzzled why it is so complicated... it should be a 'simple' VM with pre-installed software, or do I miss the whole point ?

rabol left a reply on Homestead Installation On Mac OS X 10.12

and I have ~/Code

rabol left a reply on Homestead Installation On Mac OS X 10.12

Please forgive men, but I'm not trying to blame anyone - Simply a new user that is trying to follow the guide :)

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
10.1.1.33 homestead.app
---
ip: "10.1.1.33"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Code
      to: /home/vagrant/Code

sites:
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public

databases:
    - homestead

networks:
    - type: "public_network"
      ip: "192.168.10.20"
      bridge: "en1: Wi-Fi (AirPort)"
      
# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

rabol left a reply on Homestead Installation On Mac OS X 10.12

well... as I mentioned, I have just switched to MAC from PC and it is the first time that I need the ssh key, so for me it is not something that I use on a daily basis.

"Remember, you didn't run homestead AFTER you configured it" - well, I'm following the installation guide and there is no reference to do something after configuration , except 'vagrant up'

In my Homestead folder there is a php script called homestead, but that produces a lot of errors as well

rabol left a reply on Homestead Installation On Mac OS X 10.12

again... the ~/Code directory should be created... since it is part of the 'default' it should be mentioned so 'dummy' users like me can get started :)

rabol left a reply on Homestead Installation On Mac OS X 10.12

Hi

If creating the key is 'required' it should be indluded in the init.sh or as minimum be written in the installation guide

I created the key, but then i get a new error:

"There are errors in the configuration of this machine. Please fix the following errors and try again:

vm:

  • The host path of the shared folder is missing: ~/Code"