Download the PHP package bitsoftsol/laravel-administration without Composer
On this page you can find all versions of the php package bitsoftsol/laravel-administration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bitsoftsol/laravel-administration
More information about bitsoftsol/laravel-administration
Files in bitsoftsol/laravel-administration
Package laravel-administration
Short Description Laravel administration is the autometically building the crud for web and apis when developer will create model and use the LaravelAdmin or LaravelAdminAPI Traits. Developer can build model and schema also using laravel administration interface.
License MIT
Informations about the package laravel-administration
Laravel Administration
About Laravel Administration
Laravel Administration is a powerful package designed to simplify the development of Laravel applications by automating common CRUD (Create, Read, Update, Delete) operations. With this package, you can create models effortlessly and enjoy automatic route generation, views, and controller logic.
Features
- Automatic CRUD operations.
- RESTful API generation.
- Easy-to-use schema builder for advanced customization.
- User authentication and role management.
- MIT-licensed open-source software.
Installation Guide
To get started with Laravel Administration, follow these steps:
-
Create a Laravel Project:
sh composer require bitsoftsol/laravel-administration
-
Add LaravelAdminServiceProvider:
Open the
config/app.php
file and add the LaravelAdministration service provider to theproviders
array:sh php artisan vendor:publish
-
Install Frontend Assets:
Run the following commands to build assets:
sh php artisan migrate --seed
-
Enable Authentication Routes:
Add the following line inside your
routes/web.php
file:sh php artisan serve
-
Access Laravel Administration:
Open your browser and access the URL
(host)/admin
(e.g.,http://127.0.0.1:8000/admin
). -
Login Credentials:
Use the following credentials to log in:
- Username: [email protected]
- Password: bitsoftsol123
-
Create a Superuser:
To create a superuser for your Laravel application, follow these steps:
-
Open your terminal and navigate to the root directory of your Laravel project.
-
Run the following command:
bash php artisan make:model Seller -m
-
-
Define Seller Table Fields:
Inside the generated migration file, define the
Seller
table fields, includingname
,email
,city
,country
, andprofile_image
. -
Add LaravelAdmin and LaravelAdminAPI Traits:
Inside the generated migration file, define the
Seller
table fields, includingname
,email
,city
,country
, andprofile_image
. Enhance the functionality of yourSeller
model by importing theLaravelAdmin
andLaravelAdminAPI
traits.-
Import the
LaravelAdmin
Trait at the top of theSeller
model class:php use Bitsoftsol\LaravelAdministration\Traits\LaravelAdminAPI;
-
Add these two lines inside the
Seller
model class to include the traits:php protected $fillable = [ "name", "email", "city", "country", "profile_image" ];
-
-
Run Migrations:
Execute the migration to create the
sellers
table in your database:php artisan migrate
-
Access the Admin Panel:
Open your web browser and visit
http://127.0.0.1:8000/admin
. This is where you can manage your sellers with CRUD operations. -
Congratulations!
You are now able to perform CRUD operations on the
Seller
model without the need for extensive coding.This guide empowers you to efficiently manage your sellers in your Laravel application.
Postman Guide
To use CRUD APIs for the Seller
model, follow these steps:
-
Import the Postman Collection:
Import the provided Postman collection to access the CRUD APIs efficiently. You can download it from here: Postman Collection - Laravel Administration.
-
Import the Environment Variables:
Import the environment variables configuration into Postman for seamless testing. You can download it from here: Postman Environment - Laravel Administration.
-
Set the Host Variable:
In Postman, configure the
host
variable to match your application's URL, typically something likehttp://127.0.0.1:8000
. -
Access the Login API:
Make a POST request to the following API endpoint to log in:
- API Endpoint:
(host)/api/admin/login
- Credentials:
- Username: [email protected]
- Password: bitsoft123
After a successful login, you will receive an authentication token.
- API Endpoint:
-
Set the Token Environment Variable:
Once you receive the authentication token upon login, set it as the
(token)
environment variable in Postman for subsequent API requests. -
Fetch the Model ID:
Retrieve the
model_id
for theSeller
model from the following API endpoint:- API Endpoint:
{{host}}/api/admin/crud/models
Set the obtained
model_id
as the(model_id)
environment variable in Postman. - API Endpoint:
-
Access CRUD APIs for the Seller Model:
You can now access the CRUD APIs for the
Seller
model using the environment variables:- Listing of Seller API:
{{host}}/api/admin/crud/{{model_id}}
- Detail of Seller API:
{{host}}/api/admin/crud/{{model_id}}/2
(where 2 represents the seller's ID) - Store Seller API:
{{host}}/api/admin/crud/{{model_id}}
- Update Seller API:
{{host}}/api/admin/crud/{{model_id}}
(include the seller's ID in the form-data within the body tab of Postman) - Delete Seller API:
{{host}}/api/admin/crud/{{model_id}}/3
(where 3 represents the seller's ID)
- Listing of Seller API:
-
Congratulations!
You can now perform CRUD operations on the
Seller
model without the need for additional coding. Enjoy the convenience of Laravel Administration for managing your sellers efficiently.
Schema Builder
In the Laravel Administration application, you can effortlessly create the Seller
model and its associated migration file using the Schema Builder. Here's how:
-
Access the Schema Builder:
- Navigate to
(host)/admin/crud-schema/create
in your web browser, replacing(host)
with your application's URL.
- Navigate to
-
Enter the Model Name:
- On the provided page, input 'Seller' as the model name.
- Submission:
- Click the 'Submit' button to initiate the generation of the
Seller
model and its corresponding migration file in your project.
- Click the 'Submit' button to initiate the generation of the
Upon successful creation, you'll be redirected to the Schema Builder list. Here, you can find the 'Seller' model in the list.
Managing Your Schema
-
Deleting Schema:
- To remove the 'Seller' model and its migration file from your project, click the 'Delete' button.
-
Defining Schema Fields:
- By clicking the 'Create Schema' button, you'll access a view where you can define the fields of the 'Seller' migration, including the ability to add more fields. If you wish to include image fields in the migration, ensure you suffix column names with '_image.'
- LaravelAdmin Trait:
- On the 'Create Schema' view, you can select whether to use the 'LaravelAdmin' Trait by ticking the checkbox. If chosen, the trait will be automatically imported when defining seller field names.
Editing Schema
After creating the schema, you'll find an 'Open Editor' button in the 'Seller' row within the Schema Builder listing. Clicking this button will redirect you to a Visual Code Editor view, allowing you to edit the 'Seller' migration and model files.
-
LaravelAdminAPI and LaravelAdmin Traits:
- In the live editor, you can use the 'LaravelAdminAPI' Trait if required, and include the 'LaravelAdmin' Trait if desired. These traits will enable you to access CRUD routes for the Seller model, both through web and API interfaces.
- Defining Fillable Fields:
- Set the fields of the 'sellers' table in the
fillable
array. These fields will be displayed in the Seller listing view.
- Set the fields of the 'sellers' table in the
Migration
After editing the model and migration files, you can click on the 'Migrate' button to apply the changes to your table. Once the seller table is migrated, you will no longer be able to open the editor or perform migrations, but you can still delete.
CRUD Operations
-
LaravelAdmin Trait:
- If you have included the 'LaravelAdmin' Trait in your Seller model, you can access Seller CRUD operations via the 'CRUD' tab on the web interface.
- LaravelAdminAPI Trait:
- If you have included the 'LaravelAdminAPI' Trait in your Seller model, you can access Seller CRUD operation APIs using the Postman Collection.
Congratulations!, you've now completed the LaravelAdministration documentation. You're all set to make the most of this powerful tool for Laravel development. Happy coding!
All versions of laravel-administration with dependencies
darkaonline/l5-swagger Version ^8.4
laravel/ui Version ^4.2
yajra/laravel-datatables-oracle Version ^10.8
laravel/framework Version ^10.0