A collection of programming & webdesign
Laravel maintenance mode

While working on a live Laravel project it might be useful to set the page in a maintenance mode, so that users visiting it, won't see any errors while work's in progress.

For this, practically just log into the server where your project is located, navigate to your project folder and there use the command  php artisan down . This sets your application in a maintenance mode. What people visiting your page then will see is a standard Laravel maintenance page.

... read more
Laravel passing several variables to view

There are several ways of passing multiple variables to a view in Laravel:

1. Using with()

... read more
Laravel defaults xampp & mamp




... read more
Laravel date language

Obviously, there are several methods of setting up the language of a date in Laravel. I was finally successful with the following one:

1. AppServiceProvider:

public function register()
        setlocale(LC_TIME, config('app.locale'));

... read more
Laravel run app on different port

Just because I keep forgetting this command -

if you wish to open your Laravel application not on the standard 8000 port but on a different one, use this:

 php artisan serve --port=1234 

Also handy if you've got several applications running at the same time.

Different uses of with() in Laravel

In Laravel you can use the with() method to pass data to a view for example.

But there are different ways of this with() method as for how the passed parameters are treated by the system in the view they've been passed to:

... read more
Laravel routes

Something important when creating routes in Laravel is never to use routes consisting of variables only. Make them unique, like so -

Don't:  /{id}/{title} 

Do:  /cat/{id}/{title} 

Laravel resources via public

What do you put in resources, what in public?

The resources folder:

  • css
  • js (new files have to be included in webpackmix file, too)

Access via:  ("../js/yourfile.js") 

... read more
Use of npm in Laravel to manage CSS

For your CSS in Laravel you can either use the public folder or use the resources/css folder and npm to manage and compile your CSS.

For this, do the following:

... read more