Laravel Routing Macro

Ever find yourself writing the following code a decent amount of times in your Laravel router?

Route::get('/admin', function() {
return redirect()->to('/admin/dashboard');
});

Instead of writing that each time you want to redirect your users to a sub page of a route, an easier solution is to define a macro in your app’s service provider boot method. Laravel’s facades supports a macro function which accepts a initial route as its first argument, and a destination as its second. When the macro is called it will execute a redirect.

use Illuminate\Support\Facades\Route;
Route::macro('redirect', function($from, $to) {
return Route::get($from, function() use ($to) {
return redirect($to);
});
});

So now in your router all you need to do is the following:


Route::macro('/admin', '/admin/dashboard');

This idea was originally created by David Hemphill.

Why I love software

I love software, specifically web and mobile, because of the endless potential it has. The fact that you can get a website or app up and running in a matter of seconds is just unbelievable. When it comes to creating a business all you really need is a computer and the knowledge on how to create.

There are so many resources and tools to help you get started whether that is a framework or just a website like Treehouse that teaches you how to code, it’s all readily available. Speaking of frameworks there are so many great ones out there, in all different languages. I love Laravel (php) I think its well designed and so easy to use. Another framework that I have been interested in is called Phoenix which is in Elixir. I haven’t had much time to work on it but I definitely want to pursue it more and dig deeper into it and maybe use it on a future app.

Anyway, back to my original idea on why software is so great, I love creating things, I have always been fascinated and intrigued by the idea that you can create something, sell it, and see people using it. In college I started a lacrosse clothing line and a few weeks after launching the first line of shirts, I was browsing Facebook and I saw a stick trick video posted by someone that I had no idea who it was, wearing one of my shirts! It was too cool. Now, thats all fun, but its hard to create something that is a physical product, why, because you need capital and you have to deal with inventory, shipping, etc. However, with software, all you need to do is have a computer. You can be anywhere in the world creating software that changes the world. Its an incredible phenomena that I absolutely love.

There has never been a better time to learn to code and there has never been an EASIER time to learn. There are countless resources, and unlimited reasons why you should.

Overcoming Fear

I’ve always had a problem producing things, whether that was writing articles, releasing a product, or sharing something I designed. I’m not sure exactly what it is, I suppose fear of failure, but in reality, its a silly thing to be bothered by, what’s there to lose, the worst things that can possible happen is someone doesn’t like it or perhaps, the most likely situation, no one ever sees it to begin with.

I’d like to push myself to start blogging, I don’t know if I’d be able to write a post a day, but perhaps that is a goal I should shoot for. Whether that be sharing something about life, writing about business/web/entrepreneurship or whatever else comes to mind. I just need to let go of the barrier that prevents me from sharing the content I create.

Even when it comes to speaking with a new client, I cringe and hesitate when they ask “hey can you send me your portfolio/latest work”

I can do this!

Me, Myself & I(P)

Intellectual Property that is, I was recently discussing IP with someone because their employer was offering a “creative maker space” for the employees of that company to encourage creativity and teamwork in and outside of the company and provide the opportunity to partake in equipment and resources that the average individual would not necessarily have available. From VR set ups, lathes, plasma cutters, industrial size 3D printers, to designated employees that are there to help you with CAD or do the drafting for you. All in all, it sounds like a great resource for the employees of that company, they can come into the shop, build whatever they want, whether it be related to a specific product in the company, or work on something that they want to (some hobbies include rockets, RC cars, etc)

What had me thinking though, was as we discussed this we started talking about IP and what that meant to the employee. Granted, it makes total sense that if the employer is providing a location, equipment, and materials for the low cost of your employment, that anything you would be creating at the maker space, would definitely fall under the ownership of the employer. However, what stood out to me was that when we were talking about it, my friend mentioned that for this company (and I’m sure it there are many companies that do likewise) have in the employee agreement policy, that anything created, on and off the campus and time of work, belongs to the company.

Another friend I have who used to work at Apple said that he too had to sign this same type of agreement, a non compete but also non-moonlighting/personal project killer contract. I understand and agree that if you are on company time, property (using their computers etc) or your idea was spurred on by something that happened at work or a different spin off of the product, that most likely this would fall under the category of your employers IP as well as bad practice on your behalf. However, I think it adds to the ball and chain lifestyle of corporate America if no matter what you create (in hopes to sell etc) can be taken away from you in a blink of an eye just because you happened to be employed by a company that stretched its IP nets far and wide.