Nash

Experience

72,030

80 Best Reply Awards

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

9th October, 2018

Nash left a reply on How To Create Md5 Password In Php And Save To Database? • 2 weeks ago

You need to check that the (hashed) password in your db equals the hashed value of the input. However, you should not store passwords as md5, it's not secure. Also, you should use prepared statements (and preferably PDO) to protect against SQL injections.

27th September, 2018

Nash left a reply on Sitemap • 3 weeks ago

Try this Laravel sitemap package by Spatie: https://github.com/spatie/laravel-sitemap

Nash left a reply on Object Parsing Is Faster Or Array Parsing? • 3 weeks ago

Request already is an object, so unless you specifically wish to retrieve the input as an array, you could just do request('something'), $request->input('something') or $request->something.

See the docs: https://laravel.com/docs/5.7/requests#retrieving-input

26th September, 2018

Nash left a reply on Why To Use Envoyer For 0% Downtime? • 3 weeks ago

As far as I know, Envoyer creates a new installation in a separate directory when you deploy and only starts pointing there once everything is up and running. You can also easily roll back your deployments to the previous install.

Forge uses the same installation and only pulls in the changes (+ runs migrations and installs new packages), so everything is still happening to your live site in real time. This can potentially result in more downtime and trouble if something goes wrong and you have to fix it or if the update is very big, needs configuration etc.

24th September, 2018

Nash left a reply on Data Retrieving Problem • 4 weeks ago

Input::all() used to be for getting request input. Try naming your model something else and set the table explicitly in your model using protected $table = 'inputs';.

Nash left a reply on Bugs On Has() • 4 weeks ago

@pramanadiputra $course->lectures gives you a collection of items. $course->lectures->has(1) will check for index 1, not if the lecture has ID 1. If you have 6 items, the largest index will be 5, because array index start at 0. Check the output of dd($course->lectures);

Nash left a reply on Bugs On Has() • 4 weeks ago

has() is supposed to determine whether a key exists in a collection or a relationship exists in Eloquent. It is not meant to check if a certain ID exists.

See the docs:

Nash left a reply on Htmlspecialchars() Expects Parameter 1 To Be String, Array Given • 4 weeks ago

Based on your error message, it would seem that you are trying to echo out an array (instead of a string). Try dd($k->value('labelper')) and see what it gives you;

Nash left a reply on Data Retrieving Problem • 4 weeks ago

Please show your code. Your error message indicates that you are not passing the variable to your view properly in your controller, e.g. return view('greeting')->with('name', 'Victoria');

14th September, 2018

Nash left a reply on Unsubscribed Two Months Ago. Still Have Access. Is Something Broken? • 1 month ago

Those are mostly free videos. Try the Build a Forum series, they should require a subscription:

https://laracasts.com/series/lets-build-a-forum-with-laravel/episodes/1

Nash left a reply on PHP Sessions • 1 month ago

You could probably make a custom auth driver / user provider: https://laravel.com/docs/5.6/authentication#adding-custom-user-providers

11th September, 2018

Nash left a reply on Unsubscribed Two Months Ago. Still Have Access. Is Something Broken? • 1 month ago

@pcgben It's in the footer at the bottom of the site. There is a Support link under Discuss.

Nash left a reply on Unsubscribed Two Months Ago. Still Have Access. Is Something Broken? • 1 month ago

You may want to contact support about this: https://laracasts.com/contact

10th September, 2018

Nash left a reply on Requests Not Validating Contact Form • 1 month ago

What does your controller look like? Are you type-hinting the ContactFormRequest class properly in the controller method? Are the form inputs named correctly in your view?

Also, these are redundant in your form request file:

use App\Http\Controllers\ContactFormRequest;
use App\Mail\ContactEmail;
use Flash;

4th September, 2018

Nash left a reply on Updating Answer - Mention User • 1 month ago

Probably so that someone you've already mentioned doesn't receive a bunch of notifications if you decide to correct a few typos in your post?

3rd September, 2018

Nash left a reply on Call To A Member Function RelStudies() On Boolean • 1 month ago

Like the error message says, you are trying to call a relStudies() on a boolean. Your update method is assigning the return value from update() to $friend instead of the model.

Try changing this...

$friend = Friend::find($id)->update([
            'name' => $request->name,
            'gender' => $request->gender,
            'age' => $request->age,
            'state' => $request->state,
            'house_number' => $request->house_number,
            'occupation' => $request->occupation,
            'bio' => $request->bio,
            'users_id' => auth()->user()->id
        ]);

        $friend->relStudies()->sync($request->educations);

...into something like this:

$friend = Friend::find($id)

$friend->update([
        'name' => $request->name,
        'gender' => $request->gender,
        'age' => $request->age,
        'state' => $request->state,
        'house_number' => $request->house_number,
        'occupation' => $request->occupation,
        'bio' => $request->bio,
        'users_id' => auth()->user()->id
    ]);

$friend->relStudies()->sync($request->educations);

2nd September, 2018

Nash left a reply on Save Html Code Inside Database • 1 month ago

You need to escape the single quotes with a backslash \' but you should be really careful about letting your HTML contain JS like that. It may be vulnerable to XSS attacks if there's any user input involved.

1st September, 2018

Nash left a reply on CREATE A PDF • 1 month ago

Maybe create a separate view/template that is a bit lighter in terms of HTML and CSS specifically for your pdf?

Nash left a reply on How To Properly Use Laravel API Documentation??? Where Can I Read Documentation For Things Like Request()->getPathInfo() And Request()->getQueryString()??? • 1 month ago

You are on the right track. As you can see from the API docs for Illuminate\Http\Request, it extends Symfony\Component\HttpFoundation\Request, which is where those particular two methods are located.

Tip: you can also open and study those files directly in your editor. Many editors and IDE's have some sort of "go to definition" functionality that will take you to the class.

Nash left a reply on App.layout Crashing The Ajax Function Used In View • 1 month ago

Laravel gives you a starting point with Vue.js, Bootstrap and jQuery. You don't have to use these presets if you don't want to. Look at resources/assets/js/app.js and resources/assets/js/bootstrap.js and read the docs for more information: https://laravel.com/docs/5.6/frontend

In any case, jQuery needs to be loaded before your click handler.

Nash left a reply on App.layout Crashing The Ajax Function Used In View • 1 month ago

I think you are already loading Bootstrap and jQuery in your app.js file. If so, you don't need to do load them in <head>, just put your own code after app.js.

Nash left a reply on App.layout Crashing The Ajax Function Used In View • 1 month ago

Are you loading jQuery as part of your compiled app.js file (check if your bootstrap.js file contains any references to jQuery)? Either load it there or use a CDN like you are doing now but don't do both at the same time. Also remember to put your own click handler code after jQuery has been loaded.

30th August, 2018

Nash left a reply on Framework Or A CMS? • 1 month ago

In terms of ease of use, ready-made themes and plugins, WP is probably unmatched. However, if you are going to need lots of custom functionality or intend to build something more reminiscent of a web application rather than a website, then I'd probably go straight for a framework or a CMS built on a well-known framework (e.g. Laravel). But like I said, it depends very much on the requirements of your project and what role you have in it (developer, designer, user).

Relevant comic: http://www.commitstrip.com/en/2015/04/03/cms-or-custom/

29th August, 2018

Nash left a reply on Framework Or A CMS? • 1 month ago

"Better" is highly subjective. Why not try a few and see which one fits your project's requirements best?

Nash left a reply on Framework Or A CMS? • 1 month ago

@antolepore Think of it like this: Laravel is what you would use to build the CMS (or some other custom application). For example: PyroCMS is built with Laravel.

24th August, 2018

Nash left a reply on Call A Mounted Function From A Methods Function • 1 month ago

What does your mounted function look like? Can't you add the cytoscape instance to data, e.g. this.cy = cytoscape({...}) (or make it global, e.g. window.cy)?

23rd August, 2018

Nash left a reply on How To Check If I Found A Result Or Not? • 2 months ago

Use first() instead of firstOrFail(). The latter will throw an exception.

Nash left a reply on Generate PDF Using Backbone View? • 2 months ago

As far as I know, JS support is somewhat limited in dompdf. You might want to look into the Google Maps Static API and embed your map as an image instead: https://developers.google.com/maps/documentation/maps-static/intro

22nd August, 2018

Nash left a reply on Bet Way To Retrieve Count Of Total Rows With And Without Limit • 2 months ago

You could do something like

$query = DB::('table_name')
    ->where('...')
    ->where('...');

$count = $query->count();

$data = $query->offset(0)->limit(50)->get();

21st August, 2018

Nash left a reply on Not Same Content On My Server And My Local Site • 2 months ago

Have you compiled your stylesheets with npm run production and are you using versioning/cache busting? If not, you may need to clear your browser cache.

Nash left a reply on How To Access The Multi-dimensional Object Using Variable? • 2 months ago

For objects and arrays, try Laravel's data_get() helper: https://laravel.com/docs/5.6/helpers#method-data-get

data_get($object, 'personalDetails.name');

If you are working with JSON like @tykus said, then you need to convert it into an array first using json_decode().

$array = json_decode($json, true);

Nash left a reply on The Correct Way To Implement An Additional Functionality? • 2 months ago

A SearchController is fine. Not every controller needs to be a resource controller with a corresponding model.

20th August, 2018

Nash left a reply on No Debug Page ( Debug Is True ) • 2 months ago

Can you show us how you set debug to true?

Nash left a reply on How To Validate Count Of Array Objects In Request Class? • 2 months ago

'categories' => 'required|array|max:3',

17th August, 2018

Nash left a reply on How To Catch Braintree Cashier Exceptions? • 2 months ago

Try with catch (\Exception $e)

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

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

15th August, 2018

Nash left a reply on Do We Must Use A Paid Mailing Service ? • 2 months 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 • 2 months 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? • 2 months 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 months 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 months 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 months ago

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

Nash left a reply on Resize Image • 2 months 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 months 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 months 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 months 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 months 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 months 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 months 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.

Edit Your Profile
Update

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