256 Kilobytes

Frameworks Answers > PHP

Type AnswersAsk and answer questions, if that is something that you want to do. Category FrameworksLaravel, Ruby on Rails, etc. Tag PHPPHP: Hypertext Preprocessor is a scripting language used heavily in server-side development. PHP is frequently used for templating.

Profile Photo - August R. Garcia
Profile Photo - August R. Garcia

Call the currentPage and lastPage method...

MoreIncorrect: <h1>Page {{ $paginator->currentPage }} of {{ $paginator->lastPage }}</h1> Correct: <h1>Page {{ $pagina...
🗨 0
🐏 0
👁 2,220
Profile Photo - Some Guy
Profile Photo - August R. Garcia

Last ReplyAre you using the Blade templating engine? When you use the double curly brace syntax to insert content, it uses the PHP htmlspecialchars() functio... August R. Garcia,

Are you using the Blade t...

Sun, 02 Dec 2018 03:49:45 -08002 years ago1
🗨 1
🐏 0
👁 701
Profile Photo - Some Guy

[Laravel] If not on a certain page redirect to that page?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplySomething along these lines should work for your purposes:if (Request::path() != "posts/some-post") return redirect('/posts/some-post&... August R. Garcia,

Something along these lin...

Sun, 02 Dec 2018 03:48:42 -08002 years ago1
🗨 1
🐏 0
👁 331
Profile Photo - Some Guy

In web.PHP line 23: The use statement with non-compound name 'Request' has no effect

Answers in Frameworks | By Some Guy

Published | Last Update

Profile Photo - August R. Garcia

Last ReplyThis is a bug that I ran into while testing a few things in the routes/web.PHP file. I had included the line: <?php use Request; While--... August R. Garcia,

This is a bug that I ran...

Sun, 02 Dec 2018 03:48:35 -08002 years ago1
🗨 1
🐏 0
👁 366
Profile Photo - Some Guy

How to get the first 20 words from a string in Laravel?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyThe function you're looking for is str_limit(). https://Laravel-news.com/str_limit https://Laravel.com/docs/5.7/helpers#method-str-limit... August R. Garcia,

The function you're l...

Sun, 02 Dec 2018 03:48:30 -08002 years ago1
🗨 1
🐏 0
👁 344
Profile Photo - Some Guy

How to get random pivot table values with Laravel seeders?

Answers in Frameworks | By Some Guy

Published | Last Update

Profile Photo - August R. Garcia

Last ReplyThe 'sync' method solves for the issue with duplicates causing errors. A piece of code similar to this is relatively concise and works for gen... August R. Garcia,

The 'sync' method...

Sun, 02 Dec 2018 03:47:58 -08002 years ago1
🗨 1
🐏 0
👁 387
Profile Photo - Some Guy

Laravel - Where to store utility functions?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyIf you're writing utility functions that are used for all/many of your controlelrs, you might consider defining them in the/a parent controller&#... August R. Garcia,

If you're writing ut...

Sun, 02 Dec 2018 03:47:49 -08002 years ago1
🗨 1
🐏 0
👁 297
Profile Photo - Some Guy

Can Laravel's Faker library get random IP addresses?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last Reply~~The easiest way to get a random IP address when working with Laravel (or the Faker library in general) is to use the PHP function long2ip: long2ip(... August R. Garcia,

~~The easiest way to get...

Sun, 02 Dec 2018 03:47:14 -08002 years ago1
🗨 1
🐏 0
👁 432
Profile Photo - Some Guy

How to check the current page in Laravel?

Answers in Frameworks | By Some Guy

Published

Profile Photo - August R. Garcia

Last ReplyTo get the current path, you can use: <?php Request::path() August R. Garcia,

To get the current path,...

Sun, 02 Dec 2018 03:45:58 -08002 years ago1
🗨 1
🐏 0
👁 387