36864

Experience

45,660

64 Best Reply Awards

  • Member Since 10 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

22nd June, 2018

36864 left a reply on Security Issue No1 Suggestion: Masking By Default The Information That Resides In .env File! • 13 hours ago

Pros:

  • Neglectful devs won't leak their passwords online

Cons:

  • Additional steps to get full debug information during development
  • Neglectful devs will continue to be sloppy and fail to properly set up their environments, possibly leading to severe problems down the road.

Feel free to complete the list.

36864 left a reply on Security Issue No1 Suggestion: Masking By Default The Information That Resides In .env File! • 14 hours ago

Why must we appeal to the lowest common denominator? Do you also insist that lego bricks be made soft so people don't hurt themselves when they step on them? Do you blame the nails when someone does a poor job of building a shed and someone pricks their finger on an exposed nail? Maybe hammers should come with built-in thumb detectors and airbags to prevent people from hitting their own fingers.

Laravel is as secure as you want it to be. If you're deploying an app to a production environment, you need to know how to set up your environment and protect your data. This is not optional.

The dotenv library isn't even meant for production environments, it's a development tool. If you rely on development tools to configure your production environment, you need to make yourself aware of what the associated risks are.

If you look at a variable named APP_DEBUG and set it to true when deploying to production, you should really consider a career change.

36864 left a reply on Slash - Back Slash • 17 hours ago

This looks more like a problem with case sensitivity than slashes.

Your first path is from_attach/S/6 while the second one is from_attach/s/6. Windows is case-insensitive, but linux is not.

36864 left a reply on Security Issue No1 Suggestion: Masking By Default The Information That Resides In .env File! • 17 hours ago

this is a free framework and maybe you have to pay for having all the wholes closed.

Yes, you, the developer, are being paid to make sure there are no proverbial holes in your app. In this case, all you have to do is not put them there in the first place.

36864 left a reply on Quick Question: About Relationship • 21 hours ago

@Snapey I think you normally do a really good job at explaining how to fix things, but sometimes forget to explain why things need to be fixed that way.

36864 left a reply on Security Issue No1 Suggestion: Masking By Default The Information That Resides In .env File! • 21 hours ago

Every time I see this issue being brought up I remember when I was just starting out with laravel and spent about an hour trying to figure out why my new site wasn't working, until I actually looked at the error page and saw that I had a typo in my database password.

If environment variables were hidden by default, I don't know how long it would have took me to find that typo.

36864 left a reply on Quick Question: About Relationship • 21 hours ago

@pickab00 I edited my post to remove that part, I was mistaken. Got my wires a little crossed.

36864 left a reply on Laravel • 22 hours ago

My theory is that a university or high school somewhere started including laravel in the curriculum. A lot of the questions I've seen lately look like "do my homework for me".

36864 left a reply on Quick Question: About Relationship • 22 hours ago

If you don't set a foreign key name, the name of the relationship method will be used. If the relationship is meant to fetch a collection of models, it will try to singularize the method name. If it's meant to fetch a single model, it will not.

In your case, you're calling it admins, so eloquent will try to fetch admins_id. If you change the method name to admin, it will try to fetch admin_id, and if you set it to foo it will try to fetch foo_id.

Your error here was defining a plural relationship name when you want a singular model.

15th June, 2018

36864 left a reply on How To Improve Large Txt File Parse Process? • 1 week ago

You should reset the $count variable instead of incrementing it when you execute an insert.

36864 left a reply on @foreach Loops More Times Than The Query Answers • 1 week ago

You'll have to post your code so we can see what's going on.

Specifically, your view and controller.

36864 left a reply on Data Is Duplicated In The View ... • 1 week ago

Quick and dirty fix:

@for ($i=0; $i<$valuechainsCount; $i++)
    {{  $vcskn[$i]->first()->vcname ?? "Empty Set"}}<br>
    @foreach($vcskns[$i] as $vcskn[$i])
        {{ $vcskn[$i]->segname }} - {{ $vcskn[$i]->keyneeds_count }}<br>
    @endforeach
@endfor

36864 left a reply on Route [inventory.orderShirt] Not Defined. • 1 week ago

I completely missed that.

You can't have two routes on the same url. How would you expect laravel to know which route to use when you hit either of those urls?

36864 left a reply on Route [inventory.orderShirt] Not Defined. • 1 week ago

Did you cache your routes at any point? Try clearing the route cache with php artisan route:clear.

36864 left a reply on 301 Redirects • 1 week ago

Sorry, I meant to ask if this still happens with that route if you remove the redirect:

 Route::get('/services/battery-recycling/', function(){ 
     return json_encode('foo'); 
 });

36864 left a reply on 301 Redirects • 1 week ago

If you remove that route, and try to visit /services/battery-recycling/ does it redirect to /services/battery-recycling?

36864 left a reply on Laravel5.6 Best Way For Variable Environment With Two Domains • 1 week ago

I forgot about the order of execution here. If you're setting the value in the middleware, yeah, you can't do what I suggested. Sorry.

I would try to set the value in the provider instead of using middleware for it, but if you have a solution that works with the middleware, there's little reason to change any of it.

36864 left a reply on Getting The Participants Of A Chat Thread • 1 week ago

Déjà vu https://laracasts.com/discuss/channels/laravel/find-conversation-thread-between-2-users-excluding-group-conversations/replies/433092

In your user model, define a belongsToMany relationship with the thread model through the thread_participants table:

public function threads() {
    return $this->belongsToMany(Thread::class, 'thread_participants');
}

Then you can get all threads a user is participating in quite simply:

$user->threads;

36864 left a reply on Storage And Retrieving Files • 1 week ago

Here, I'll condense all the relevant information into one post:

php artisan storage:linkcreates a symlink from public/storageto storage/app/public as described in the documentation: https://laravel.com/docs/5.6/filesystem#the-public-disk.

That means that, in order for you to display a file as https://example.com/storage/image.png, you need to make sure it's saved to the storage/app/public folder in your server. Likewise, if you store a file in the storage/app/public/{username}/ folder, you can link to it at https://example.com/storage/{username}/image.png.

If you want to use a different structure for your files, you'll have to manage your symlinks manually.

36864 left a reply on Array To String Conversion Error (shows Up On Production Server) • 1 week ago

Post stack trace.

36864 left a reply on Storage And Retrieving Files • 1 week ago

I just told you what your mistake is. you're trying to load storage/14264228_1080854508651067_2414239900366396390_n.png when your file is instorage/app/username/14264228_1080854508651067_2414239900366396390_n.png

36864 left a reply on Laravel5.6 Best Way For Variable Environment With Two Domains • 1 week ago

Yes, I thought it would be fairly obvious once you looked at how the routes file is being loaded. Just change 'routes/web.php' to something like $routes_file and conditionally set $routes_file depending on your subdomain. Something like this:

switch( config('delegation.delegation_id') ) {
case 1: $routes_file = 'routes/web.en.php';
        break;
case 2: $routes_file = 'routes/web.es.php';
        break;
default: $routes_file = 'routes/web.default.php';
}

36864 left a reply on Storage And Retrieving Files • 1 week ago

So, when you say yes, what you actually mean, is no.

The file is not in the path you're trying to read it from. You're looking for a file called 14264228_1080854508651067_2414239900366396390_n.png in the storage folder, but your file is in the storage/app/username folder.

Fix your path construction and it should work.

36864 left a reply on Storage And Retrieving Files • 1 week ago

And is the file you uploaded in that folder?

36864 left a reply on Storage And Retrieving Files • 1 week ago

Did you link the storage to be publicly accessible?

36864 left a reply on Storage And Retrieving Files • 1 week ago

But it doesn't work.

We're going to need a bit more information here. What is the output of the code you've shown? What is the output you were expecting?

36864 left a reply on Laravel5.6 Best Way For Variable Environment With Two Domains • 1 week ago

An alternative to handling that in your web.php file would be to handle it in your RouteServiceProvider. Have two route files, for example web.en.php and web.es.php and conditionally load the one you need instead of web.php.

36864 left a reply on Mailgun Is Not Sending Password Reset Emails Requested Via API. No Errors Thrown. Laravel V5.6 • 1 week ago

Would you mind explaining what you did to solve this for anyone who searches for this problem in the future?

P.S: Sorry I couldn't be of much help, mailgun isn't exactly my area of expertise.

36864 left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 1 week ago

If you're not using sass or less, there is no good reason for you to be compiling your css.

You can completely remove all of your .scss files and also remove any references to them in your project, and just drop your css into the public/css folder.

14th June, 2018

36864 left a reply on Blade Template Not Rendering • 1 week ago

If that still doesn't work, try returning the welcome view just to make sure you can return anything at all.

36864 left a reply on Blade Template Not Rendering • 1 week ago

To be clear, is the absolute path the view you're trying to show C:\Users\htf\Desktop\laravelProjects\blog\resources\views\facture.blade.php?

Can you confirm this by running dir C:\Users\htf\Desktop\laravelProjects\blog\resources\views and posting the resulting file list please?

36864 left a reply on Blade Template Not Rendering • 1 week ago

You forgot to run php artisan key:generate when creating your new site.

36864 left a reply on Blade Template Not Rendering • 1 week ago

Well, I don't really see a reason for your templates to not work.

Have you tried clearing your view cache?

php artisan view:clear

36864 left a reply on Find Conversation Thread Between 2 Users Excluding Group Conversations • 1 week ago

You've defined threads as a one-to-many relationship. You need to define it as a many-to-many relationship.

https://laravel.com/docs/5.6/eloquent-relationships#many-to-many

36864 left a reply on Find Conversation Thread Between 2 Users Excluding Group Conversations • 1 week ago

I assume you also have the inverse relationships set up in your thread and user models.

Assuming your data is consistent with what you've described, all you need to do is find a thread with type single having your two users as participants.

$user->threads() //user's threads
    ->where('type', 'single') // filter by single-type threads
    ->whereHas( 'participants', function($query) use $target{ 
        $query->where('user_id', $target->id); // filter by other participant
    })
    ->first();

36864 left a reply on Can't Cache Routes If I Use Grouped Ones • 1 week ago

Sounds like you forgot to remove the default example route in your api.php file.

36864 left a reply on Find Conversation Thread Between 2 Users Excluding Group Conversations • 1 week ago

How are the relationships between users and threads set up in your models?

36864 left a reply on Blade Template Not Rendering • 1 week ago

Is the page completely blank or does it contain the basic html structure (html tag, head tag, etc.)?

Also, what is your view folder structure? Are both your blade files in resources/views and not in any sub-folders?

Finally, dump the input value in your route to make sure your code is being executed:

Route::get('articles/{n}', function($n)
    {
    dump($n);
        return view('facture')->withNumero($n);
    }                                    
)->where('n', '[0-9]+');

36864 left a reply on Blade Template Not Rendering • 1 week ago

@extends('template1')

What is template1?

36864 left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 1 week ago

You didn't answer my questions.

Are you trying to use the less version of bootstrap or the sass version?

bootstrap 3 used less as default, but there's a bootstrap-sass package to offer a sass version, which is what was used by laravel before the upgrade to bootstrap 4. This is not included in the bootstrap package.

36864 left a reply on Disabling The Csrf For The Login POST Route • 1 week ago

Isn't the whole point of a CSRF attack to hit the endpoint with an existing user's session?

36864 left a reply on Mailgun Is Not Sending Password Reset Emails Requested Via API. No Errors Thrown. Laravel V5.6 • 1 week ago

I'm fairly sure those emails are queued and then handled by your queue worker. What type of queue are you using?

36864 left a reply on Showing Undefined Offset: 1 • 1 week ago

I don't use either of those so I wouldn't even know how to begin answering that question.

36864 left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 1 week ago

I wouldn't expect sass to be able to import less files, at least not directly.

At this point I'm not entirely sure what you're trying to do. Do you want to use bootstrap with less or sass? Are you even using less or sass at all?

36864 left a reply on Blade Template Not Rendering • 1 week ago

Please enclose your code in triple backticks (```) to improve visibility.

Also post your controller code where you're trying to render your page.

36864 left a reply on Showing Undefined Offset: 1 • 1 week ago

Looks like there's a space missing there between Stocks and --fields. However, if the examples in the docs don't work either, I don't know how to help.

Your namespace definition might also need to escape backslashes.

36864 left a reply on Disabling The Csrf For The Login POST Route • 1 week ago

My understanding of the dangers of CSRF is that an attacker can take actions as an authenticated user. In the case of a login form, the attacker would need to know the user's login and password already.

Assuming the login route has no effect when accessed by a logged-in user, it would seem there's no problem in exempting the route from CSRF protection.

However, it's not uncommon for the login route to simply redirect the user to their dashboard. After hitting the route as the logged-in user, the server would ultimately respond by rendering the user's dashboard. Now the attacker has access to the user's dashboard, complete with a CSRF token and full access to act as the user.

If my understanding is correct, this is simply a very bad idea. If I'm wrong about any of this, I'd very much appreciate being corrected.

36864 left a reply on How To Downgrade Bootstrap Version To 3.3.7 In Laravel 5.6? • 1 week ago

As the error clearly states, you'll also need to change your scss/app.scss files to change any reference to bootstrap to the 3.3.7 equivalent. In this case, it would be bootstrap-sass I believe.

36864 left a reply on Showing Undefined Offset: 1 • 1 week ago

Your quotes are wrong. Try this:

 php artisan crud:generate Stocks--fields='category#select#options={"1": "Men","2":"Women"}; sub_category#select#options={"technology": "Technology"}; product#string; quantity#number; rate#number; total#number' --view-path=admin/stocks --controller-namespace=App\Http\Controllers --route-group=admin --form-helper=html
Edit Your Profile
Update

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