Nash

Experience

67,960

74 Best Reply Awards

  • Member Since 2 Years Ago
  • 193 Lessons Completed
  • 25 Favorites

17th August, 2018

Nash left a reply on How To Catch Braintree Cashier Exceptions? • 1 day ago

Try with catch (\Exception $e)

Nash left a reply on Uncaught TypeError: Cannot Set Property '$' Of Undefined • 2 days ago

Try window.$ = require( 'jquery' );

15th August, 2018

Nash left a reply on Do We Must Use A Paid Mailing Service ? • 4 days ago

Sure you can use your own server. Just set the mail driver to mail or sendmail. It's just really simple and fast to use something like Mailgun and you get analytics etc., like you just said.

Mailgun lets you send 10k emails/month for free. If you intend to send more than that, remember that such amounts can be quite heavy for your server (in which case a dedicated service like Mailgun could probably handle the load more efficiently). You'll also need to set up the SPF DNS record and DKIM manually if you use your own server: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-dkim-with-postfix-on-debian-wheezy

9th August, 2018

Nash left a reply on Using Dynamic Field Names In A Request • 1 week ago

You could use variable variables:

$field = request('db_fld');
$doc->$field = request('val');

Nash left a reply on Is My Mailgun ENV. Setup Correctly? • 1 week ago

You'll want to set MAIL_DRIVER=mailgun if you intend to use the MAILGUN_DOMAIN and MAILGUN_SECRET variables. You can also use SMTP with Mailgun instead of the API credentials, but you currently have it set to use Mailtrap instead of Mailgun (Mailtrap is not the same as Mailgun).

Mailgun API and SMTP credentials: https://help.mailgun.com/hc/en-us/articles/203380100-Where-can-I-find-my-API-key-and-SMTP-credentials

4th August, 2018

Nash left a reply on Resize Image • 2 weeks ago

You're welcome. Please mark your thread as solved. I updated my initial answer to include the cast to string.

Nash left a reply on Resize Image • 2 weeks ago

Try casting the data to string when uploading. Like this:

Storage::disk('s3')->put("test",  (string) $img->stream(), 'public');

Nash left a reply on Resize Image • 2 weeks ago

Try to upload the return value of $img->stream() instead of the $img object.

Nash left a reply on Resize Image • 2 weeks ago

Try Storage::disk('s3')->put("test", $img->stream(), 'public');. You want the return value of the stream method, not the intervention image object itself. Also make sure that $request->content_list[0] is a valid source (see the docs for make http://image.intervention.io/api/make).

Nash left a reply on Resize Image • 2 weeks ago

Not really a Laravel specific thing, but you could use an image manipulation library like Intervention Image to help you with that.

Something like this should work:

// Create a new image resource
$img = Image::make($your_base64_image);

// Resize
$img->resize(320, 240);

// Base64 encoded stream. Also supports 'jpg', 'png' and more...
$dataUrl = $img->stream('data-uri'); 

3rd August, 2018

Nash left a reply on Laravel Code Standard Checker • 2 weeks ago

It seems a little outdated (links to Laravel 4.2 and open issues about compatibility problems with PHP 7).

Laravel 5 follows PSR-2. You could just install formatting plugin in your editor of choice or use a service like StyleCI.

2nd August, 2018

Nash left a reply on How Can I User Mustache (or Another Option) With Blade Templates? • 2 weeks ago

I user blade for my views, but I want to use mustache generage views, so I can change page name, routes, but mantain the blade variables

@spacedog4 What is it that you're trying to achieve with Mustache that can't be done with Blade?

Nash left a reply on How Can I User Mustache (or Another Option) With Blade Templates? • 2 weeks ago

Ah, mustache is a JS engine. I thought it was php

It supports PHP, JS and many other languages: https://mustache.github.io

Nash left a reply on How Can I User Mustache (or Another Option) With Blade Templates? • 2 weeks ago

Use a regular PHP (.php) file for your view instead of a Blade (.blade.php) file. Why would you use another PHP template engine inside Blade?

If you are talking about JS templates, then @{{ name }} should do the trick. https://laravel.com/docs/5.6/blade#blade-and-javascript-frameworks

Nash left a reply on Npm Install And Npm Run Prod In Deployment Script Failing. • 2 weeks ago

Just SSH into your server and install the package like you normally would.

You could also try with sudo -S or echo "" | sudo -S like in default script above, but I don't see why you would need to do it in your deploy script...it's not like you're going to install it every time you deploy.

1st August, 2018

Nash left a reply on Laravel .env Variable In Controller • 2 weeks ago

Are you caching the configuration? If so, you can only use env() within your config files as the .env file will not be loaded.

https://laravel.com/docs/5.6/configuration#configuration-caching

Nash left a reply on Free Domain Name That Let You Change DNS Records? • 2 weeks ago

You can get a domain name for as little as $5/year at Hover.com (and yes, you can change the DNS records).

Nash left a reply on Mailtrap Not Working • 2 weeks ago

Try another port, like 25 or 2525.

See the Mailtrap FAQ: https://mailtrap.io/faq#faq14

12th July, 2018

Nash started a new conversation Warning! NPM Package Eslint-scope 3.7.2 Has Been Compromised • 1 month ago

From the incident report:

Version 3.7.2 of the popular package eslint-scope was published without authorization ( see https://github.com/eslint/eslint-scope/issues/39 ). This version contained apparently malicious code that attempted to steal npm login tokens. It has been unpublished and is no longer available.

11th July, 2018

Nash left a reply on This Site Can’t Be Reached On Production Server After Client Made Changes Via SSH • 1 month ago

There should be no need to use the root account, sudo will do just fine in most cases. Also, the Digital Ocean monitoring tools should cause no trouble. As for the RunCloud.io script, that's a complete server management control panel (like Forge), who knows what configurations it might have changed. If you are already using Forge then you probably shouldn't mix and match like that.

Might be easier to just backup the database and set up a new installation via Forge.

10th July, 2018

Nash left a reply on How To Pass Multiple Variables As Eager Load • 1 month ago

You need to inherit the variable from the parent scope:

function ($query) use ($user_id)

http://php.net/manual/en/functions.anonymous.php

8th July, 2018

Nash left a reply on Npm Production Failing • 1 month ago

You might be running out of memory. Try to increase your RAM or add a swapfile.

https://github.com/JeffreyWay/laravel-mix/issues/926

Nash left a reply on OctoberCMS Or AsgardCMS • 1 month ago

7th July, 2018

Nash left a reply on Why Is Session::... Not Documented? • 1 month ago

It's actually listed under Facades -> Facade Class Reference:

https://laravel.com/docs/5.6/facades

https://laravel.com/docs/5.6/facades#facade-class-reference

Nash left a reply on Vue 2: Can't Assign Prop • 1 month ago

Try

props: ['modelId']

and

<model-view
    :model-id="{{ $model->id }}">
</model-view>

From the docs:

HTML attribute names are case-insensitive, so browsers will interpret any uppercase characters as lowercase. That means when you’re using in-DOM templates, camelCased prop names need to use their kebab-cased (hyphen-delimited) equivalents

https://vuejs.org/v2/guide/components-props.html

Nash left a reply on How Do You Test Database Notifications? • 1 month ago

I haven't tried it your way so I can't really say. Maybe the notifications are going to your real db instead of your testing db?

Remember that notifications can also be sent by email, in which case you probably don't want them to be sent for real. Using Notification::fake() makes sure that doesn't happen in case you or someone else changes the delivery method later on.

Nash left a reply on Queued Tasks Are Executing As Part Of The Controller, Causing App To Freeze • 1 month ago

Try php artisan queue:restart and then try to run the queue worker again (queue:work, listen etc.).

Are you sure that the code in your jobs is actually working or could the jobs be failing? Also, do you have a table for failed jobs?

php artisan queue:failed-table
php artisan migrate

https://laravel.com/docs/5.6/queues#dealing-with-failed-jobs

6th July, 2018

Nash left a reply on Queued Tasks Are Executing As Part Of The Controller, Causing App To Freeze • 1 month ago

What queue driver are you using in config/queue.php? Make sure it's not set to sync, because that is intended for local use and will execute the jobs immediately.

Nash left a reply on What Is The Best Way To Send Transaction Details To 3rd Party Payment Gateway • 1 month ago

There's usually some sort of hash (e.g. a hash with some secret key + your form fields) that you can calculate and send along with the request to verify that the fields have not been tampered with. Consult the documentation for your payment gateway.

You can use an HTTP client like Guzzle to send the requests directly from your back end if you don't want to use a form.

Nash left a reply on How Do You Test Database Notifications? • 1 month ago

Aha. So the way to check a notification is by using the Notification facade? And not by checking the notifications relationship on the user? Even if you don't use Notification::fake() in your test...

@pimski No, this is related to my previous example using Notification::fake(). I just pointed out that you can access the notification and check the contents just fine. You don't need to manually query the DB for that.

Nash left a reply on How Do You Test Database Notifications? • 1 month ago

You can access the notification and check the contents:

Notification::assertSentTo(
    $user, 
    ExportFinished::class, 
    function ($notification, $channels) {
        dd($notification);
    }
);

Nash left a reply on How Do You Test Database Notifications? • 1 month ago

You can mock the notification being sent:

use App\Notifications\ExportFinished;
use Illuminate\Support\Facades\Notification;

...

Notification::fake();

$user->notify(new ExportFinished);

Notification::assertSentTo($user, ExportFinished::class);

Should work just the same regardless of delivery method (email, database).

https://laravel.com/docs/5.6/mocking#notification-fake

28th June, 2018

Nash left a reply on Mailgun Error While Sending Email • 1 month ago

You are in sandbox (test) mode. You can only send messages to predefined addresses. You need to add and verify a real domain to send messages freely.

https://documentation.mailgun.com/en/latest/user_manual.html#verifying-your-domain

26th June, 2018

Nash left a reply on Problem With Sending Mail After Changing To Markdown • 1 month ago

Add this to the top of your controller:

use App\Mail\SimpleContactMail;

Nash left a reply on Problem With FormRequest Class? • 1 month ago

@Gabotronix Tip: install a linter plugin for your editor or use an editor/IDE with error detection built in. It will point out simple syntax errors like missing commas, semicolons, etc.

Nash left a reply on Undefined Variable But Dd($myvariable) Works? • 1 month ago

@TuffRivers You're welcome. Please mark the question as solved.

25th June, 2018

Nash left a reply on Charges • 1 month ago

Contact support here: https://laracasts.com/contact

Nash left a reply on Undefined Variable But Dd($myvariable) Works? • 1 month ago

It should be compact('json'), not compact($json)

return view('transactions.index', compact('json'));

22nd June, 2018

Nash left a reply on Markdown VS HTML + Purifier? Please Help Me Decide! • 1 month ago

Yes, that seems to be the case...as long as whatever package you use can remove unwanted HTML and scripts.

Nash left a reply on On Local Environment I Would Run Php Artisan Storage:link To Create A Symlink, But I Cannot Run It On Server Due To The Hosting Plan Limitation. Any Other Way To Create The Symlink? I Have No Shell Access :( • 1 month ago

You could try to execute the Artisan command from a route or controller, e.g. something like:

Route::get('/storage-link', function () {
    $exitCode = \Artisan::call('storage:link');
});

https://laravel.com/docs/5.6/artisan#programmatically-executing-commands

Nash left a reply on Markdown VS HTML + Purifier? Please Help Me Decide! • 1 month ago

HTML:

  1. Purifier will remove scripts and unwanted attributes (e.g. onhover) if configured to do so.

  2. You can embed YouTube videos, you just need to configure the white list to allow iframes. You can even specify the allowed URL's (e.g. allow embeds from YouTube and Vimeo but nothing else).

Markdown is just plain text so it doesn't really need an actual "editor" (front end plugin)? You should use Purifier in any case, since your Markdown will be converted into HTML when displayed on your site.

21st June, 2018

Nash left a reply on Routing • 1 month ago

What does your routes file and views look like so far?

20th June, 2018

Nash left a reply on How To Determine A Framework? • 1 month ago

Well a framework is more like a skeleton or something that provides a control flow for your entire application, whereas a library is just a collection of specific functionality to use within your application.

The key difference between a library and a framework is "Inversion of Control". When you call a method from a library, you are in control. But with a framework, the control is inverted: the framework calls you.

https://www.programcreek.com/2011/09/what-is-the-difference-between-a-java-library-and-a-framework

19th June, 2018

Nash left a reply on Search Parts In The Database Instead Of The Whole Value. • 2 months ago

In its simplest form, this can be achieved using the SQL LIKE operator, e.g.

$search = request('search');
$results = Post::where('title' , 'LIKE', "%$search%")->get();

For more advanced searches, you may want to consider something like Laravel Scout and Algolia.

14th June, 2018

Nash left a reply on Str_slug Strips Everything After Ampersand & Hash Tag • 2 months ago

@Cronix Not necessarily run a query string through the function, but rather avoid that it happens by mistake...and to make sure that it simply isn't possible, (in case someone actually does have a link or something in the string).

Something like "Haha, I love hashtags #smile" could make the page jump to an anchor with same ID (id="smile").

Nash left a reply on Str_slug Strips Everything After Ampersand & Hash Tag • 2 months ago

It's probably meant to remove/avoid query strings and anchors in the URL, e.g.

  • example.com?order=name&sort=asc
  • example.com#tab2
Edit Your Profile
Update

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