Skip to content

u/StubbornTurtle

In this archive from Jan 2013 to May 2022

1
posts
29
comments
0
media
81
score

You should be using dependency injection in more places instead of calling app('example'). When you construct a controller, for example, you can put a parameter with a specific type and it will be resolved automatically. Then the IDE will understand too.

10 points

Ngrok (the technology behind the "valet share" command) is awesome. It's actually really simple to use and you can accomplish the same sharing with any application/technology that you want to expose online (temporarily, obviously).

6 points

I'm not sure why you say there isn't time to learn a framework. A framework is documented. If you bake something up yourself, it may be harder to learn for the others or coordinate on.

Alternatively, you should at least take a advantage of some existing modules/components like the symfony http foundation.

As others have mentioned, you might also consider a micro framework like Lumen or Slim.

-11 points

That's a different issue. It may not know that the view function returns a response. You can try returning view() to a variable and providing a type in a comment block.

/**
 * Example
 *
 * @return Response
 */
public function example()
{
    /** @var Response $response */
    $response = view('some.example');
    return $response;
}
0 points

It depends what your goals are. From a traditional business perspective, if you are thinking about frameworks and talking about a brochure site you are on the wrong track. Sure, there is some value to learning a new technology, but learn it while playing with a side-project.

You should be focusing on the requirements on the project and the future maintenance.

  • Who needs to update it? What is their level of understanding with the web, in general?
  • How many pages will it have?
  • How should it be organized?
  • Is there any special functionality?
  • etc, etc.
1 points

Here is a taste of how it makes things easier:

Traditional:

$db->query("INSERT INTO `people` SET `x`='y', `a`='b'");

$newPersonID = $db->insert_id;

$newPerson = $db->query("SELECT * FROM `people` WHERE `id` = '{$newPersonID}'");

$newPerson = $newPerson->fetch_object('Person');

With Handy:

$newPerson = Person::create(array( 'x' => 'y', 'a' => 'b' ));

Edit: Formatting

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.