Preface
Introduction
A Platform 4 extension to manage personnel. The Personnel Extension is an excellent example of how to use Tags, the Media Manager and cropping uploaded media when uploading.
Have a read through the Installation Guide.
Features
- Create, update or delete personnel.
- Assign title, name, phone and image.
- Add tags.
- Add attributes.
Examples
The $employees
variable used below is a reference to the EmployeeRepository.
$employees = app('platform.employees');
Retrieve all employees.
$allEmployees = $employees->findAll();
Dynamically create a new employee.
$employees->create([
'name' => 'Foo',
'title' => 'Dr',
'phone' => '123456',
]);
Setup
Installation
The best and easiest way to install the Personnel extension is with Composer.
Preparation
Open your composer.json
file and add the following to the require
array:
"platform/personnel": "1.0.*"
Add the following lines after the require
array on your composer.json
file:
"repositories": [
{
"type": "composer",
"url": "https://packages.cartalyst.com"
}
]
Note: Make sure that after the required changes your
composer.json
file is valid by runningcomposer validate
.
Install the dependencies
Run Composer to install or update the new requirement.
php composer install
or
php composer update
Now you are able to install the extension through Platform's admin.
The Personnel extension requires "platform/media": "~3.3"
which comes with the Media Manager.
Note: If you have any problem running
composer update
make sure you are using"platform/media": "~3.3"
and not an older version which would cause aYour requirements could not be resolved to an installable set of packages
error. You could also remove the Media extension from your composer.json since the Personnel Extension is going to require the correct version.
Usage
In this section we'll show how you can manage your personnel.
Administration
After installing and enabling the Personnel extension, you will see a new Personnel
button in your Administration menu.
You can create new Personnel by clicking on the +
symbol.
Note: This extension uses Tags, the Media Manager and Attributes and is meant to be an example if you have never used our extensions in conjunction.
It also cropps the Media when uploading Files to the Personnel.
Please read the Media Manager Manual to learn more about the Media Manager and cropping Media.
Frontend
After installing and enabling the Personnel extension, you will see a Team
button in your Main menu.
You can visit yoursite.dev/team
to visit the frontend of the Personnel extension.
Note: This Extension is meant to be an example if you have never used our extensions in conjunction.
Repository
IoC Binding
The personnel repository is bound to platform.personnels
and can be resolved out of the IoC Container using that offset.
$personnels = app('platform.personnels');
Methods
The repository contains several methods that are used throughout the extension, most common methods are listed below.
For an exhaustive list of available methods, checkout the PersonnelRepositoryInterface
- findAll();
Returns a collection of all personnels.
- find($id);
Returns an personnel object based on the given id.
- create(array $data);
Creates a new personnel.
- update($id, array $data);
Updates an existing personnel.
- delete($id);
Deletes an personnel.