Mohamed Benhida

admin@devma.net

December 26, 2017

Laramin Admin Panel

Hey,

Laramin is a small admin panel helps you do the CRUD without adding a line of code provides a good features like Tags,Datatables ... , Making a model file and a migration file also trigger for you php artisan:migrate that is all in one click So in this post we will see how can we work with it step by step.

First of all we need to install the package on our machine 

composer require simoja/laramin

If you are working with a Laravel version less than 5.5 you need to call the serviceProvider on your

config/app.php

'providers' => [
    // Laravel Framework Service Providers...
    //...

    // Package Service Providers
    Simoja\Laramin\LaraminServiceProvider::class,

    // ...

    // Application Service Providers
    // ...
],

After that we need configure our database credentials on

.env 

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laramin
DB_USERNAME=root
DB_PASSWORD=

now let's install laramin on our project php artisan Laramin:install

We will see something like this

laramin

Now if we visit localhost/admin we can link to our Laramin admin Panel

laramin

You can change the admin prefix on

config/laramin.php

<?php
return [

    'namespaceControllers' => 'Simoja\\Laramin\\Http\\Controllers',

    'public_path' => 'vendor/laramin/assets',

    'prefix' => 'admin',

    'password' => 'secret',

    'CurrentType' => null
];

We need to seed our data to database by adding this two lines on DatabaseSeeder.php

database/seeds/DatabaseSeeder.php

<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $this->call(LaraminDataSeeder::class);
        $this->call(LaratrustSeeder::class);
    }
}

We launch composer dump-autoload to refresh the added files by the pacakage then we seed php artisan db:seed

Now we connect with our dummy data

Email = superadministrator@app.com

Password = password

laramin

Database : 

Let's begin by exploring the database menu.

Laramin

Here we can see the columns of Post database and the validation infos.

laramin

For now we can just edit the validation credentials and if you want this Model to be in displayed on menu or on Datatable array.

laramin

Now we will create something called Threads with tags , title, body 

laramin

Now the button Save will do all the work create the Model File,Migration File,Also add it to database 

Threads Model

laramin

Threads Migration

laramin

Database :

laramin

Roles :

We need now to add the permission to this new Model Threads for our superadminUser Role can create and see Threads

laramin

Add Permission To Threads By clicking on Assing Permissions

laramin

Now you can add - edit - delete Threads 

laramin

Now you can see the thread on datatable

laramin

Or Editing The Threads

laramin

You can now use model to retrieve data like this

return App\Threads::find(1);

laramin

Or if you want to retrieve the tags 

return App\Threads::find(1)->tags;

laramin

 

We did all that without touching a single line of code but we didn't looked to everything so is your turn to install the package and start discovering it you can also contribute and dont forget to add a star to github.

 

© Mohamed Benhida.

Blog | Packages | About