在自动布局中是否有办法复制在我自己的void f() { static_assert(&f != &Actual::f, "function calls itself"); static_cast<Actual*>(this)->f(); }
void f() { static_assert(!std::is_same<decltype(f), decltype(Actual::f)>::value, "function calls itself"); static_cast<Actual*>(this)->f(); }
子类中将Do
设置为自动的效果?
时间和次数我遇到的情况是,我的视图确实具有取决于其宽度的内在高度,与<?php
namespace App\Http\Controllers\Admin;
use Backpack\CRUD\app\Http\Controllers\CrudController;
// VALIDATION: change the requests to match your own file names if you need form validation
use App\Http\Requests\EventRequest as StoreRequest;
use App\Http\Requests\EventRequest as UpdateRequest;
class EventCrudController extends CrudController
{
public function setup()
{
/*
|--------------------------------------------------------------------------
| BASIC CRUD INFORMATION
|--------------------------------------------------------------------------
*/
$this->crud->setModel('App\Models\Event');
$this->crud->setRoute(config('backpack.base.route_prefix') . '/event');
$this->crud->setEntityNameStrings('event', 'events');
/*
|--------------------------------------------------------------------------
| BASIC CRUD INFORMATION
|--------------------------------------------------------------------------
*/
$this->crud->setFromDb();
// ------ CRUD FIELDS
// $this->crud->addField($options, 'update/create/both');
// $this->crud->addField ([ // Text
// 'name' => 'body',
// 'label' => "Body",
// 'type' => 'wysiwyg',
// // optional
// //'prefix' => '',
// //'suffix' => ''
// ]);
// $this->crud->addFields($array_of_arrays, 'update/create/both');
$this->crud->addFields([
[
'name' => 'body',
'label' => "Body",
'type' => 'wysiwyg',
],
[
'name' => 'event_date_range', // a unique name for this field
'start_name' => 'start_date', // the db column that holds the start_date
'end_name' => 'end_date', // the db column that holds the end_date
'label' => 'Event Date Range',
'type' => 'date_range',
// OPTIONALS
'start_default' => '2017-01-01 01:01', // default value for start_date
'end_default' => '2017-12-31 02:00', // default value for end_date
'date_range_options' => [ // options sent to daterangepicker.js
'timePicker' => true,
'locale' => ['format' => 'DD/MM/YYYY HH:mm']
]
]
]);
// $this->crud->removeField('name', 'update/create/both');
// $this->crud->removeFields($array_of_names, 'update/create/both');
// $this->crud->removeFields(['start_date', 'end_date']);
// ------ CRUD COLUMNS
// $this->crud->addColumn(); // add a single column, at the end of the stack
// $this->crud->addColumns(); // add multiple columns, at the end of the stack
// $this->crud->removeColumn('column_name'); // remove a column from the stack
// $this->crud->removeColumns(['column_name_1', 'column_name_2']); // remove an array of columns from the stack
// $this->crud->setColumnDetails('column_name', ['attribute' => 'value']); // adjusts the properties of the passed in column (by name)
// $this->crud->setColumnsDetails(['column_1', 'column_2'], ['attribute' => 'value']);
$this->crud->setColumns(['','body']);
// ------ CRUD BUTTONS
// possible positions: 'beginning' and 'end'; defaults to 'beginning' for the 'line' stack, 'end' for the others;
// $this->crud->addButton($stack, $name, $type, $content, $position); // add a button; possible types are: view, model_function
// $this->crud->addButtonFromModelFunction($stack, $name, $model_function_name, $position); // add a button whose HTML is returned by a method in the CRUD model
// $this->crud->addButtonFromView($stack, $name, $view, $position); // add a button whose HTML is in a view placed at resources\views\vendor\backpack\crud\buttons
// $this->crud->removeButton($name);
// $this->crud->removeButtonFromStack($name, $stack);
// $this->crud->removeAllButtons();
// $this->crud->removeAllButtonsFromStack('line');
// ------ CRUD ACCESS
// $this->crud->allowAccess(['list', 'create', 'update', 'reorder', 'delete']);
// $this->crud->denyAccess(['list', 'create', 'update', 'reorder', 'delete']);
// ------ CRUD REORDER
// $this->crud->enableReorder('label_name', MAX_TREE_LEVEL);
// NOTE: you also need to do allow access to the right users: $this->crud->allowAccess('reorder');
// ------ CRUD DETAILS ROW
// $this->crud->enableDetailsRow();
// NOTE: you also need to do allow access to the right users: $this->crud->allowAccess('details_row');
// NOTE: you also need to do overwrite the showDetailsRow($id) method in your EntityCrudController to show whatever you'd like in the details row OR overwrite the views/backpack/crud/details_row.blade.php
// ------ REVISIONS
// You also need to use \Venturecraft\Revisionable\RevisionableTrait;
// Please check out: https://laravel-backpack.readme.io/docs/crud#revisions
// $this->crud->allowAccess('revisions');
// ------ AJAX TABLE VIEW
// Please note the drawbacks of this though:
// - 1-n and n-n columns are not searchable
// - date and datetime columns won't be sortable anymore
// $this->crud->enableAjaxTable();
// ------ DATATABLE EXPORT BUTTONS
// Show export to PDF, CSV, XLS and Print buttons on the table view.
// Does not work well with AJAX datatables.
// $this->crud->enableExportButtons();
// ------ ADVANCED QUERIES
// $this->crud->addClause('active');
// $this->crud->addClause('type', 'car');
// $this->crud->addClause('where', 'name', '==', 'car');
// $this->crud->addClause('whereName', 'car');
// $this->crud->addClause('whereHas', 'posts', function($query) {
// $query->activePosts();
// });
// $this->crud->addClause('withoutGlobalScopes');
// $this->crud->addClause('withoutGlobalScope', VisibleScope::class);
// $this->crud->with(); // eager load relationships
// $this->crud->orderBy();
// $this->crud->groupBy();
// $this->crud->limit();
}
public function store(StoreRequest $request)
{
// your additional operations before save here
$redirect_location = parent::storeCrud();
// your additional operations after save here
// use $this->data['entry'] or $this->crud->entry
return $redirect_location;
}
public function update(UpdateRequest $request)
{
// your additional operations before save here
$redirect_location = parent::updateCrud();
// your additional operations after save here
// use $this->data['entry'] or $this->crud->entry
return $redirect_location;
}
}
File newFile = new File("Users/username/Documents/testProject/test.txt");
非常相似。
此示例可以是包含标签的视图,也可以是在需要时将项目包装到新行的图例视图(如集合视图)。
在File newFile = new File("/Users/username/Documents/testProject/test.txt");
中,您不允许访问当前帧,因此需要具有preferredMaxLayoutWidth
等外部属性。但是手动设置这个是繁琐且容易出错的,而且UILabel没有必要(因为iOS 8 IIRC?)。
我可以在自定义UIView
子类中执行此操作,以便自动推断此属性的值(例如,通过检查约束或类似的东西)?