SaeedPrez

Founder at Sarvitech

Experience

268,930

421 Best Reply Awards

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

21st February, 2017

SaeedPrez left a reply on Fetch Both Uppercase And Lowercase During SQL Query • 14 hours ago

I second what @Cronix said... you're curing the symptoms instead of curing the disease.

SaeedPrez left a reply on Don't Allow Inactive Users To Login In Laravel • 15 hours ago

@user224564 Glad to help ☺

SaeedPrez left a reply on Don't Allow Inactive Users To Login In Laravel • 15 hours ago

There are a few ways to do this, for example manually authenticating the users and providing additional conditions..

Another way is to overwrite the credentials() method that Laravel uses. Add this to your LoginController.php

    protected function credentials(Request $request)
    {
        $credentials = $request->only($this->username(), 'password');
        $credentials['activated'] = 1;

        return $credentials;
    }

If you get an error, add use Illuminate\Http\Request; to top of your LoginController.php

SaeedPrez left a reply on HasMany->orderBy Refresh When Relation Models Changes • 15 hours ago

Can you explain why you have an if statement there?

SaeedPrez left a reply on Laracon Online • 15 hours ago

I blade Jeffrey Way, that best answer button is in a bad place and generally not very user friendly,.. I think the forum needs some love if he finds the time.

SaeedPrez left a reply on Laracon Online • 16 hours ago

@ohffs haha, indeed.. I deactivated all my social media accounts about a month ago but I just reactivated my Twitter account, I think it's the only one I'd like to keep. I've noticed it's hard to keep up with all the new things without Twitter.

SaeedPrez left a reply on Laracon Online • 16 hours ago

In the Swedish Laravel Slack we were thinking about having a meetup and watch it, but it starts in the middle of a weekday here so it's not gonna happen :(

SaeedPrez left a reply on Add WhereHas To A Relationship • 16 hours ago

$member->posts // return all posts as a collection
$member->posts() // returns the builder, this is what you need..

SaeedPrez left a reply on Remembering Pagination Page • 21 hours ago

Hi @scottjo

You will have to pass it along in each request or save it somehow.. I guess the easiest and cleanest way would be to save the page number in session, then in your controller..

  1. Check if URI parameter ?page=x exists
  2. If not, then check if page number exists in session

20th February, 2017

SaeedPrez left a reply on Creating 2 Logins • 1 day ago

@Ifrit I have no idea.

SaeedPrez left a reply on Creating 2 Logins • 1 day ago

I've created complex sites before where admins, resellers, vendors and users all used the same login but had access to totally different parts of the application.

I protected each part of the application with a middleware and routes where organized like this..

  • /a/path/to/route (protected by admin middleware)
  • /r/path/to/route (protected by reseller middleware)
  • /v/path/to/route (protected by vendor middleware)
  • /u/path/to/route (protected by user middleware)

I don't really see the benefits of having multiple logins, to me it's just more complexity, repeat code and more stuff to maintain..

19th February, 2017

SaeedPrez left a reply on Fetch Data From Another Table From A HasMany Result Set? • 2 days ago

Hi @Gerira

I would rename the relationship to items() then you could do..

@foreach($order->items as $item)
    {{ $item->name }}
@endforeach

SaeedPrez left a reply on Pagination Not Working In Laravel 5.3 With For Loop Iteration. Pagination Object Is Being Hide When I Use For Loop Or Foreach Loop • 2 days ago

@KhalilurRehman I can't really make sense of that unformatted wall of text, but what is important to understand is that you're taking objects and converting them to an array and at the same time you're stripping away all the extra properties and methods that is required for pagination to work.

For demonstration, try this code and see the difference in the output..

    // Your for loop

    // Add these two line
    dump($calls);
    dump($callsData);

    return $callsData;

18th February, 2017

SaeedPrez left a reply on Laravel 5.4 MIX + Stylus • 3 days ago

I'm not 100% sure about this, but I believe Elixir uses WebPack as well, you just have to use mix.webpack() instead of mix.scripts() and best of all, Elixir works.. it just works..

SaeedPrez left a reply on Laravel 5.4 MIX + Stylus • 3 days ago

  1. Remove Mix
  2. Install Elixir

Done ☺

SaeedPrez left a reply on SQL Query Works In DB Client But Not Works Within The Laravel App • 3 days ago

Just do a google search for mysql strict mode, .. I turn it off if I hit that block, but I guess one should dig deeper and try to understand why it's there and how to be friends with it..

SaeedPrez left a reply on SQL Query Works In DB Client But Not Works Within The Laravel App • 3 days ago

@zabius try change 'strict' => true to 'strict' => false in your config/database.php file under the mysql settings and see if that helps..

SaeedPrez left a reply on Hacked • 3 days ago

@Zurik.Ludg that is correct. The public folder is supposed to be the only folder the public has access to because of security reasons.

SaeedPrez left a reply on How To Convert 1000 To 1k ? • 3 days ago

Perhaps this Laracasts video could be useful here..

SaeedPrez left a reply on Hacked • 3 days ago

@Snapey

You're so on the point, I would say at least 80% of people on Laracasts don't know the first thing about programming or PHP (or at least they didn't know when they started with Laravel) and they would never have gotten into web development if it wasn't because of the low entry level.

SaeedPrez left a reply on Hacked • 3 days ago

@zachleigh indeed, a lot of them have their email passwords as well

SaeedPrez left a reply on Hacked • 3 days ago

I think that would be a good idea!

I can't help myself, I'm still searching and emailing people :D

Hello,

I don't know who installed your Laravel application, but I want to let you know that your website has been installed in an extremely insecure way with your passwords out in the open for anyone to see..

URL

I suggest you find someone more knowledgeable to fix the security issues around your website and also change the passwords.

I found your website invulnerability through a simple Google search and I'd wanted to let you know before it falls into harmful hands. 


​Best regards,​

SaeedPrez left a reply on Hacked • 3 days ago

@DirkZz nice idea, wow,. it's that easy to find these hackable websites..

Here's an example..

SaeedPrez left a reply on Hacked • 3 days ago

Wow, this is a huge problem because of shitty web hosts who set the FTP root to the document root.

Nice catch @Snapey ...

SaeedPrez left a reply on Pagination Not Working In Laravel 5.3 With For Loop Iteration. Pagination Object Is Being Hide When I Use For Loop Or Foreach Loop • 3 days ago

@KhalilurRehman of course it's being left out, your code is leaving it out...

What I don't understand is what are you trying to do accomplish with that loop? You're moving some properties from $calls and saving them as an array in $callsData

17th February, 2017

SaeedPrez left a reply on How Can I Run Run Schedule Job In Windows? • 4 days ago

I always thought you were supposed to run php artisan schedule:run every 1 minute..

SaeedPrez left a reply on Carbon Issue When Compiling The Classes • 4 days ago

@malhayek try delete your vendor folder and run composer install --no-scripts or composer install --no-scripts and see if that helps..

SaeedPrez left a reply on Carbon Issue When Compiling The Classes • 4 days ago

I always do ..

use Carbon\Carbon;

.. without problem. Try running composer dump-autoload... have you added any custom providers, custom packages, changed composer.json, etc?

SaeedPrez left a reply on BelongsTo Or HasOne • 4 days ago

This is the fundamental thing you need to know about Eloquent relationships..

  • ->hasOne() and ->hasMany() means the related model/table holds the relationship * ->belongsTo() means this model/table is holding the relationship id column id column
  • ->belongsToMany() means there exists a pivot table, and that table holds the relationship id columns

SaeedPrez left a reply on SQLSTATE[HY000] [2002] Connection Refused • 4 days ago

@hansje I have no idea if Homstead on Windows is the root of the problem,.. I was using Homestead on Windows successfully for some time but still it took quite some time to get things working and it was not always the way I wanted it.

In my opinion, the benefits that Homestead offers are not worth the trouble for the normal user.

I switched to Laragon a few weeks back and it just works, it's small and portable, fast, easy to configure and it allows me to focus on coding.

SaeedPrez left a reply on SQLSTATE[HY000] [2002] Connection Refused • 4 days ago

I'm running out of ideas,.. are you running everything from inside Homestead? If not, try port 33060..

If you're on Windows, I suggest to use Laragon instead and save yourself a lot of future headaches and head banging.

SaeedPrez left a reply on SQLSTATE[HY000] [2002] Connection Refused • 4 days ago

@hansje what if you change it to 192.168.10.10 ?

SaeedPrez left a reply on SQLSTATE[HY000] [2002] Connection Refused • 4 days ago

@hansje everything looks fine to me,..

  • after you changed the 127.0.0.1 to localhost, did you run php artisan config:clear ?

SaeedPrez left a reply on SQLSTATE[HY000] [2002] Connection Refused • 4 days ago

Just formatting so we can see what's going on..

` APP_ENV=local APP_KEY=base64:SR+Oqr9UpV6HDS6MtiRVq5aYVpq6pIZnKATd92MTM0A= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://homestead.dev

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=blog DB_USERNAME=homestead DB_PASSWORD=secret

BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379

MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null

PUSHER_APP_ID= PUSHER_APP_KEY= PUSHER_APP_SECRET= `

SaeedPrez left a reply on SQLSTATE[HY000] [2002] Connection Refused • 4 days ago

setting the host to localhost (and back)

What is back ?

Can you show your .env file (at least the DB_ part)

SaeedPrez left a reply on SQLSTATE[HY000] [2002] Connection Refused • 4 days ago

@hansje are you showing the whole error message?

SaeedPrez left a reply on Find Out All Logged In Users • 4 days ago

You could just cache the id of all authenticated active users, every time they perform an action or load a page, you update the cache... and the cache expires after X minutes.

SaeedPrez left a reply on There Is A New Spammer • 4 days ago

@jlrdw hehe ☺ it's really amazing that after all these years, spammers still make a profit, why else would they do it right?

Seems he's been taken care of now.

16th February, 2017

SaeedPrez left a reply on [Tip] How To Create A Custom Error Messages (ErrorViewBag) • 5 days ago

@jlrdw you're welcome buddy, hope you find it useful.

SaeedPrez started a new conversation [Tip] How To Create A Custom Error Messages (ErrorViewBag) • 5 days ago

Hey guys,

I just created this helper function for myself and thought I'd share it..

Basically, it allows you to easily create a custom ErrorViewBag with custom messages.

SaeedPrez left a reply on TokenMismatchException Error On Webserver - Locally On Xampp Works Fine • 5 days ago

@Anonymous194

It could be because of permissions, perhaps the server can't create the session files..

Check the permissions of

  • /storage
  • /storage/framework
  • /storage/framework/sessions

SaeedPrez left a reply on Database Queries Are Slow After Upgrade To L5.4 • 5 days ago

Hi @Kenneth_H

I suggest you install Clockwork and find out what exactly is going on.

Side note: this package should really come with Laravel out of the box.

SaeedPrez left a reply on Opposite Of AssertDatabaseHas • 5 days ago

It seems to be missing from the API documentation, even if you look at the specific file..

SaeedPrez left a reply on Opposite Of AssertDatabaseHas • 5 days ago

@kyobul Glad I could help ☺ I have no idea if it is documented, I usually look things up in the source code..

SaeedPrez left a reply on Opposite Of AssertDatabaseHas • 5 days ago

->assertDatabaseMissing()

SaeedPrez left a reply on Moving Auth Folder • 5 days ago

@Ifrit

You can move it, but you have to change the namespace and manually create the routes..

Visit the link below to see the routes Laravel generates for authentication..

15th February, 2017

SaeedPrez left a reply on Times Stamp • 6 days ago

@jahid Glad to help ☺

SaeedPrez left a reply on Times Stamp • 6 days ago

@jahid I meant change it from UTC to your timezone,... UTC is the default timezone that comes with a fresh Laravel install.

Edit Your Profile
Update

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