256 Kilobytes

Frameworks Comments

Type CommentsResponses to top-level threads. Category FrameworksLaravel, Ruby on Rails, etc.

Profile Photo - Scuffed Dog

Reply to Laravel - How can I check if a collection is empty?

Comments in Frameworks | By Scuffed Dog

Published

Profile Photo - Scuffed Dog

Thank you Univa, you're a very smart gen...

MoreThank you Univa, you're a very smart gentleman and also a nice companion in life.
🗨 2
🐏 0
👁 488
Profile Photo - Univa

Reply to Laravel - How can I check if a collection is empty?

Comments in Frameworks | By Univa

Published | Last Update

Profile Photo - Univa

To determine if the collection is empty...

MoreTo determine if the collection is empty you can do any of the following: @if(!$result->isEmpty())          // $result...
🗨 2
🐏 0
👁 488
Profile Photo - Univa
Profile Photo - Univa

Eager loading is achieved using the&nbsp...

MoreEager loading is achieved using the Include() method. for example: LINQ Query Syntax: using (var context = new SchoolDBEntities())...
🗨 1
🐏 0
👁 426
Profile Photo - August R. Garcia

Reply to What does "PHP Artisan dump-autoload" actually do?

Comments in Frameworks | By August R. Garcia

Published | Last Update

Profile Photo - August R. Garcia

Also, if you're having a caching issue w...

MoreAlso, if you're having a caching issue with Laravel and php artisan dump-autoload didn't fix your problem, you can also try this: php compos...
🗨 2
🐏 0
👁 486
Profile Photo - Univa
Profile Photo - Univa

To use subqueries with Laravel's query b...

MoreTo use subqueries with Laravel's query builder, you should add it to the join as follows: ->leftJoin(DB::raw("(SELECT [...]) AS p"), 'p.post_i...
🗨 1
🐏 0
👁 434
Profile Photo - Univa
Profile Photo - Univa

php artisan dump-autoload

Morephp artisan dump-autoload It will call the Composer with the optimize flag It will 'recompile' loads of files creating the huge bootstrap/comp...
🗨 2
🐏 0
👁 485
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Update. Don't fucking use the code in th...

MoreUpdate. Don't fucking use the code in the previous post I made. Use this code: <IfModule mod_rewrite.c> <IfModule mod_negotiation.c...
🗨 3
🐏 0
👁 386
Profile Photo - Univa
Profile Photo - Univa

Step 1: Make sure you have .env file in...

MoreStep 1: Make sure you have .env file in your application.If not run this command cp .env.example .env Step 2: Now run following command ( php artisan...
🗨 1
🐏 0
👁 534
Profile Photo - roxblade

Reply to How to reinstall .NET framework for Windows 10?

Comments in Frameworks | By roxblade

Published

Profile Photo - roxblade

Reinstallation can be done through Windo...

MoreReinstallation can be done through Windows itself but seeing your situation, you don't need anything more than a clean install as you've uninstalled t...
🗨 1
🐏 0
👁 385
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

INSERT INTO some_table (created_at,...

MoreINSERT INTO some_table (created_at, updated_at, some_data) VALUES (NOW(), NOW(), "Here is some other data."); About the NOW() functi...
🗨 1
🐏 0
👁 361
Profile Photo - August R. Garcia

Reply to [Laravel/Eloquent] orderBy id DESC?

Comments in Frameworks | By August R. Garcia

Published

Profile Photo - August R. Garcia

More// The query in Eloquent $posts = Post::orderBy('id', 'DESC'); // Run the query and get the results $posts = $posts->get(); Laravel Doc...
🗨 1
🐏 0
👁 457
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Go to /public/.htaccess and set up a 301...

MoreGo to /public/.htaccess and set up a 301 the same as you would for a non--Laravel website.
🗨 1
🐏 0
👁 394
Profile Photo - August R. Garcia

Reply to How do .htaccess files work with Laravel?

Comments in Frameworks | By August R. Garcia

Published

Profile Photo - August R. Garcia

Go to /public/.htaccess and you will fin...

MoreGo to /public/.htaccess and you will find a default .htaccess to work off of.
🗨 1
🐏 0
👁 423
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

This error means that you are trying to...

MoreThis error means that you are trying to call a method of your Content controller called index(), but that the method in question is not defined/does n...
🗨 1
🐏 0
👁 436
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

The documentation for the log levels in...

MoreThe documentation for the log levels in Laravel is here: https://laravel.com/docs/5.7/logging#writing-log-messages These log levels are th...
🗨 1
🐏 0
👁 336
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Check this thread:

MoreCheck this thread: https://laracasts.com/discuss/channels/laravel/undefined-variable-env-view-path-to-my-view?page=1 The error might be re...
🗨 1
🐏 0
👁 590
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

It looks like there is a typo. Specifica...

MoreIt looks like there is a typo. Specifically, a dollar sign before "caption." // Remove the $ before 'caption' @if ( isset($chart...
🗨 1
🐏 0
👁 266
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Look into local scopes:

MoreLook into local scopes: https://laravel.com/docs/5.7/eloquent#local-scopes Note that these methods must start with 'scope' in the...
🗨 1
🐏 0
👁 280
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Make sure you navigate to the home direc...

MoreMake sure you navigate to the home directory of your project before running php artisan serve. If you run the command from the wrong directory, it may...
🗨 1
🐏 0
👁 1,488
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Use the appends() method:

MoreUse the appends() method: $posts = Post::where('title', '=', $request->q); $posts = $posts->paginate(30)->appends( "q", $request->q...
🗨 1
🐏 0
👁 245
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Looks like a $ is missing from the &quot...

MoreLooks like a $ is missing from the "show_sidebar" passed to the isset() function. See: <?php if ( isset($show_sidebar) &&am...
🗨 1
🐏 0
👁 3,437
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

The file was changed from "SoftDele...

MoreThe file was changed from "SoftDeletingTrait" to "SoftDeletes" at some point. If you are using a newer version of Laravel, use thi...
🗨 1
🐏 0
👁 696
Profile Photo - August R. Garcia

Reply to How to set a timezone in Laravel?

Comments in Frameworks | By August R. Garcia

Published

Profile Photo - August R. Garcia

From the command line (or whatever), run...

MoreFrom the command line (or whatever), run this to open the file (or use some arbitrary text editor or something that isn't Vim): vim config/a...
🗨 1
🐏 0
👁 243
Profile Photo - August R. Garcia

Reply to [Laravel] Make link to register page?

Comments in Frameworks | By August R. Garcia

Published

Profile Photo - August R. Garcia

The name of the route is, by default, &q...

MoreThe name of the route is, by default, "register." Basic navigation for register/login/logout/other routes would generally look something lik...
🗨 1
🐏 0
👁 205
Profile Photo - August R. Garcia

Reply to [Laravel] How to count results where a condition is true?

Comments in Frameworks | By August R. Garcia

Published | Last Update

Profile Photo - August R. Garcia

Eloquent:

MoreEloquent: $num_results = Post::where("is_a_good_post", TRUE)->count();
🗨 1
🐏 0
👁 8
Profile Photo - August R. Garcia

Reply to Method to rewrite a URL in a Laravel project?

Comments in Frameworks | By August R. Garcia

Published

Profile Photo - August R. Garcia

Often, the easiest solution is to do thi...

MoreOften, the easiest solution is to do this in the .htaccess file (the same as rewriting a URL in the general/not specific to Laravel case), which is lo...
🗨 1
🐏 0
👁 261
Profile Photo - August R. Garcia

Reply to [Laravel] Count post views?

Comments in Frameworks | By August R. Garcia

Published

Profile Photo - August R. Garcia

There are two basic ways to do this:<br...

MoreThere are two basic ways to do this: Easiest: Increment a FIeld in the Posts Table Easiest: Add a field to your posts table and increment it eac...
🗨 1
🐏 0
👁 2
Profile Photo - August R. Garcia

Reply to [Laravel] What is the difference between sortBy and orderBy?

Comments in Frameworks | By August R. Garcia

Published | Last Update

Profile Photo - August R. Garcia

The short version is that the orderBy()...

MoreThe short version is that the orderBy() method is much more efficient than the sortBy() method (particularly when querying databases of a non-trivial...
🗨 1
🐏 0
👁 934
Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Try running:

MoreTry running: php-7.1 artisan config:cache Instead of: php artisan config:cache Replace "7.1" with whatever version of...
🗨 1
🐏 0
👁 606
Profile Photo - August R. Garcia

Reply to [Laravel] Bug while attempting to link storage?

Comments in Frameworks | By August R. Garcia

Published

Profile Photo - August R. Garcia

If the Artisan CLI is having a stroke, y...

MoreIf the Artisan CLI is having a stroke, you can also do this manually from the Linux terminal. Navigate to the root directory for your Laravel project...
🗨 1
🐏 0
👁 243