Servage Magazine

Information about YOUR hosting company – where we give you a clear picture of what we think and do!

Articles Tagged ‘laravel’

What has changed in Laravel 5.5?

Monday, September 18th, 2017 by Servage
laravelA new major version of Laravel is scheduled for release in late August 2017. In addition to being a long-term support release, many new features will be added to the framework, including a new error handler, custom validation rules, a new Artisan command and more. Let’s have a closer look at these new features. The “migrate:fresh” Command In previous versions of Laravel, the migrate:refresh command has been used as a quick way to roll back all changes made to a database. What it does is simply execute the down() method of all migrations followed by the up() method. The new command migrate:fresh does the same but skips calling the down() method first. In many ...

Voyager admin tool for Laravel

Tuesday, March 21st, 2017 by Servage
Screen Shot 2017-01-25 at 10.50.20Laravel, the most popular PHP framework, has recently got an alternative way to manage the framework. Voyager is a graphical admin tool that lets developers to create new models, media, menus and more with a GUI instead of a text-based terminal. Let's go through the features in more detail and see how you can install Voyager for your own web application powered by Laravel. Content Management Using BREAD One of Voyager’s main features is the ability to manage the content of your application using a graphical user interface. By default, you can manage users, user roles, media, pages and posts. Voyager uses BREAD functions to do this, which stands ...

What is new in Laravel 5.3

Wednesday, November 2nd, 2016 by Servage
Laravel-5-3Laravel 5.3 was released in not too long ago, and is a minor release which introduces some new features in a backward-compatible manner. The new version introduces an extended notification system, support for real-time applications and some smaller changes such as updates to default routes. Laravel Notifications A typical way of notifying a user or customer in a web application is by using either a custom notification system on the website or by email. Laravel supports both of these already, but version 5.3 adds some new ways to notify users. You can for example send a text message or notify a Slack channel about what is happening in your application. Here is a more practical example: ...

Database seeding with sample data in Laravel

Monday, March 7th, 2016 by Servage
laravel-db-seedWhen working with web applications you know the need for testing with sample data in your applications during development. This is extremely useful because testing with various sample data allows you to likely detect bugs you otherwise would have overlooked. Meaningful sample data also provides a useful way of showcasing the application for others, without having the typical manually entered John Doe entries over and over again. Laravel provides a tool to add sample data to your databases automatically. They call it database seeding. It is the processes of adding data to a database after migrations. You can create seeding scripts with PHP, so they can essentially include any logic you desire, to create ...

Laravel database migrations

Sunday, February 14th, 2016 by Servage
database-migrationWorking with database structure is often a cumbersome process. Initially everything is fine. You have all kinds of options and can design whatever database structure you want and your project needs. You can even change your structure many times over during the initial development without any real implications. However, this changes as soon as you get more developers on board or whenever you start working with real data. As soon as collaboration and live data exists, you need to make sure that structure and data is properly managed throughout any change process you may need. You cannot just change the database in your local environment without properly recording the change and making ...

Learn more with Laracasts

Friday, January 29th, 2016 by Servage
laracastsLearning new programming languages and systems can be quite cumbersome. Back in the old days it came down to actually reading documentation and struggling through sample code. You could slowly form a working script by partly trying yourself, and partly cutting and pasting examples together. This way of learning to code is very hands on, but extremely slow. You make many mistakes that need correction, which is done with time consuming documentation reading. Thankfully today many developers benefit from better and more modern ways of learning how to code. There are also online code schools where you are taken through various tutorials with on-screen help and coding tasks. This way of ...

Super quick development with Lumen

Saturday, December 19th, 2015 by Servage
lumenLumen is the name of a lightweight PHP framework based on Laravel. It offers a super quick way of starting simple projects that can grow easily. Lumen relies on the powerful foundation of Laravel, but offers a much simpler interface to program with. While much of the documentation shows that building applications with Lumen looks a lot like Laravel, it does offer the functionality in a simpler way. Upgrade to Laravel anytime Lumen does not give you all the features of Laravel. If you need all those features you should obviously choose the full framework, but for many small projects you would be better of with Lumen, because you can get started so ...

Implementing relationships in Eloquent models

Thursday, December 10th, 2015 by Servage
data-modelFollowing up on the recent article about Laravel models, this article will show how you can implement model relationships with Eloquent. Relationships between objects and database models are basically the foundation or blueprint on how models relate to each other. This has an impact on the way you can work with data. Defining model relationships in Eloquent provides you with a lot of functionality right out of the box. Relationship types Basic understanding of relationship types is required to define the correct relationships between models. Let us say you have an online store, so everything you have evolves around your products (i.e. the product model). Your products can have zero, one or multiple images, ...

Basic understanding of models in Laravel

Sunday, December 6th, 2015 by Servage
eloquentWhen working with Laravel you will soon realize that the Eloquent model system is a core functionality with lots of powerful features. It drives your entire object and database handling, and relieves you of repetitive tedious code writing. With Eloquent you can use structured data objects easily. Creating new models You can generate models with the "artisan" command in Laravel. Below is an example (with and without generation of a migration file): php artisan make:model Product php artisan make:model Product -m It is convenient that you can generate the migration file right away if you are building a database model. The migration file is where you define the database changes required to facilitate a new or changed ...

Work with databases and the query builder in Laravel

Monday, November 30th, 2015 by Servage
database-queryWorking with database driven applications in Laravel is super straightforward. This functionality has been included as a core feature of the framework as database handling is almost done in every project. Using your Servage hosting account you can connect to one or multiple MySQL databases from Laravel and create, edit and delete data as you please. This article will outline some of the standard functionality for this. Configuration You first need to configure your Laravel installation for your environment. Note that you can use local configurations to make the database settings different depending on for example local development environment and production web hosting account. Below you find an example configuration. 'mysql' => [ ...