Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

{
"format" : "%Y-%m-%d"
}{
"step" : 0.1,
"min" : 0,
"max" : 10,
"default": 1,
}Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
});URL/admin/slug-name





URL/admin/products<?php
public function getNameBrowseAttribute()
{
return $this->name ?? 'Empty';
}<?php
public function getNameReadAttribute()
{
//
}
public function getNameEditAttribute()
{
//
}
public function getNameAddAttribute()
{
//
}{
"default" : "option1",
"options" : {
"option1": "Option 1 Text",
"option2": "Option 2 Text"
}
}<?php
echo setting('site.title');{{ setting('site.title') }}
Missing required parameters for [Route...]{
"resize": {
"width": "1000",
"height": null
},
"quality" : "70%",
"upsize" : true,
"thumbnails": [
{
"name": "medium",
"scale": "50%"
},
{
"name": "small",
"scale": "25%"
},
{
"name": "cropped",
"crop": {
"width": "300",
"height": "250"
}
}
]
}Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
// Your overwrites here
Route::post('login', ['uses' => 'MyAuthController@postLogin', 'as' => 'postlogin']);
});function myFunction(eventType, data) {
console.log('eventType', eventType);
console.log('data.lat', data.lat);
console.log('data.lng', data.lng);
console.log('data.place', data.place);
}"repositories": {
"hooks": {
"type": "composer",
"url": "https://larapack.io",
"options": {
"ssl": {
"verify_peer": false
}
}
}
}{
"on" : "On Text",
"off" : "Off Text",
"checked" : true
}{
"checked" : true,
"options": {
"checkbox1": "Checkbox 1 Text",
"checkbox2": "Checkbox 2 Text"
}
}{
"default" : "radio1",
"options" : {
"radio1": "Radio Button 1 Text",
"radio2": "Radio Button 2 Text"
}
}use TCG\Voyager\Traits\Resizable;
class Post extends Model
{
use Resizable;
}@foreach($posts as $post)
<img src="{{Voyager::image($post->thumbnail('small'))}}" />
@endforeach@foreach($posts as $post)
<img src="{{Voyager::image($post->thumbnail('small', 'photo'))}}" />
@endforeach@foreach($posts as $post)
$images = json_decode($post->images);
@foreach($images as $image)
<img src="{{ Voyager::image($post->getThumbnail($image, 'small')) }}" />
@endforeach
@endforeachfunction tinymce_init_callback(editor)
{
//...
}function tinymce_setup_callback(editor)
{
//...
}{
"tinymceOptions" : {
"name": "value"
}
}tinymce.init(window.voyagerTinyMCE.getConfig());// Here you can specify additional assets you would like to be included in the master.blade
'additional_css' => [
//'css/custom.css',
],
'additional_js' => [
//'js/custom.js',
],




$model->getCoordinates();<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class YourModelName extends Model
{
}Voyager::image('...')asset()Storage::disk(config('voyager.storage.disk'))->url($file);'url' => env('APP_URL').'/storage',asset(Voyager::image('...')){
"foreign_pivot_key": "user_id",
"related_pivot_key": "role_id",
"parent_key": "id"
}{
"sort": {
"field": "my_field",
"direction": "asc"
}
}{
"sort": {
"field": "my_field",
"direction": "desc"
}
}public function scopeActive($query)
{
return $query->where('active', 1);
}{
"scope": "active",
}menu('main');menu('main', 'bootstrap');<ul>
@foreach($items as $menu_item)
<li><a href="{{ $menu_item->link() }}">{{ $menu_item->title }}</a></li>
@endforeach
</ul>menu('main', 'my_menu');menu('main', '_json')<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Documento extends Model
{
use SoftDeletes;
protected $dates = ['deleted_at'];
}<?php
namespace App\FormFields;
use TCG\Voyager\FormFields\AbstractHandler;
class NumberFormField extends AbstractHandler
{
protected $codename = 'number';
public function createContent($row, $dataType, $dataTypeContent, $options)
{
return view('formfields.number', [
'row' => $row,
'options' => $options,
'dataType' => $dataType,
'dataTypeContent' => $dataTypeContent
]);
}
}<input type="number"
class="form-control"
name="{{ $row->field }}"
data-name="{{ $row->display_name }}"
@if($row->required == 1) required @endif
step="any"
placeholder="{{ isset($options->placeholder)? old($row->field, $options->placeholder): $row->display_name }}"
value="@if(isset($dataTypeContent->{$row->field})){{ old($row->field, $dataTypeContent->{$row->field}) }}@else{{old($row->field)}}@endif">





<?php
namespace App\Providers;
use TCG\Voyager\Facades\Voyager;
use App\FormFields\NumberFormField;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
//..
public function register()
{
Voyager::addFormField(NumberFormField::class);
}
}public function getFullNameAttribute()
{
return "{$this->first_name} {$this->last_name}";
}public $additional_attributes = ['full_name'];admin in your config/auth.php:{
"validation": {
"rule": "required|max:12"
}
}{
"validation": {
"rule": "required|max:12",
"messages": {
"required": "This :attribute field is a must.",
"max": "This :attribute field maximum :max."
}
}
}{
"validation": {
"rule": [
"required",
"max:12"
]
}
}{
"validation": {
"rule": "min:3",
"edit": {
"rule": "nullable"
},
"add": {
"rule": "required"
}
}
}<?php
public function scopeCurrentUser($query)
{
return $query->where('author_id', Auth::user()->id);
}{
"description": "A helpful description text here for your future self."
}{
"display": {
"width": "3",
"id": "custom_id"
}
}<div id="custom_id">
<!-- Your field element -->
</div>{
"default" : "Default text"
}{
"null": ""
}{
"null": "Nothing"
}{
"slugify": {
"origin": "title",
"forceUpdate": true
}
}{
"view": "my_view"
}{
"view_browse": "my_browse_view",
"view_read": "my_read_view",
"view_add": "my_add_view",
"view_edit": "my_edit_view",
"view_order": "my_order_view"
}composer require tcg/voyagerAPP_URL=http://localhost
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secretphp artisan voyager:installphp artisan voyager:install --with-dummyphp artisan voyager:admin your@email.comphp artisan voyager:admin your@email.com --createphp artisan vendor:publish --provider="TCG\Voyager\VoyagerServiceProvider"
php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravelRecent"<?php
class User extends \TCG\Voyager\Models\User
{
// ...
}<?php
Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
});$this->app->singleton('VoyagerGuard', function () {
return 'your-custom-guard-name';
});<?php
Schema::create('admins', function (Blueprint $table) {
$table->bigIncrements('id');
$table->bigInteger('role_id')->unsigned()->nullable();
$table->string('name');
$table->string('email')->unique();
$table->string('avatar')->nullable()->default('users/default.png');
$table->string('password')->nullable();
$table->string('remember_token')->nullable();
$table->text('settings')->nullable()->default(null);
$table->timestamps();
$table->foreign('role_id')->references('id')->on('roles');
});<?php
namespace App;
class Admin extends \TCG\Voyager\Models\User
{
}'guards' => [
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
// ...
],'providers' => [
'admins' => [
'driver' => 'eloquent',
'model' => App\Admin::class,
],
// ...
],public function register()
{
$this->app->singleton('VoyagerGuard', function () {
return 'admin';
});
}'multilingual' => [
'enabled' => true,
'default' => 'en',
'locales' => [
'en',
'da',
],
],use TCG\Voyager\Traits\Translatable;
class Post extends Model
{
use Translatable;
protected $translatable = ['title', 'body'];
}// Loads all translations
$posts = Post::with('translations')->get();
// Loads all translations
$posts = Post::all();
$posts->load('translations');
// Loads all translations
$posts = Post::withTranslations()->get();
// Loads specific locales translations
$posts = Post::withTranslations(['en', 'da'])->get();
// Loads specific locale translations
$posts = Post::withTranslation('da')->get();
// Loads current locale translations
$posts = Post::withTranslation('da')->get();echo $post->title;echo $post->getTranslatedAttribute('title', 'locale', 'fallbackLocale');// via user object
$canViewPost = $user->can('read', $post);
$canViewPost = Auth::user()->can('read', $post);
// via controller
$canViewPost = $this->authorize('read', $post);<?php
namespace App\Actions;
use TCG\Voyager\Actions\AbstractAction;
class MyAction extends AbstractAction
{
public function getTitle()
{
return 'My Action';
}
public function getIcon()
{
return 'voyager-eye';
}
public function getPolicy()
{
return 'read';
}
public function getAttributes()
{
return [
'class' => 'btn btn-sm btn-primary pull-right',
];
}
public function getDefaultRoute()
{
return route('my.route');
}
}<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Events\Dispatcher;
use TCG\Voyager\Facades\Voyager;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Voyager::addAction(\App\Actions\MyAction::class);
}
}value the value you want to search for


$post = $post->translate('locale', 'fallbackLocale');
echo $post->title;
echo $post->body;
// You can also run the `translate` method on the Eloquent collection
// to translate all models in the collection.
$posts = $posts->translate('locale', 'fallbackLocale');
echo $posts[0]->title;// with string
if (Voyager::translatable(Post::class)) {
// it's translatable
}
// with object of Model or Collection
if (Voyager::translatable($post)) {
// it's translatable
}$post = $post->translate('da');
$post->title = 'foobar';
$post->save();$page = Page::whereTranslation('slug', 'my-translated-slug');
// Is the same as
$page = Page::whereTranslation('slug', '=', 'my-translated-slug');
// Search only locale en, de and the default locale
$page = Page::whereTranslation('slug', '=', 'my-translated-slug', ['en', 'de']);
// Search only locale en and de
$page = Page::whereTranslation('slug', '=', 'my-translated-slug', ['en', 'de'], false);Gate::define('browse_create_bill', function ($user) {
return $user->hasPermission(`browse_create_bill`);
});public function index()
{
$this->authorize('browse_create_bill');
//.. /**
* Get the guard to be used during authentication.
*
* @return \Illuminate\Contracts\Auth\StatefulGuard
*/
protected function guard()
{
return Auth::guard(app('VoyagerGuard'));
}@can('browse', $post)
I can browse posts
@endcan@can('browse', $post)
I can browse posts
@else
I cannot browse posts
@endcan<?php
public function shouldActionDisplayOnDataType()
{
return $this->dataType->slug == 'posts';
}<?php
public function shouldActionDisplayOnRow($row)
{
return $row->id > 10;
}<?php
public function massAction($ids, $comingFrom)
{
// Do something with the IDs
return redirect($comingFrom);
}@extends('voyager::bread.edit-add')
@section('submit-buttons')
@parent
<button type="submit" class="btn btn-primary save">Save And Publish</button>
@endsection<?php
namespace App\Http\Controllers;
class VoyagerCategoriesController extends \TCG\Voyager\Http\Controllers\VoyagerBaseController
{
//...
}/*
|--------------------------------------------------------------------------
| Controllers config
|--------------------------------------------------------------------------
|
| Here you can specify voyager controller settings
|
*/
'controllers' => [
'namespace' => 'App\\Http\\Controllers\\Voyager',
],Voyager::useModel($name, $object);<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Events\Dispatcher;
use TCG\Voyager\Facades\Voyager;
class AppServiceProvider extends ServiceProvider
{
public function boot()
{
Voyager::useModel('DataRow', \App\DataRow::class);
}
// ...
}<?php
namespace App;
class DataRow extends \TCG\Voyager\Models\DataRow
{
// ...
}

<?php
'models' => [
//'namespace' => 'App\\',
],<?php
'assets_path' => '/vendor/tcg/voyager/assets',<?php
'storage' => [
'disk' => 'public',
],<?php
'database' => [
'tables' => [
'hidden' => ['migrations', 'data_rows', 'data_types', 'menu_items', 'password_resets', 'permission_role', 'personal_access_tokens', 'settings'],
],
'autoload_migrations' => true,
],<?php
'multilingual' => [
'enabled' => false,
'default' => 'en',
'locales' => [
'en',
//'pt',
],
],<?php
'dashboard' => [
'navbar_items' => [
'Profile' => [
'route' => 'voyager.profile',
'classes' => 'class-full-of-rum',
'icon_class' => 'voyager-person',
],
'Home' => [
'route' => '/',
'icon_class' => 'voyager-home',
'target_blank' => true,
],
'Logout' => [
'route' => 'voyager.logout',
'icon_class' => 'voyager-power',
],
],
'widgets' => [
'TCG\\Voyager\\Widgets\\UserDimmer',
'TCG\\Voyager\\Widgets\\PostDimmer',
'TCG\\Voyager\\Widgets\\PageDimmer',
],
],<?php
'primary_color' => '#22A7F0',<?php
'show_dev_tips' => true,<?php
'additional_css' => [
//'css/custom.css',
],<?php
'additional_js' => [
//'js/custom.js',
],<?php
'googlemaps' => [
'key' => env('GOOGLE_MAPS_KEY', ''),
'center' => [
'lat' => env('GOOGLE_MAPS_DEFAULT_CENTER_LAT', '32.715738'),
'lng' => env('GOOGLE_MAPS_DEFAULT_CENTER_LNG', '-117.161084'),
],
'zoom' => env('GOOGLE_MAPS_DEFAULT_ZOOM', 11),
],<?php
'allowed_mimetypes' => [
'image/jpeg',
'image/png',
'image/gif',
'image/bmp',
'video/mp4',
],<?php
'allowed_mimetypes' => '*',{
"max": 10,
"min": 0,
"expanded": true,
"show_folders": true,
"show_toolbar": true,
"allow_upload": true,
"allow_move": true,
"allow_delete": true,
"allow_create_folder": true,
"allow_rename": true,
"allow_crop": true,
"allowed": [],
"hide_thumbnails": false,
"quality": 90,
"watermark": {
"source": "...",
"position": "top-left",
"x": 0,
"y": 0
}
}{date:format} the current date in the format defined in format. For example {date:d.m.Y}["image", "audio", "video"]["image/jpeg", "image/png", "image/bmp"]{
"base_path": "/my-bread/{pk}/{date:Y}/{date:m}/"
}{
"thumbnails": [
{
"type": "fit",
"name": "fit-500",
"width": 500, // Required
"height": 500, // Optional
"position": "center" // Optional. Refer to http://image.intervention.io/api/fit
}
]
}{
"thumbnails": [
{
"type": "crop",
"name": "crop-500-500",
"width": 500, // Required
"height": 500, // Required
"x": 50, // Optional. Left offset
"y": 50, // Optional. Top offset
}
]
}{
"thumbnails": [
// Width will be 500px, height will be calculated based on the aspect-ratio
{
"type": "resize",
"name": "resize-500",
"width": 500,
"upsize": true, // Optional. Set to false to prevent upsizing
},
// Resizes the image to 500x500px
{
"type": "resize",
"name": "resize-500-500",
"width": 500,
"height": 500
},
// Height will be 500px, width will be auto-calculated
{
"type": "resize",
"name": "resize-500",
"width": null,
"height": 500
}
]
}