Download the PHP package arcticsoftware/polarlinks without Composer
On this page you can find all versions of the php package arcticsoftware/polarlinks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arcticsoftware/polarlinks
More information about arcticsoftware/polarlinks
Files in arcticsoftware/polarlinks
Package polarlinks
Short Description A simple hyperlink management CRUD API
License MIT
Informations about the package polarlinks

Simple hyperlink content CRUD for Laravel
PolarLinks provides a unified place to administer site wide hyperlinks for content management on your laravel application. This package does not deal with any frontend components of Laravel, but serves basic CRUD API for easy implementation into your administration panel and frontend library of choice.
Requirements
- Laravel >= 8.*
- PHP >= 8.*
Installation
You can install this package through composer:
Once you have installed the package, and before you proceed with your database migration you might want to customize and define what table names the package is going to use. There are two database tables defined and needed by the package. One for link collections, and one for the links themselves. By default, these are:
- polarsections
- polarlinks
Respectively. To publish the configuration file, run the command after installation in the root folder of your laravel installation:
From here on you can edit the published configuration file in [laravel_root]/config/polarlinks.php
Once you are satisfied with your choice(s), publish the migrations by running the following command in the root folder of your laravel installation:
Then run php artisan migrate to run the database migrations. The package is now ready for use.
Usage
Accessing the underlying models and data are done through an API available with a couple of defined fascades.
PolarLink
The PolarLink class provides a series of static functions to manipulate link data. Every call on this class relies on a name identifier, so no matter what operation you want to run, you will always have to provide the name function:
The name identifier has to be unique for the table and only contain alphanumeric characters pluss underscores. From here on you can define optional properties on the model to populate the link record:
The last callable function on the class is always an operation. The available function operations for the PolarLink::class are:
PolarLink::class also has the following static utility functions (do not rely on using the static name function):
PolarSection
The PolarSection class provides means to categorize and sort your links and is defined as a one-to-many relationship between the LinkSection-Link eloquent models. Besides the usual CRUD routines, it also lets you retrieve link collections as either Elequent\Collection, PHP array, or JSON string.
Returns a single eloquent linksection model, or null if the linksection was not found in the database table, using the provided name.
If the linksection has one or more child link models, you can retrieve this as either Elequent\Collection, array or json by using the load() function and passing the options as an array. For example:
This will return all the links associated (and their data) with the section as a json array string. The format parameter accepts 3 options:
- 'collection' - Returns the links as an Eloquent\Collection
- 'array' - Returns the links as a PHP array
- 'json' - Returns the links as a json array string
PolarSection::class also has the following static utility functions (do not rely on using the static name function):
Authorship binding
Both Link and LinkSection models can have a polymorphic relationship with your User (or any other model) to define authorship of the data. This can be implemented by giving your model(s) the neccessary traits to associate them with either/both of these two:
Example implementation in the User model:
The relationship can now be accessed with eloquent through:
or
respectively
Testing
Changelog
Please see the CHANGELOG log for details about changes between the versions
Contributing
Please contact us if you would like to make some contributions to our code, and we will set up the needed branches and permissions for you to submit your changes. We will be sure to credit you on this page (and on our company page if your contributions are significant).
Security
If you discover any security vulnerabilities in the code, please contact us directly instead of using the issue tracker
License
This software is licensed under the terms of the MIT license. Please review the accompanied license.md file for details.