SaeedPrez

SaeedPrez

Member Since 3 Years Ago

♥ ☺ ☻ ☺ ☻ ☺ ♥

Experience Points 265,460
Experience Level 50

0 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 797
Lessons
Completed
Best Reply Awards 378
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.

15 Oct
1 year ago

SaeedPrez left a reply on Best Way To Become A 'web Programmer'

@Jaytee many of us suffer from this, we want "instant gratification". For example, I have to work on my project but my project is weeks/months away from being finished and therefore so is my reward, but if I help someone else, I get my reward now/soon.

For me this usually happens when I set too big goals instead of splitting it into smaller manageable tasks that I can finish in minutes/hours. Also if I have a hard time getting started, I pick the smallest/most fun task, it usually gets the ball rolling.

Using the example @KNietzsche wrote..

This is the Kaïzen theory of the little steps... If you want to go for 1 miles, you first need to do the 1st step, then another and another ! step by step...don't look behind, go forward...and one day, you reach your destination ! There you can say....wow ! I did it !

Basically, if I have to walk 1 mile I'll have 999999 reasons why I can't, not in the mood, my legs hurt, it's too long, and so on but if I have to walk 1 step, that doesn't seem that bad or hard even with all my excuses so I'll take the first step.. Nice, that wasn't that bad.. Now another step.. Awesome! And another step and another.. you get the sense of accomplishment all along the way instead of at the end goal and you keep moving forward. This is why I have 1000 lists, because I love checking items off lists and looking at how far I have come ☺

If you google "instant gratification" there is a lot of information that you can read up on.

SaeedPrez left a reply on Vue Or Angular

Angular is "best for SPA" and not "only for SPA", there is a big difference.

SaeedPrez left a reply on Vue Or Angular

Just for the sake of argument..

I would argue that you should pick a JavaScript framework based on your needs. If community support is one of your strongest requirements, then AngularJS is way more popular than VueJS and there are other sites much bigger than Laracasts where you can get your questions answered.

Also to me and to my project, it doesn't matter that VueJS has been on Laracon (I don't even understand what this has to do with anything or how it helps me build my application?) or that Taylor Otwell prefers VueJS. It takes 5 minutes to swap out the boilerplate VueJS stuff with AngularJS.

Note that I'm not saying pick VueJS or AngularJS, I'm saying you should probably go read up on the differences before you decide to learn a new framework and not rely on information from a biased community ☺

Both are great frameworks and unless you have very specific needs, you probably can't go wrong here with either framework.

PS. If you plan do make a living on this, you should probably check your local job market to see which framework has most demand.

14 Oct
1 year ago

SaeedPrez left a reply on Intro

Spark is a Laravel package that provides scaffolding for all of the stuff you don't want to code.

  • Subscription billing? They got that.
  • Invoices? No problem.

They even take care of:

  • authentication
  • password reset
  • team billing
  • two-factor authentication
  • profile photos
  • and more

It's the perfect starting point for your next big idea.

05 Oct
1 year ago

SaeedPrez left a reply on How To Open PDF In A New Window Instead Of Having To Download It

Hey @jlrdw, how are you doing buddy? Missed you too. I thought I'd see how you guys were doing over at Laracasts. These days I'm just a shadow lurking in the backgrounds :)

SaeedPrez left a reply on How To Open PDF In A New Window Instead Of Having To Download It

// Perhaps..
return $pdf->inline();

// Alternatively, if you want to give it a filename..
return $pdf->inline('record.pdf');

Source: https://github.com/barryvdh/laravel-snappy#usage

23 Apr
2 years ago

SaeedPrez left a reply on 500 (Internal Server Error)

Check the server log files or the best anyone can do is to offer a wild guess.

You can also:

  1. edit your .env file
  2. set APP_DEBUG=true
  3. open developer tools in your browser
  4. go to the network tab
  5. while the developer tools is open try your ajax script
  6. it will show as a red line in the network tab, click it
  7. then click the Preview tab, you can see the error there

SaeedPrez left a reply on Make Php Artisan Serve Multi Threaded

@kirankumar467 Ahh, great that you got it working..

For future reference though, if it's not production, don't use php artisan config:cache as it's a boost for the live server but can cause headaches in development since changes to the config won't take place until you clear the cache.

SaeedPrez left a reply on Make Php Artisan Serve Multi Threaded

@kirankumar467 In addition to all suggested solutions, also make sure APP_KEY is set in your .env file.

You can run php artisan key:generate to generate a new key.

22 Apr
2 years ago

SaeedPrez left a reply on Make Php Artisan Serve Multi Threaded

@kirankumar467 hmm, you'll have to check the log files to see what's going on.

Generally though, I recommend https://laragon.org/ to Windows users, it made my dev life so much easier compared to Xampp, Wamp, Homestead, etc.

Feel free to check out these videos if you'd like for more info, shows how to install Laragon and Laravel 5.4.

SaeedPrez left a reply on Make Php Artisan Serve Multi Threaded

@zachleigh sounds like you've had too little coffee today. Don't worry, I added a warning sign for you.

SaeedPrez left a reply on Make Php Artisan Serve Multi Threaded

@zachleigh you missed the Warning part ☺

SaeedPrez left a reply on Make Php Artisan Serve Multi Threaded

You need to use a real web server in production, that's what has to be done..

Apache, nginx, IIS, etc..

(Edit: Warning sign is for @zachleigh's PHP documentation quote)

19 Apr
2 years ago
18 Apr
2 years ago

SaeedPrez left a reply on Changing Profile Picture In The Forum

Hi @davy_yg

Yes, simply create an account on https://en.gravatar.com/ and you can there add profile picture to your email accounts. A lot of websites, including Laracasts will check with Gravatar if your email has a profile picture and if so use that.

17 Apr
2 years ago

SaeedPrez left a reply on Attach NULL

Problem is you want to create a relationship between an instance and nothing. This "relationship" is represented as not existing in the pivot table as the pivot table only holds existing relationships.

So perhaps you could somehow achieve this kind of behavior, but I believe at the end you will be creating more problems than you are solving.

A real world scenario might be that you'd like to fetch all instances where the relationship is external. If you actually have an instance called External, you can easily get all the relationships compared to working with null.

What about if the reverse relationship returns null, how do you know if that relationship doesn't exist at all or if it's external?

SaeedPrez left a reply on Request Fields In Model

@fdusautoir it might be easier to test if you pass in the request object. You could pass the whole request object or only the data you need, i.e..

public function submit(Foo $foo)
{
    $data = request()->only('body', 'difficulty', 'comment');
    $foo->submit($data);

    return back();
}

And then in your model..

    public function submit($data)
    {
        $this->updateFields('submit', $data);
        $this->archive('submit');
    }


      private function updateFields($status, $data)
    {
        $this->update([
            'body'        => $data['body'],
            'body_draft'  => $data['body'],
            'status'     => $status,
            'difficulty' => $data['difficulty'] ?: $this->difficulty,
            'comment'    => $data['comment'] ?: $this->comment,
        ]);
    }

SaeedPrez left a reply on Attach NULL

How about you create a relationship row/instance that is called External, attach all external relationships to that relationship instance. You could also add extra pivot table columns to store additional information.

SaeedPrez left a reply on Request Fields In Model

Hi @fdusautoir

Your approach is good because with the logic in your model, you can access it from anywhere. If your model gets too bloated consider moving the code to a repository.

I don't see why you shouldn't use the request global helper in your model.

SaeedPrez left a reply on Downgrade PHP From 7.1 To 7.0 On Digitalocean

I'm not a server/Linux guy but I'm assuming changing PHP version up or down would be the same as you simply pick which version you would like to replace the earlier version with..

With that said, maybe this will be of help to you..

https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-ubuntu-14-04

16 Apr
2 years ago

SaeedPrez left a reply on How To Get Insert Id For Raw Inserts

I don't see why not, try it yourself, see if you can beat it. If you can, then Laravel has a serious security bug.

15 Apr
2 years ago

SaeedPrez left a reply on A More Laravel Way

Perhaps if you add more lines to the comments, and make each line 3 characters shorter than the previous.

SaeedPrez left a reply on How To Get Insert Id For Raw Inserts

It will be safe if you validate the input first.

SaeedPrez left a reply on Call Text File From Storage

https://secure.php.net/manual/en/function.strip-tags.php

Use this to remove the tags.

https://secure.php.net/manual/en/function.htmlentities.php

Use this to convert the tags into HTML entities, for example convert < to &It;

SaeedPrez left a reply on How To Securely Track A Selected Item Across Page Views? (Laravel 5.4)

@ajck

With relationship I mean a relationship defined in your User model.

More info: https://laravel.com/docs/5.4/eloquent-relationships#defining-relationships

Also if no items are returned from that query, what will $item be - Null?

I think you can easily figure this one out yourself ☺

PS. If you haven't watched this already, you'll do yourself a HUGE favor if you stop coding, watch this series and then continue. It will save you tons of time and future headaches.

https://laracasts.com/series/laravel-from-scratch-2017

SaeedPrez left a reply on How To Get Insert Id For Raw Inserts

@palvaneh raw query mikhay chikar?

Look at the documentation, you can send it an array with column names and values.

$id = DB::table('mytable')->insertGetId([
    'name' => 'test',
    'loc' => DB::raw("POINT({$lon}, {$lat})"),
]);

SaeedPrez left a reply on How To Securely Track A Selected Item Across Page Views? (Laravel 5.4)

Do you have a relationship between the user and the items? If so, you could simply do..

public function showitemdetailspage($id) {
    $item = auth()->user()->items()-where('id', $id)->first();

    // logic if item is/is not found
}

This will limit the database query to only item rows the logged in user has access to and if they try a random ID in the URL, it will return zero items and you can show a message, redirect back or whatever you'd like.

SaeedPrez left a reply on Laravel Employee Attendance Management

Most of the knowledge you need you can find in this free video tutorial series:

12 Apr
2 years ago

SaeedPrez left a reply on Am I Just Stupid?

I started from zero experience with Java/Android development about 3 weeks ago, the first two weeks I basically spent 24/7 watching tutorials, reading articles and testing things out.

I would watch tutorial series, but some stuff made zero sense to me, for those I paused the tutorial I was watching, then I googled/youtubeed the subject to get another angle from another tutor,.. it usually helped to clear things up a little. Also I would write those hard things down, I would then continue on another tutorial and get back to the hard one when I had learned more, sometimes some piece of the puzzle is missing for it to make sense.

Today I have an app released for my restaurants/employees internal use and I'm now working on a simple game. I decided to make a game because it would be fun and challenging at the same time, forces me to level up with every step.

Point being hang in there,..

  • if one tutorial doesn't make sense, try another one
  • if something still don't make sense, write it down and come back to it after a few days
  • build something you enjoy, the fun makes the challenging part a lot easier
  • allow yourself time, mastering PHP/Laravel takes years of active development

SaeedPrez left a reply on Does Laracast Team Offer A Course Setup

Hi @jlrdw how are you doing?

Thanks buddy,I've been learning Java and Android development last few weeks, working on a game now ☺

SaeedPrez left a reply on Does Laracast Team Offer A Course Setup

You can do it in an email ☺

Buy a 1-month subscription, send the login info along with the links.

28 Mar
2 years ago

SaeedPrez left a reply on Filtering Data Using Fields And Pagination

@dom082186

You seem to overwrite the $jobseekers_list on every iteration in your foreach loop. This is why it seems to be prioritizing the last column expected_salary.

20 Mar
2 years ago

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object

@jrock2004 no worries..

You actually did me a big favor and opened my eyes, made me realize I'm spending way too much time (2+ hrs/day) on this forum trying to solve other people's problems.

Today is actually Persian new year, it's a good day to make a change. Perhaps focus more on my own problems, also on family and friends.

Thank you and good luck.

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object

@jrock2004 had you shown the whole if/else statement this would have been solved in 2 minutes.. but you showed this..

@if (Auth::guest() && $isUserRegEnabled == true)
    ....
@endif

FML,..

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object

@Snapey

The code will work if I take out the && $isUserRegEnabled.

This is what threw me off, how would you explain this? The error message has nothing to do with undefined variable.. It makes no sense to me why it would work if he removes the variable..

...unless, if he has an @else that he didn't show.. then it would make sense, cause the @if statement would fail and the @else statement would execute where he's trying to access the authenticated user without being logged in.

SaeedPrez left a reply on Email Or Username Log In LARAVEL 5.4

Take a look at the below link, of course you need to modify it to fit your needs but it should point you in the right direction..

https://laracasts.com/discuss/channels/laravel/override-auth-function-to-create-login-form-in-which-user-can-login-with-email-id-or-phone-number/replies/325847

SaeedPrez left a reply on Illegal String Offset 'name'.how To Solve This Error Can Anyone Please Tell Me

@jhansi I can't see the screenshots, the page requires me to login..

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object

@jrock2004 hm, are you using paginator? If so, try disable that (use ->get() instead) and see if that changes anything..

19 Mar
2 years ago

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect.

I'm not really sure why it's giving you the wrong class, but some things you can try..

  • run composer dump-autoload and php artisan optimize
  • delete the vendor folder and run composer install or composer update to update to latest versions
  • create a new Laravel project and move your code over there step by step, to see if and when it fails (what makes it fail)
  • waiting, maybe someone else has a solution
  • open an issue on GitHub for laravel/framework

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect.

From what I can understand, you're getting the wrong class, it should call guest() on \Illuminate\Routing\Redirector and not \Illuminate\Http\RedirectResponse when calling the redirect() helper..

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect.

Hm.. the code you've provided is fine but have you changed anything in the auth controllers, added any middleware or packages?

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect.

Can you paste the whole error?

SaeedPrez left a reply on Call A PHP Page (not Blade) From A Controller

Move the file to your resources/views folder and you call it exactly like you call a blade template.

// This will return either of these
//    resources/views/test.blade.php 
//    resources/views/test.php
return view('test');

Edit:

If you really want to keep the views in your public folder, add the path to your config/view.php file..

    'paths' => [
        realpath(base_path('resources/views')),
        // add it here
    ],

SaeedPrez left a reply on Feedback To My Media Sharing Site

No problem, good luck with the site.

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object

I don't see anything wrong the code you've provided and I don't think the error Trying to get property of non-object is because Laravel can't find the variable, if it was it would say Undefined variable,..

What happens if you instead try..

public function boot()
{
//    view()->composer('shared.nav', function($view)
//   {
//        $view->with('isUserRegEnabled', config('app.ALLOW_REGISTRATION', false));
//    });
    
    view()->share('isUserRegEnabled', config('app.ALLOW_REGISTRATION', false));
}

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object

@jrock2004

I copy/pasted your code just like it is in a project of mine and it works fine, I only changed the view name.

What happens if you remove the variable, does it work then?

@if (Auth::guest())
    ....
@endif

If it works without $isUserRegEnabled, double check the spellings and view names. Also try clear the view cache with php artisan cache:clear .. hm..

SaeedPrez left a reply on Feedback To My Media Sharing Site

Hi @Chris1904

The site looks very nice, I like the clean design. A few minor things..

  • The report abuse page is blank
  • If you go to the popular page and change the view to bigger pictures, there is a bug
  • If you go to forgot password page, the login/register links are broken
  • On the register page, there is no client side validation which is very annoying because you get the reCaptcha and then it submits and you get the errors, which means you have to do the reCaptcha again and again until you get it right.
  • On the affiliate page, why is it per 10 000 instead of per 1 000?
18 Mar
2 years ago

SaeedPrez left a reply on The Bug Without Any Information

Sounds like somewhere you have an unintended i character, echo 'i' or something similar.

Add this to your routes file and visit yourproject.com/test

Route::get('test', function() {
    return '';
});

See if the i still persists.

  • If it doesn't, it's likely in one of your views, maybe the master layout
  • If it does then it's likely in the code somewhere, maybe a middleware
17 Mar
2 years ago

SaeedPrez left a reply on Invalid Argument Supplied For Foreach()

Glad it got solved ☺