SaeedPrez

Founder at Sarvitech

Experience

303,200

469 Best Reply Awards

  • Member Since 1 Year Ago
  • 800 Lessons Completed
  • 1 Favorite

24th April, 2017

SaeedPrez left a reply on Laracasts.com Billing And Support Issue • 2 months ago

I won't go too deep into detail how this fountain of knowledge is way too cheap at ~$7/mo and all that..

Imagine if you'd bought 2 x 1 year subscriptions, the second one would extend the first one. Same applies here, you bought a 1 year subscription and then halfway through you bought a lifetime subscription, only because it was a 50% discount deal, so it will take effect after your 1 year subscription is over. I don't think that is unjust.

I can understand your feelings towards the ignoring part, I've had some issues with that myself early on. But then I came to terms with it, especially after I started uploading a few short tutorials on YouTube. I know how many people contacted me on YouTube, Twitter, etc and my videos barely have any views, I can only imagine the amount of emails, messages, etc Jeffrey has to go through every single day.

Also, I think this site is such a valuable resource at such a low price and I think we should accept how it is ran. Because the alternative would be to perhaps double the price so he could hire someone to sit and answer the emails and whatnot and that would hurt the community, maybe fewer people could afford to use this resource.

SaeedPrez left a reply on Laracasts.com Billing And Support Issue • 2 months ago

I'm a little unsure if I understand what the issue is,.. do you want a refund on the remaining months of your yearly subscription? If so, obviously I can't say 100% but I doubt you'll get money back and if you'd like, I can argue it is wrong to expect that.

23rd April, 2017

SaeedPrez left a reply on 500 (Internal Server Error) • 2 months ago

Check the server log files or the best anyone can offer is 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 • 2 months ago

@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 • 2 months ago

@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.

22nd April, 2017

SaeedPrez left a reply on Make Php Artisan Serve Multi Threaded • 2 months ago

@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 • 2 months ago

@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 • 2 months ago

@zachleigh you missed the Warning part ☺

SaeedPrez left a reply on Make Php Artisan Serve Multi Threaded • 2 months ago

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

18th April, 2017

SaeedPrez left a reply on Changing Profile Picture In The Forum • 2 months ago

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.

17th April, 2017

SaeedPrez left a reply on Attach NULL • 2 months ago

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 creating more problems than you are solving.

SaeedPrez left a reply on Request Fields In Model • 2 months ago

@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 • 2 months ago

How about you create a relationship 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 • 2 months ago

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 • 2 months ago

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

16th April, 2017

SaeedPrez left a reply on How To Get Insert Id For Raw Inserts • 2 months ago

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.

15th April, 2017

SaeedPrez left a reply on A More Laravel Way • 2 months ago

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 • 2 months ago

It will be safe if you validate the input first.

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

@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 • 2 months ago

@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 Get Insert Id For Raw Inserts • 2 months ago

Take a look at insertGetId()

https://laravel.com/docs/5.4/queries#inserts

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

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

$item = auth()->user()->items()-where('id', $itemId)->first();

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 • 2 months ago

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

12th April, 2017

SaeedPrez left a reply on Am I Just Stupid? • 2 months ago

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.

SaeedPrez left a reply on Does Laracast Team Offer A Course Setup • 2 months ago

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 • 2 months ago

You can do it in an email ☺

28th March, 2017

SaeedPrez left a reply on Filtering Data Using Fields And Pagination • 2 months ago

@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.

20th March, 2017

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 3 months ago

@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 • 3 months ago

@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 • 3 months ago

@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 a @else that he didn't show..

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

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

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 3 months ago

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

19th March, 2017

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect. • 3 months ago

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)
  • open an issue on GitHub for laravel/framework

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect. • 3 months ago

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

SaeedPrez left a reply on Method [guest] Does Not Exist On Redirect. • 3 months ago

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. • 3 months ago

Can you paste the whole error?

SaeedPrez left a reply on Call A PHP Page (not Blade) From A Controller • 3 months ago

You call it exactly like you call a blade template.

// Would return resources/views/test.blade.php or test.php
return view('test');

SaeedPrez left a reply on Feedback To My Media Sharing Site • 3 months ago

No problem, good luck with the site.

SaeedPrez left a reply on AppServiceProvider Giving Me Non-object • 3 months ago

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 • 3 months ago

@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 • 3 months ago

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?

18th March, 2017

SaeedPrez left a reply on The Bug Without Any Information • 3 months ago

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

17th March, 2017

SaeedPrez left a reply on Invalid Argument Supplied For Foreach() • 3 months ago

Glad it got solved ☺

SaeedPrez left a reply on Laravel MethodNotAllowedHttpException For Request • 3 months ago

No one can help you without wildly guessing when you change the actual code that is causing the problem.

Here's my guess, make sure you don't have a trailing slash in the URL when sending the ajax request.

SaeedPrez left a reply on Override Auth Function To Create Login Form In Which User Can Login With Email Id Or Phone Number • 3 months ago

I think the SUPER BEST way is if you write your own framework from the ground up, that way you can make it exactly the way you want it.

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

@jhansi

Let's assume you have the following array..

$data = [
    ['name' => 'Saeed Prez',    'email' => [email protected]'],
    ['name' => 'John Doe',      'email' => [email protected]'],
    [                       'email' => [email protected]']
];

Then you do a foreach..

foreach($data as $person) {
    $contacts[] = ['name' = $person['name'], 'email' => $person['email']];
}

This will cause the error illegal string offset 'name' because the 3rd $person has no name offset.

Edit Your Profile
Update

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