PHP code example of weblabormx / laravel-front

1. Go to this page and download the library: Download weblabormx/laravel-front library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

weblabormx / laravel-front example snippets


@yield('after-nav')
<main class="container-fluid container">
    @if(View::hasSection('sidebar') && strlen(trim(View::getSections()['sidebar']))>0)
        <div class="row">
            <div class="col-sm-3 py-4">
                @yield('sidebar')
            </div>
            <div class="col-sm-9 py-4">
                @GWSFlBw8HfCJo="
    crossorigin="anonymous"></script>
@stack('scripts-footer')

Route::front('Page');

public $title;      // Field name of the title (Name is the default value)
public $model;      // Direction of the model
public $base_url;   // Url created on routes (Required)
public $actions = ['index', 'create', 'store', 'show', 'edit', 'update', 'destroy']; // If you want to modify which actions to be available

    public function index()
    {
        return $message;
    }

public function indexQuery($query)
{
    return $query->where('team_id', 1)->with(['user'])->latest();
}

    public function create($data)
    {
        return Team::current()->blog_entries()->create($data);
    }

    public function index_links()
    {
        return [
            '/admin/multimedia/create?is_directory=1&directory_id='.$this->currentFolder()  => '<i class="fa fa-folder"></i> '.__('Create').' '.__('Folder')
        ];
    }

    public function links()
    {
        return [
            '/admin/multimedia/create?is_directory=1&directory_id='.$this->currentFolder()  => '<i class="fa fa-folder"></i> '.__('Create').' '.__('Folder')
        ];
    }

public $pagination = 50;

use WeblaborMx\Front\Inputs\ID;
use WeblaborMx\Front\Inputs\Text;
use WeblaborMx\Front\Inputs\HasMany;
use WeblaborMx\Front\Inputs\Date;
use WeblaborMx\Front\Inputs\Boolean;

public function fields()
{
    return [
        ID::make(),
        Text::make('Name')->rules('tOnForms(),
        HasMany::make('Reservation'),
        HasMany::make('ClientSearch'),
    ];
}

Text::make('Name', 'name_column')

Text::make('Name')->hideFromIndex()

BelongsTo::make('Module')->hideWhenValuesSet()

Select::make('Type')->options([
    'normal' => 'Normal',
    'specific' => 'Specific'
]),
Text::make('Name')->conditional("type=='normal'"),
Text::make('Another Name')->conditionalOld("type", 'specific'),

use WeblaborMx\Front\Inputs\ID;
use WeblaborMx\Front\Inputs\Text;
use WeblaborMx\Front\Components\Panel;

public function fields()
{
    return [
        Panel::make('General Information', $this->generalInformationFields()),
    ];
}

public function generalInformationFields()
{
    return [
        ID::make('ID'),
        Text::make('Code')->exceptOnForms(),
        Text::make('Name')->rules('

    public function fields()
    {
        return [
            ID::make(),
            BelongsTo::make('Currency')->rules('

    public function currency()
    {
        return $this->belongsTo(Currency::class);
    }

    public function fields()
    {
        return [
            ID::make(),
            HasMany::make('Video')->rules('

    public function videos()
    {
        return $this->belongsTo(Video::class);
    }

    public function fields()
    {
        return [
            MorphTo::make('Priceable')->types([
                Course::class,
                Product::class,
            ]),
        ];
    }

    public function prices(){
        return $this->morphMany(Price::class,'priceable');
    }

HasMany::make('Reservation')->enableMassive(),

Image::make('Photo')->rules('

'default' => env('FILESYSTEM_DRIVER', 'public'),
 
public function filters()
{
    return [
        new SearchFilter,
    ];
}

class ActiveFilter extends Filter
{
    public $default = 1;
}

namespace App\Front\Actions;

use WeblaborMx\Front\Inputs\Text;
use Illuminate\Http\Request;

class ResendEmail extends Action
{
    public $show_on_index = true; // If true it will show the icon on the index page

    public function handle($object, Request $request)
    {
        // Execute what you want to do
    }

    public function fields()
    {
        // Do you need to ask some information? You can avoid this function if just want to execute an action
        return [
            Text::make('Note')->rules('

public function actions()
{
    return [
        new ResendEmail
    ];
}

namespace App\Front\Actions;

use WeblaborMx\Front\Inputs\Text;
use Illuminate\Http\Request;

class ResendEmail extends IndexAction
{
    public function handle($object, Request $request)
    {
        // Execute what you want to do
    }

    public function fields()
    {
        // Do you need to ask some information? You can avoid this function if just want to execute an action
        return [
            Text::make('Note')->rules('

public function index_actions()
{
    return [
        new ResendEmail
    ];
}

namespace App\Front\Lenses;

use WeblaborMx\Front\Traits\IsALense;
use WeblaborMx\Front\Inputs\Date;
use WeblaborMx\Front\Inputs\Number;
use WeblaborMx\Front\Inputs\Money;
use App\Front\Fuel;

class FuelByDate extends Fuel
{
    use IsALense; // Required

    public $lense_title = 'By Date'; // Title of the lense

    public function fields()
    {
        return [
            Date::make('Date'),
            Number::make('Quantity', 'quantity_sum'),
            Money::make('Price', 'price_sum'),
        ];
    }
}


namespace App\Front;

use App\Front\Resource;
use App\Front\Lenses\FuelByDate;

class Fuel extends Resource
{
    public function lenses()
    {
        return [
            new FuelByDate
        ];
    }
}


php artisan front:resource Page