ederson

Experience

7,865

4 Best Reply Awards

  • Member Since 3 Years Ago
  • 44 Lessons Completed
  • 0 Favorites

2nd October, 2018

ederson left a reply on Best Way To Get Running Totals Via Eloquent • 1 week ago

I tried to solve the same problem a few weeks ago. Ended up doing something like cronix suggests. I didn't do any performance tests but it is very clean. I get the sums with SQL per month and then add the monthly totals in php.

I m happy with it ?

28th September, 2018

ederson left a reply on Homestead Newbe Questions.. • 2 weeks ago

Not a vagrant guru but this

- map: ~/Documents/projects/tests
  to: /home/vagrant/tests

Instructs homestead to copy your local Documents/projects/tests in the vm's Filesystem. This doesn't exist in your actuall file system and that is why you cannot locate the path home/vagrant/tests.

So you can either connect through ssh and access the files in home/vagrant/tests or using explorer go to Documents/projects/tests

20th September, 2018

ederson left a reply on Separating API Controllers And Web Controllers • 3 weeks ago

Because your controller extends App\Http\Controllers\Controller

ederson left a reply on Form Request: The Request User In Null • 3 weeks ago

stupid stupid stupid !!!!!!!!!!!!!!!!!!!!!

i use the api route file and i for some strange reason i assumed that auth:api is applied by default !

thanks for the help!

ederson left a reply on Form Request: The Request User In Null • 3 weeks ago

thanks tykus but i ve tried it already

request()->user() returns null

I've checked that the $user passed in actingAs is as actual user

ederson left a reply on Form Request: The Request User In Null • 3 weeks ago

Sorry i should have added it in the first place It is a very simple test

$this->call('POST', 'api/goup', ['name' => 'Name','team'=>'team_id']);

$this->assertEquals(false, $fails);

then in the form request i extend the validator and access request()->user()

without the custom rule it works

ederson started a new conversation Form Request: The Request User In Null • 3 weeks ago

The task is to test form requests. In the general case it works fine.

There is a problem with one request where a custom validation rule is based on the user who made the request

In this case request()->user() is always null So far i tried 1)$this->be($user); 2)$this->actingAs($user); 3)manually login in a user

all failed.

any ideas on what i am doing wrong ?

15th September, 2018

ederson left a reply on "normal" Php Project With Laragon Possible? • 1 month ago

Laragon has actuall nothing to do with laravel. Laragon is just an all in one package like xampp which makes setting up a server really easy.

After that you arrle free to use the server as you like

7th September, 2018

ederson left a reply on How To Push The Laravel Project To Server Using PuTTy In Window System? • 1 month ago

Just follow the instructions and set the correct paths and permissions

it is not complicated

https://gist.github.com/noelboss/3fe13927025b89757f8fb12e9066f2fa

5th September, 2018

ederson left a reply on Why Laravel Dropped Elixir? Why Forcing Vue.js? What Is It That You Are Trying To Fix? • 1 month ago

I don't get the point.... I have no idea about Vue, I dont use view I couldn't care less about view...

I just develop my ideas using whatever part of laravel I need. Nobody forces me to use Vue or passport or whatever.

Even if there is some kind of financial connection to Vue then good for Taylor. He is not taking my money...

15th August, 2018

ederson left a reply on Is Laracast Becoming Unreliable • 1 month ago

I have a couple of a answered questions but asking from volunteers to work like payed support is irrational.

I think we take for granted things we shouldn't....

10th August, 2018

ederson left a reply on Custom Model Events And FireModelEvent • 2 months ago

Thanks for the reply

I am talking about custom model events which are defined in & observables and cannot be automatically triggered.

But I think you solved the problem... Although I went through the source code of fireModelEvent I see that the function is protected.

Thanks ?

9th August, 2018

ederson started a new conversation Custom Model Events And FireModelEvent • 2 months ago

There must be something embarrassing i am missing here

I have set up a few custom model events and an observer.

When i dispatch one of the event like this

    $this->fireModelEvent('someEvent"):

everything works perfectly

when i try to use the events in a controller though it is not workin

$m=Model::find(1);
$m->fireModelEvent('someEvent");

Call to undefined method Illuminate\Database\Query\Builder::fireModelEvent()

it is not making any sense to me so any help to understand what i am doing wrong will be highly appreciated

16th July, 2018

ederson left a reply on Append Prefix To URL Dynamically • 2 months ago

He did.. Unless you mean actually code it for you...

Anyway

IMHO better solution would be to use named routes

1st July, 2018

ederson left a reply on How Only Allow Authenticated User To Do API Request? • 3 months ago

You have to create the token yourself

20th June, 2018

ederson left a reply on Laravel Echo Not Listening • 3 months ago

I m in on the phone so I am maybe missing something but it looks like you are broacasting an event but you are listening a private channel

ederson left a reply on Unable To See Broadcast Notification? • 3 months ago

Check if he notification is sent.

19th June, 2018

ederson left a reply on Laravel Echo Not Listening • 3 months ago

localStorage.debug = '*';

Type this in console. Helped me a lot finding problems with Socket and echo

ederson left a reply on Unable To See Broadcast Notification? • 3 months ago

I had the same issue. I kept trying things and suddenly it worked. I think restarting the queue helped.

Are you sure you are subscribed to the private channel?

Try localStorage.debug = '*'; It helps a lot debugging socket problems

16th June, 2018

ederson left a reply on Trying To Understand The Mentality • 3 months ago

What topvillas said... We all were there... I still am.

Having said that I hate it when someone treats the forum as a free coding service where people will complete any task requested.

12th June, 2018

ederson left a reply on Is There Any Solutions To Delay Between Each Events ? • 4 months ago

Sorry , I wan't clear... Typing on the phone is a "§%$§"$%

Instead of one job to send 100 emails , create 20 'subjobs' for emails 5 and delay each subjob

I think this way we override the server's limit but i am not sure if it is proper way of handling such a problem

ederson left a reply on Is There Any Solutions To Delay Between Each Events ? • 4 months ago

what about despatch($sendJob)->delay() ?

11th June, 2018

ederson left a reply on Event/Listener Vs Job Vs Inline? • 4 months ago

I've been struggling with questions like this too...

I think that event/listener would be overengineering unless you need to do more than just subscribing to the newsletter. If it is just that then I would just use the controller.

I doubt there are significant performance advantages with any method. What makes the code more readable and easier to maintain.

5th June, 2018

ederson left a reply on Web Scraping With Laravel: Goutte Or Guzzle? • 4 months ago

You don't necessarily need guzzle to open the Web page. Guzzle makes http requests like the one you need to open the Web page. Goutte could also open a Web page with a different approach which may fail. After opening the page guzzle is useless where goutte allows you to go through the Dom structure

30th May, 2018

ederson left a reply on Learning Laravel • 4 months ago

Do you have subscription. Free users can't download videos.

Looks like you want everything served on a plate... Thyrosis has a point

17th May, 2018

ederson left a reply on Windows 10 Laravel Dev Environment • 4 months ago

Homestead can be a pain in the a$$ to make it work. Laragon for example in 10mins is ready to go

But running a win webserver means that you may not be able to use certain features. For example Horizon won't work

8th April, 2018

ederson left a reply on How To Make A Api Call To Third Party Within Laravel Controller? • 6 months ago

sorry i am using the phone and i cannot format this correctly

get GuzzleHttp\Client

then in your controller

$apiCall=new Client; $response=$apiCall->get($url);

ederson left a reply on How To Get Data With Third Party API ? Which Api Was Created By Other Company ? • 6 months ago

Are you asking in laracasts.com how to watch a laracasts.com video without subscription !??!

there is no other way to watch the video.

23rd March, 2018

ederson left a reply on Laravel Open View Using Ajax • 6 months ago

I do it this way too but i'd like to learn the proper way ....

Where do I store the html code to format the data? Keeping html code in the js file doesn't look right to me.

22nd March, 2018

ederson left a reply on [Macbook] Is The Macbook Pro 13" Good For Web Development • 6 months ago

I think you won't have a problem just some learning time to get used to iOS. My only "objection" is about the screen size ... Maybe because of the way I work but I prefer to have my editor , prompt and the browser open and visible on the screen , on a 13" I ve found this to be inconvenient

16th March, 2018

ederson left a reply on Installing Homestead Issues On Windows • 6 months ago

I wouldn't call nightmarish procedure the homestead installation on windows and I can assure you I am not an internt guru .....

8th January, 2018

ederson left a reply on Vagrant\Homestead - Setting Up Multiple Php Versions • 9 months ago

Thanks cronix..

I realised this a bit after posting here .... I knew a was missing something obvious

ederson left a reply on Vagrant\Homestead - Setting Up Multiple Php Versions • 9 months ago

sorry to hijack but i have the same problem and it is driving me nuts!

i need to use php 7.1 instead of 7.2

so i destroy the vm declare the php version for the project : php: "7.1" git fetch


remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/laravel/homestead
   1be508a..241c926  master     -> origin/master

git checkout v7.0.1

HEAD is now at 0d0082e... ? ? Tagging v7.0.1 (#750)
M       composer.lock
M       resources/Homestead.yaml

and the vagrant up....

php -v keeps saying 7.2 !!!

i am obviously doing something wrong here but i have absolutely no idea what......

20th November, 2017

ederson left a reply on Define New Custom Relationship Class • 10 months ago

That did it the trick ....... Thanks again

ederson left a reply on Define New Custom Relationship Class • 10 months ago

I don't have code that actually does something meaningful.

I was just testing things so i copied the code from hasMany and changed the name to of the class to HasManyCustom

Then in my model i use it the normal way

public function transactions1() {
      return $this->HasManyCustom('App\Transaction');
}

I get the exception :

Illuminate \ Database \ Eloquent \ RelationNotFoundException
Call to undefined relationship [transactions1] on model [App\Category].

The problem happens here vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php

 Relation::noConstraints(function () use ($name) {
            try {
                return $this->getModel()->{$name}();
            } catch (BadMethodCallException $e) {
                throw RelationNotFoundException::make($this->getModel(), $name);
            }
        });

Going through the code i found that the relationships are defined here vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasRelationships.php

but i don't want to touch core files

now that i describe the situation i think i could extend the HasRelationships trait ......

Thanks robrogers3 :D

19th November, 2017

ederson started a new conversation Define New Custom Relationship Class • 10 months ago

I am trying to create custom relation class. Possibly i don't need to but i is a nice opportunity to learn something .... So I went though the predefined classes like hasMany etc to understand how to create my custom class.

What i can't understand is where do i need to declare the new class so laravel knows about it.

I tried including the new class but it is not recognized as a relationship (RelationNotFoundException)

23rd October, 2017

ederson left a reply on Debugbar Shows Over 300 Queries • 11 months ago

My idea was that you could cache it for a few seconds so they won't be repeated in the same request ...

I had a similar problem and caching solved but maybe your data change faster

ederson left a reply on Debugbar Shows Over 300 Queries • 11 months ago

Wouldn't caching the queries help ?

26th August, 2017

ederson left a reply on Mystery Database Connectivity Error. • 1 year ago

I haven't faced the problem since my last post but i haven't found the cause. My guess is that it was caused by my code and not laravel. Since i made some changes to optimize my code the problem disappeared

17th August, 2017

ederson left a reply on Mystery Database Connectivity Error. • 1 year ago

I jinxed it ...... Got the same error

ederson left a reply on Mystery Database Connectivity Error. • 1 year ago

I am facing the same issue. I've change db_host to localhost and it so far it seems to be working but i want to wait a few days before calling a solution

29th July, 2017

ederson left a reply on Config('value') Is Not Working On Cron(laravel Scheduler) • 1 year ago

i decided to restart the server..... it fixed it!

ederson left a reply on Config('value') Is Not Working On Cron(laravel Scheduler) • 1 year ago

Could you try php artisan queue:restart ?

28th July, 2017

ederson left a reply on Config('value') Is Not Working On Cron(laravel Scheduler) • 1 year ago

I face the same issue.... I'm bumping this thread maybe someone has a clue

ederson started a new conversation Weird: Queued Job Seems To Be Cached • 1 year ago

Sorry if the title it misleading but i have no idea how toi describe this.....

I"ve spent most part of the day with this problem and it doesn't make any sense ....

I have a job that uses alaouy/Youtube (i dont't think it is important).

When i execute the job directly everything runs smoothly. If i use a queue (database) things start to get weird.... The script throws an exception about not finding the api key. Trying to solve this i've tried many things but i always got the same exception.

I got tired and frustrated so i started trying 'stupid' things ... For example changed the exception message, removed the exception etc always getting the same output... I even removed the package which should cause a different error,right ?

No,i still get the same exception.

I guess i am missing something about the way queued jobs are executed .... Any ideas would be highly appreciated

22nd June, 2017

ederson left a reply on Adding Animated Preloader While Job Is In Progress • 1 year ago

The only way i know is to make an ajax request , show the spinner , wait for the response , hide the spinner

for example (a very rough one that may contain errors i hope you'll go easy on me :) ) you have a link

<a id='action'>Do something</a>
$("#action").click(function(){
    showSpinner();
    $.ajax({url: "test.php", success: function(result){
    hideSpinner();  
        $("#div1").html(result);
    }});
});

clicking the link calls the showSpinner function you have defined somewhere makes the request and on success it hides the spinner

20th April, 2017

ederson started a new conversation How To Forget A Group Of Cached Keys • 1 year ago

I have a bunch of keys in the form somekey-userID under certain conditions i need to delete all of somekey- keys (not the whole cache)

Unfortunately i can only user file cache so tags are not available to me

I ve found an old post suggesting dot notation (somekey.userID) but it doesn"t work.

Fetching all user IDs and looping creating every key works but then it negates the advantages of caching in the first place

Is there an efficient way of doing that ?

18th April, 2017

ederson left a reply on How To Test Facebook Login Implemented By Socialite • 1 year ago

The instructions are very helpfull. I don't know where you find difficulties

You can check this out too ,it is exactly what i did.

https://blog.damirmiladinov.com/laravel/laravel-5.2-socialite-facebook-login.html#.WPXiVdKLS70

I have a website in development on my local server there is no public ip nor a domain name but instead i used the local url like the one on the example.

ederson left a reply on How To Test Facebook Login Implemented By Socialite • 1 year ago

I was able to test it using as callback url a local ip on my local test server

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.