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...
<?php
echo setting('site.title');{{ setting('site.title') }}productsRoute::group(['prefix' => 'admin'], function () {
Voyager::routes();
});URL/admin/slug-nameURL/admin/products// 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',
],function tinymce_init_callback(editor)
{
//...
}file_upload_sizecomposer require tcg/voyagerAPP_URL=http://localhost
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secretMissing required parameters for [Route...]public function getFullNameAttribute()
{
return "{$this->first_name} {$this->last_name}";
}public $additional_attributes = ['full_name'];Route::group(['prefix' => 'admin'], function () {
Voyager::routes();
// Your overwrites here
Route::post('login', ['uses' => 'MyAuthController@postLogin', 'as' => 'postlogin']);
});<?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 }}"
type="number"
@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">Voyager::image('...')asset()Storage::disk(config('voyager.storage.disk'))->url($file);'url' => env('APP_URL').'/storage',asset(Voyager::image('...'))php artisan voyager:installphp artisan voyager:install --with-dummyphp artisan voyager:admin [email protected]php artisan voyager:admin [email protected] --createphp artisan vendor:publish --provider=VoyagerServiceProvider
php artisan vendor:publish --provider=ImageServiceProviderLaravel5<?php
'providers' => [
// Laravel Framework Service Providers...
//...
// Package Service Providers
TCG\Voyager\VoyagerServiceProvider::class,
// ...
// Application Service Providers
// ...
],<?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);
}
}main. Inside of any view file we could now output the menu by using the following code: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')
$model->getCoordinates();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
@endforeach<?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 register()
{
Voyager::useModel('DataRow', \App\DataRow::class);
}
// ...
}<?php
namespace App;
class DataRow extends \TCG\Voyager\Models\DataRow
{
// ...
}<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class YourModelName extends Model
{
}<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class Documento extends Model
{
use SoftDeletes;
protected $dates = ['deleted_at'];
}canOrFail// via user object
$canViewPost = $user->can('read', $post);
$canViewPost = Auth::user()->can('read', $post);
// via controller
$canViewPost = $this->authorize('read', $post);$canBrowsePost = Voyager::can('browse_posts');
$canViewPost = Voyager::can('read_posts');
$canEditPost = Voyager::can('edit_posts');
$canAddPost = Voyager::can('add_posts');
$canDeletePost = Voyager::can('delete_posts');Voyager::canOrFail('browse_admin');@can('browse', $post)
I can browse posts
@endcan@can('browse', $post)
I can browse posts
@else
I cannot browse posts
@endcan



https://github.com/the-control-group/voyager/blob/1.1/migrations/2017_11_26_013050_add_user_role_relationship.php
https://github.com/the-control-group/voyager/blob/1.1/migrations/2017_11_26_015000_create_user_roles_table.php
https://github.com/the-control-group/voyager/blob/1.1/migrations/2018_03_11_000000_add_user_settings.php
https://github.com/the-control-group/voyager/blob/1.1/migrations/2018_03_14_000000_add_details_to_data_types_table.php
https://github.com/the-control-group/voyager/blob/1.1/migrations/2018_03_16_000000_make_settings_value_nullable.php$user->role->name // Name of primary role$user->roles() // gets all extra roles relationship
$user->roles()->get() // gets all extra as a collection$user->roles_all() // collection of all rolesphp artisan vendor:publish --tag=voyager_assets --forcephp artisan view:clear





Translatable Trait in your model and define the translatable attributes:'multilingual' => [
'enabled' => true,
'rtl' => false,
'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');$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();<?php
'user' => [
'add_default_role_on_register' => true,
'default_role' => 'user',
'admin_permission' => 'browse_admin',
'namespace' => App\User::class,
'redirect' => '/admin'
],<?php
'controllers' => [
'namespace' => 'TCG\\Voyager\\Http\\Controllers',
],<?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', 'settings'],
],
],<?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),
],

{
"default" : "Default text"
}{
"on" : "On Text",
"off" : "Off Text",
"checked" : "true"
}{
"default" : "option1",
"options" : {
"option1": "Option 1 Text",
"option2": "Option 2 Text"
}
}{
"default" : "radio1",
"options" : {
"radio1": "Radio Button 1 Text",
"radio2": "Radio Button 2 Text"
}
}{
"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"
}
}
]
}{
"format" : "%Y-%m-%d"
}{
"description": "A helpful description text here for your future self."
}{
"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": {
"rules": [
"required",
"max:12"
]
}
}{
"slugify": {
"origin": "title",
"forceUpdate": true
}
}{
"null": ""
}{
"null": "Nothing"
}{
"display": {
"width": "3",
"id": "custom_id"
}
}<div id="custom_id">
<!-- Your field element -->
</div>






