Requirements
Before moving on, please check out the Laravel documentation about its installation, requirements, and configuration.
Requirements:
- PHP
8.0+
- PHP
GD
andEXIF
extensions - Laravel
^9.0
Installation
laravel new app
composer require conedevelopment/root
Running the Install Command
After installing the package, run the root:install
command. It will run the migrations and publish the compiled assets that you may override later.
Please note: if you are using Windows, you might open your terminal or development environment as a system administrator.
Also, you may populate your local database with fake data. To do so, pass the --seed
flag to the command.
php artisan bazar:root --seed
Publishing Assets
You may want to customize the JS and SASS files. To do so, run the root:publish --tag=root-vendor
command.
php artisan root:publish --tag=root-vendor
yarn install && yarn dev
Preparing Storage
Root comes with a media manager out of the box. If you are using the public
driver, you may link your storage directory to make your media files visible for users.
php artisan storage:link
Extending the User Model
Root comes with a Cone\Root\Models\User model by default, that provides some functionality by default. Also, it brings the default authentication services; you may keep clean your App\Models\User
model and extend the one that comes with Root:
namespace App\Models;
use App\Root\Resources\UserResource;
use Cone\Root\Models\User as Model;
use Cone\Root\Resources\Resource;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Laravel\Sanctum\HasApiTokens;
class User extends Model implements MustVerifyEmail
{
use HasApiTokens;
/**
* Get the resource representation of the model.
*
* @return \Cone\Root\Resources\Resource
*/
public static function toResource(): Resource
{
return new UserResource(static::class);
}
}
Configuration
You may override the default configuration. To do so, publish the configuration file:
php artisan root:publish --root-config
You can find freshly published config in the config/root.php
file.