Dreamer

Dreamer

Member Since 3 Years Ago

Experience Points 13,265
Experience Level 3

1,735 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 91
Lessons
Completed
Best Reply Awards 1
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.

17 Aug
9 months ago

Dreamer started a new conversation How To Catch Braintree Cashier Exceptions?

Why does this not work when i try to register with invalid testing card?

try {
                Auth::user()->newSubscription($plan, $plan)->create($request->nonce,$data,$options);
            } catch (Exception $e) {
                return redirect()->back()->with(['error'=>$e->getMessage()]);
            }

Dreamer started a new conversation Found Some .bin Files In Upload Folder

So i have a website where people can upload their cv's. I validate all my uploads with `` $validator = Validator::make($request->all(), [ 'uploadfile' => 'required|file|mimes:pdf,txt,doc,docx,jpeg,png,jpg,gif,svg|max:10048', ]);

if ($validator->fails()) { return json_encode(['success' => false]); } ``

But i found some *.bin files inside the upload folder and they are uploaded files. How is this possible? Should i be worried? I tried those download links and it downloads file, it does not run them. I deleted those files as soon as i found them but they probably have been there for some time.

What should i do to protect myself from it?

I also looked into it more. The upload folder also contains files that i have not allowed, there are some html files and some image files with extensions i have not allowed. How can that be when i validate all my uploads?

29 Mar
1 year ago
28 Mar
1 year ago

Dreamer started a new conversation Am I Using Cashier The Right Way?

I have 3 plans with different billing cycles created at braintree sandbox. One for monthly, one for half a year and one for yearly. So, almost everything works right. BUT, when i try to swap plan from monthly to half a year i noticed that it does not calculate any discounts or anything. It shows that user has had 2 transactions with the full price of both. Last subscription is canceled and the new one is active.

I created an addon with the name plan-credit like it said in the docs.

What am I doing wrong? Do I have to leave only one plan and change billing periods and discounts manually on this single plan somehow? Keep in mind that i do have discounts if users billing period is larger than a month.

21 Feb
1 year ago

Dreamer left a reply on Callback Function On My Own Custom Class, How?

Thank you @lostdreamer_nl

Does it work with anonymous functions too? I will try it out.

Dreamer started a new conversation Callback Function On My Own Custom Class, How?

Is there a certain laravel way i should implement it? Or how would be the best way to code it? I never made callback functions on my own classes or functions so i have no idea how to implement it properly.

For example: ´´´ public function askYesNo($message=null,$callback=null) { //some code

    if ($success) //run $callback() with parameters and variables from "use";
    return $this;
}

´´´ I want it so if this function asks user a question and gets proper answer back then i need to run the callback function if it exists.

08 Feb
1 year ago

Dreamer left a reply on Weird Cache Problem

@bashy I checked, the session id remained the same throughout all of this. Whats also weird is that i sometimes get the unique validation error on my registration form even though i know for sure it was unique. Something weird is going on.

07 Feb
1 year ago

Dreamer started a new conversation Weird Cache Problem

Hello.

I use redis session and cache. I have a weird problem during registration. If user has validation error during registration, the user is not logged in after the registration and i get directed to the home page. Also, when logging out and then trying to register new user, i get the inactivity error that suggest reloading the page.

What could be causing this?

20 Dec
1 year ago

Dreamer started a new conversation How To Do Schedule:run Through Url

In the server i am working with i cant use the usual cron command i am used to and have to use the url for it. I just wanted to ask if doing something like this is stupid:

Route::get('/cron.php', function () {
        Artisan::call('schedule:run');
        echo Artisan::output();
    });

Or would this work just fine?

Dreamer left a reply on "The Page Has Expired Due To Inactivity. Please Refresh And Try Again."

This is really weird. I have the same problem. I have tried everything. Clear commands and moving sessions to database, using memcached, nothing helps. Users still get random inactivity errors on login... but not on any other page.

I have no idea whats going on. I do not know how to fix this.

Dreamer left a reply on User Randomly Gets Page Expired Error On Login

@wilburpowery

I did these but the problem is still there. I am out of ideas...

19 Dec
1 year ago

Dreamer left a reply on User Randomly Gets Page Expired Error On Login

@wilburpowery It only happens on production. I used array cache driver on dev and when i put the project to live server i forgot about it and it was like that for some time and then i got the complaint. I just switched to memcached to fix the issue as it was the most recommended option i found online but the problem is istill reported.

I am not sure what type of host is it... Its regular virtual server.

Dreamer started a new conversation User Randomly Gets Page Expired Error On Login

I have complaints that a user randomly gets "Page expired due to inactivity" error while logging in. It occurs randomly. The test they made was that they logged in and out and in again and got the error on third login.

I am using memcached and i have not seen this error myself. I tried logging in and out 10 times and nothing.

What could be causing this?

24 Nov
1 year ago

Dreamer left a reply on Requesting Advice On Relationships

Yeah. Polymorphic is the way to go for sure. Is the best way to create a relations table for every object? Like, contact_relations for Contact and make that Contact have polymorphic relation to everything that it needs? Like in the example on OP, it has relation to email, party, proposal, and other models that need it?

This creates a problem that table contact_relations may have entry to a party and then party_relations table may have one for that contact too. Then when trying to get morphto and morphedbymany relations, it will have 2 of the same models. And when deleting one relation, another remains...

Dreamer started a new conversation Requesting Advice On Relationships

I am creating a complex website and im planning relationships right now and would like a second opinion on it or suggestions how to keep it from going impossible to handle.

The thing is, there are a lot of models that could be tied to eachother in various ways.

Some relations are simple, like, a Company has one Contact. But, a lot of the time one object may have a lot of different (or same) models tied to it. For example. You create a Company, then create a Contact model for it, then create a Proposal for that Company. Now, the Company and Contact has to have connection to that Proposal. Not that bad. Then, create a Document and add that document to Proposal. Now, Company, Contact and Proposal has to have connection to the Document. Getting a bit more complicated... Now, when sending email to that company through Proposal, all of these models i mentioned should have a connection to that email. Also, there are a lot of other models too, like Invoice and Party and others like that and these should be connected too.

I know at some point this is going too crazy and i want to find a way to move that line as far as i can.

Obviously i cant do all of that with one record in the database and probably will have to create many relations upon creating one object...

Any advice?

29 Jun
1 year ago

Dreamer started a new conversation WhereHas For Polymorphic Relation Not Working, Alternative?

I have a lot of models that can have many tags and it is defined as polymorphic relation. At the list of specific model i would like to filter records by multiple tags and i tried using the whereHas for this. I encountered problems there and after an hour of trying i found out that laravel does not really support whereHas for polymorphic relations.

How do i then filter them?

I am using October CMS and it is for backend lists so i do not have total control over the whole query. I just need some query builder commands i that can put into the scope that does all of the filtering.

Can someone help me to put it together?

My original attempt was:

public function scopeWithTags($query,$ids=[])
{
    return $query->whereHas('tags', function($q) use($ids){
        $q->whereIn('id', $ids);
    });
});
17 Feb
2 years ago

Dreamer started a new conversation Laravel 5.4 Mix Compiling Really Slow

As the title says. I just updated my project to 5.4 and everything works great. Only thing is that npm run dev works really slow. It takes about 65 seconds to compile everything. With gulp it took around 5-10 seconds.

Css url() for images is my prime suspect but i cant be sure.

Anyone else experiencing this?

02 Feb
2 years ago

Dreamer left a reply on Stripe Vs Paypal

If Braintree has Paypal integration then maybe i should use that one instead... What is the reason people choose Stripe over Braintree if it gives more options for customers to pay... Seems like no brainer to me?

Dreamer started a new conversation Stripe Vs Paypal

Hello!

I am in a process of choosing the payment method for my upcoming app and it would be awesome if you guys/girls can clear some things up for me.

I am leaning towards Stripe because all of the benefits it offers (main one: my app service is subscription based and Stripe makes it really easy).

The thing is... I am worried that people would be discouraged because it is not Paypal. Have you had any experience with it?

I assume integrating Paypal and letting the user choose between the two later on is also an option. Right now it is important to get the page up as soon as possible,

19 Jan
2 years ago
18 Jan
2 years ago

Dreamer started a new conversation Get Mailable Object On MessageSending Event

Hi

Is it possible to get Mailable object when listening MessageSent event? My mailable object has a parameter that holds a Eloquent Model object and i want to update that object to reflect the exact time the email was sent.

16 Jan
2 years ago

Dreamer left a reply on How To Manually Provide Smtp Information For Mailable

@harran So, what you are saying is that if i set smtp config values inside a queue (inside mailable clas or job), the email will be sent using changed settings...

If that is true then now i have all the information i need to code it :) Not sure yet if i set config inside Mailable or Email model.

Dreamer left a reply on How To Manually Provide Smtp Information For Mailable

One solution that i can think of is to create an Email model (i do need detailed email log anyway) and save all data needed to send an email including smtp settings from user to database. Then, i can make a queued job that gets email id and retrieves it from database and just calls send method on it. That send method on Email model news mailable class, sets all needed attributes and uses Config::set() to update smtp information and then sends it.

Will this work?

Dreamer left a reply on How To Manually Provide Smtp Information For Mailable

@bobbybouwmann Thank you, this gets me a step closer! One thing though... If the email is queued, how does it work then? Does it use smtp settings that were present during the time mail was sent to queue or smtp settings that are present when the mail is actually sent?

At least now i can send emails...

Dreamer started a new conversation How To Manually Provide Smtp Information For Mailable

I am creating an app where users can save their smtp information and can then send emails through the app to their clients. Can i use Mailable class for it or what should i do to make it happen. Right now, Laravel uses global settings for all emails.

30 Nov
2 years ago

Dreamer started a new conversation Sending Email With Attachments Inside POST/Request

I could use some help with sending email with attachments in Laravel.

This is how it works now: User fills email form and selects files existing on the server. The result is posted to a controller. Controller runs a job with all parameters (to, cc, subject, files and so on). Job can be queued. Job runs notification and sends email to user adding all files to email as attachments.

Now i have to be able to add local files from users computer too.

Are files posted from the email form accessible to queued job and notification class? Or the only way is to first upload the files and save them on server to some temporary folder, then on notification, add them through urls?

14 Oct
2 years ago

Dreamer left a reply on Update Multiple Rows Using Query Builder (1 Query)

Is there any packages that can do this? I would hate to create new CASE mysql query every time. Maybe you could help me create a helper for this... For example:

function updateMany($table='table_name',$update=[1=>['field'=>'value1'],2=>['field'=>'value2'])
{

}
10 Oct
2 years ago

Dreamer left a reply on Add Custom Function To Auth Facade

@LozovoyV Thank you very much... Ill try it out and post results.

27 Sep
2 years ago

Dreamer left a reply on Add Custom Function To Auth Facade

@tomi Latest stable

@LozovoyV

Yeah, I was thinking about using helper but I really like consistency and I user Auth::user() everywhere in my code. Would love to use Auth::company() or something similar... Is it a hard thing to do?

25 Sep
2 years ago

Dreamer started a new conversation Add Cutom Function To Auth Facade

What would be the easiest way to add a function to Laravel Auth facade that would not be removed after composer update.

I dont want to change guard driver or anything else, i would just like to do

Auth::company()

and get same thing as i would get from

Auth::user()->company
14 Sep
2 years ago

Dreamer left a reply on Sotring Senisitve Information In Session

@tomi Thanks, just wanted to make sure :)

Dreamer left a reply on Sotring Senisitve Information In Session

Well, maybe, yeah. But if it could be set to true in any way by non admin user, the mess would be beig.

Dreamer started a new conversation Sotring Senisitve Information In Session

Is it a good idea to store users admin status on session like this:

session()->put('`is_admin', true);

It would only be run once on login and then different parts of application could use it without additional queries. Is it insecure in some way?

29 Aug
2 years ago

Dreamer started a new conversation Remember Captcha For Few Days Or More?

I can attach google captcha middleware to my routes and if user is not solved it yet, it will display the capctha page. It works well. I use session variable to store its status. The problem is, i want to protect a page that users (guests) will use frequently and i dont want them to solve captcha every few hours. This is default session lifetime in config files.

What is the best way to remember users captcha state for longer, for multiple days? Im not sure if setting session lifetime to a week or something is the best way to go. How about cookies? Can i set a value for a week but leaving session lifetime to 2 hours?

What would be the best way to solve this.

01 Aug
2 years ago

Dreamer left a reply on Using Synchronous Jobs

Thanks @aardalich

What is the trait i have to use to be able to dispatch jobs from custom class?

Dreamer started a new conversation Using Synchronous Jobs

Hello!

Is it a good idea to use synchronous jobs? I know the main focus of it is to queue something to be run separately from user page requests but are synchronous jobs also a recommended option when trying to do the same thing from multiple places?

The main plus for my application is that jobs have names that i can store in a variable and call it (new) depending another value. For example, if i have an array of possible actions a class can do for a specific model then i could just do something like this:

[
    job => 'PublishArticle',
    success => [
        event => 'ArticleWasPublished'
    ]
    fail => [
        event => 'ArticlePublishingFailed'
    ]
]

PS: I know i can call an event form job class. This is just an example. I could call specific job and event when needed without hardcoding it into the class - i need it to be flexible for future models and increasing amount of available jobs and events.

27 Jun
2 years ago

Dreamer left a reply on How To View Collections In Google Chrome

Had the same problem. Got it working by running site in incognito window - means some extension screws this up.

10 May
3 years ago

Dreamer left a reply on Laravel Suddenly Displays Redirecting Page?

@Prez

Yeah, i have the same environment. Ill guess ill try to fix it by moving it to another project when i have time to screw around :)

09 May
3 years ago

Dreamer left a reply on Laravel Suddenly Displays Redirecting Page?

@Prez

Thanks. I have never closed php tag in Laravel. I tried to find "dump(" command from app folder but there was not any and im sure i never used echo or anything like that, i always use dd or dump.

Ill check about the cookies... How do i disable them anyway?

But if that fails... im not sure what to do :) I guess ill try to move the whole project into new laravel install and see if that works.

BTW, i a using PHP 7 if that makes any difference...

Dreamer left a reply on Laravel Suddenly Displays Redirecting Page?

@Prez

Thanks for trying to help me. I tried it and this was the result:

$ find . -type f -name "*.php" -print0 | xargs -0 -I{} awk 'NR==1&&!/^<\?php/{print FILENAME}' {}
./public/js/plugins/ckeditor/samples/old/assets/posteddata.php
./resources/views/app.blade.php
./resources/views/auth/emails/password.blade.php
./resources/views/auth/login.blade.php
./resources/views/auth/passwords/email.blade.php
./resources/views/auth/passwords/reset.blade.php
./resources/views/auth/register.blade.php
./resources/views/errors/503.blade.php
./resources/views/front.blade.php
./resources/views/layouts/app.blade.php
./resources/views/pages/blank.blade.php
./resources/views/pages/blank_app.blade.php
./resources/views/pages/clients/create.blade.php
./resources/views/pages/clients/list.blade.php
./resources/views/pages/clients/profile.blade.php
./resources/views/pages/notices.blade.php
./resources/views/pages/offers/create.blade.php
./resources/views/pages/offers/list.blade.php
./resources/views/pages/test.blade.php
./resources/views/partials/clients/main_info.blade.php
./resources/views/partials/clients/select_form.blade.php
./resources/views/partials/clients/select_options.blade.php
./resources/views/partials/menus/app_main.blade.php
./storage/framework/views/119694f73aad6bd793ca1f2c0223876a747d120a.php
./storage/framework/views/2f248e3490fc9bef19dd385f39f17985daf3d4cd.php
./storage/framework/views/35ebfe9115200249ed8734a10b9932367288f36d.php
./storage/framework/views/5f4a817cefc4bbeca4f6c6795c4bd48761d18155.php
./storage/framework/views/98592eece7da4b280497a9e41bf6d6ae7fe11a2b.php
./vendor/phpunit/phpunit/build/phar-manifest.php
./vendor/phpunit/phpunit/build/phar-version.php
./vendor/swiftmailer/swiftmailer/lib/swiftmailer_generate_mimes_config.php

Dreamer left a reply on Laravel Suddenly Displays Redirecting Page?

@boynet

Thanks, yeah, i missed it. But i tried running

grep -rl $'\xEF\xBB\xBF' .

on my project using Git Bash on Windows. All files it found were on public folder and not anything that is included into php (js, xml).

Source: http://stackoverflow.com/questions/204765/elegant-way-to-search-for-utf-8-files-with-bom

Is there a way to find a file that has not php tag at the very beginning?

Dreamer left a reply on Laravel Suddenly Displays Redirecting Page?

@Prez

I do use git but, i have made A LOT of commits before i was even touching anything above routes. It would be very hard to test as i would have to make a view and routes for every state i would test.

What are the other reasons this problem would appear? Besides invalid file beginning? Ill take a new look at file beginnings...

Dreamer left a reply on Laravel Suddenly Displays Redirecting Page?

@h0lend3r

No errors in log when doing redirect or console commands.

Dreamer left a reply on Laravel Suddenly Displays Redirecting Page?

@Prez Cant seem to find the file. I checked all files that i have added/changed but every one of them had php tag at the very beginning of the file. It must be something global too because it happens everywhere - failed login, failed request validation, using redirect() anywhere.

06 May
3 years ago

Dreamer left a reply on Laravel Suddenly Displays Redirecting Page?

Seems like this is causing it.

https://github.com/symfony/http-foundation/blob/master/RedirectResponse.php

Line 81+

The file there havent been updated for 3 months... but something is causing it.

The redirect page appears when request validation fails or you do redirect()->something.

05 May
3 years ago