I have finally released the newest version of my Laravel Boilerplate project which was a ground-up rebuild and took nearly 4 months to complete.
I realize there are plenty of boilerplate projects available now since I first launched this 5 years ago, but I tried to design this one to be easy to understand and come with a ton of features most of us would use out of the box, and tried to trim the fat on the features that were more uncommon and easy to add ourselves.
Along with this project, I was tired of using jQuery datatables, and couldn’t find a Vue.js datatables plugin I liked, so I decided to make a lite version myself in Livewire. So included in this package is Laravel Livewire Tables (v1.0 coming soon) which took a couple of months to build in itself.
The project is labeled as a template on Github which makes it super easy for you to make your own project from.
Some of the core out of the box features you’ll get with BP7 are:
On the frontend:
User Dashboards
User Account Management
Two Factor Authentication
Social Logins
reCAPTCHA
On the backend:
Dashboard
User Management
Role Management
User Impersonation
Change Passwords
Activate/Deactivate
Clear Sessions
Globally:
Full Language Support with JSON files and 20+ languages built-in
Frontend/Backend architecture
Wildcard roles/permissions
Timezone Support
Demo Mode
Activity Log
Announcements (Globally, Frontend, Or Backend)
Different User Types, Roles, and Permissions specific to a user type.
Breadcrumbs
Password History
Password Expiration
Tests
Clean Controllers/Services/Form Requests/etc.
And many, many, more things you’ll just have to find when you try it.
‘Monument Valley’ studio reveals ‘Alba: a Wildlife Adventure’
https://ift.tt/2CPBgaP
Ustwo Games is ready to reveal its next project. The independent studio, best known for the M. C. Escher-inspired Monument Valley puzzlers, is hard at work on a nature-focused title called Alba: a Wildlife Adventure. An ever-so-brief teaser trailer starts with a panning shot over a water bottle, half-eaten sandwich, notebook and backpack. The virtual camera then passes over a sheet of paper titled ‘Island clean up Initiative,’ a bird-spotting book and DSLR, some photographs and, finally, a newspaper with the headline ‘Girls start a wildlife league.’ Finally, it pans out to reveal the titular character on a cliff, overlooking a colorful forest and beach.
In a brief press release, the team said the game was "inspired by the team’s love of nature" and "fond memories of childhood summers in the Mediterranean." For now, the studio is staying hush-hush about the gameplay and larger story. It did reveal, however, that the title will be coming to iOS, MacOS, tvOS, PC and consoles (no word on which) this winter. The game follows the Facebook-exclusive Go Go Bots, as well as Assemble With Care — a gorgeous Apple Arcade original that has since been released on Steam and updated with a free epilogue level — and Land’s End, an immersive adventure built for Gear VR and Oculus Go headsets.
What Happened When Microsoft Analyzed Its Own Remote Work Patterns?
https://ift.tt/3jmZppR
Harvard Business Review just published a new analysis by the director of Microsoft’s Workplace Analytics team, a director on Microsoft’s workplace intelligence team, and the editor of Microsoft Workplace Insights. "Four months ago we realized that our company, like so many others, was undergoing an immediate and unplanned shift to remote work…" "So, we launched an experiment to measure how the work patterns across our group were changing, using Workplace Analytics, which measures everyday work in Microsoft 365, and anonymous sentiment surveys…"
[O]ur research revealed that workdays were lengthening — people were "on" four more hours a week, on average. Our survey shed light on one possible explanation: Employees said they were carving out pockets of personal time to care for children, grab some fresh air or exercise, and walk the dog. To accommodate these breaks, people were likely signing into work earlier and signing off later… One data point stunned us: the rise of the 30-minute meeting… We had 22% more meetings of 30 minutes or less and 11% fewer meetings of more than one hour. This was surprising. In recent decades meetings have generally gotten longer, and research shows it has had a negative effect on employee productivity and happiness. Our flip to shorter meetings had come about organically, not from any management mandate. And according to our sentiment survey, the change was appreciated. Suddenly the specter of an hour-long meeting seemed to demand more scrutiny. (Does it really need to be that long? Is this a wise use of everyone’s time?) This is one of the many ways that the remote-work period could have a long-term impact… Our colleagues in China, who have already moved large parts of their workforces back to the office, are seeing that some of the habits that emerged during remote work, such as more reliance on instant messaging and longer workweeks, have continued even after the return.
Other interesting observations:
"Employees who had well-protected weekends suddenly have blurrier work-life boundaries. The 10% of employees who previously had the least weekend collaboration — less than 10 minutes — saw that amount triple within a month."
"Responding to the lack of natural touchpoints — grabbing lunch in the cafeteria, popping by someone’s desk — employees found new ones. In our group, these ranged from group lunches to happy hours with themes such as ‘pajama day’ and ‘meet my pet.’ Overall, social meetings went up 10% in a month."
"Multitasking during meetings didn’t spike even though people weren’t in the same room…"
You’ve spent countless hours at the range sharpening your foundation skills and gaining speed and accuracy.
Classes? You have so many class hours under your gun belt you flat-out cannot fit more into your schedule.
Hold up, though.
Are you a parent? Do you know how to defend not only yourself but your kids?
As parents who are gun owners, we’re responsible for more than just teaching our kids the four golden rules of gun safety. We’re responsible for teaching our kids and ourselves what to do in case of a threat to our lives–a threat to their lives–and as with all firearms skills, those aren’t thing you learn in real-time.
You must train.
Read on for some tips and training ideas for armed parents (and guardians) who will likely have their children around if a self-defense scenario presents itself.
Table of Contents
Loading…
Safety First
Yes, safety needs to be mentioned. Whether you use the NRA’s Eddie Eagle or some other training tool to assist you in teaching your kids about firearms safety, get on it. It is your responsibility to teach your kids to be safe around firearms (and while shooting).
So, four golden rules, as per usual:
All guns are always loaded.
Never let the muzzle cover anything which you are not willing to destroy.
Keep your finger off the trigger until your sights are on the target.
Always be sure of your target (and what is beyond it).
It doesn’t matter if your kid is four years old or seventeen years old–yeah, I have that full spectrum going on here–they should be safe around guns. All kids are different, meaning there is no one-size-fits-all age for adhering to safety rules and safe gun handling.
You’ll have to deduce for yourself when your child is capable of consistently following directions then teach and supervise accordingly. Ignorance is never an excuse.
The vast majority of what we learn in defensive handgun classes revolves around protecting ourselves. Yes, there are classes for couples and teams but those tend to be the exception rather than the rule.
As for classes geared specifically for parents, well, those are truly rare. They do exist–check out The Armed Parent/Guardian taught by Melody Lauer and John Johnston–but they’re hard to find.
There’s a trend in the world of female gun owners you’ll see time and again: women have an overwhelming tendency to finally carry a gun to protect not themselves but their children. And while there is nothing wrong with that it does mean a lot of women don’t seem to understand the importance of defending their own lives.
It’s like the oxygen mask demos they give on airplanes instructing you to place your own mask before putting a mask on your child. You are no good to your child if you’re dead, so you’d better be able to defend yourself. That brings us to our first point.
Protect Yourself
Before you can protect your child you need to be capable of defending yourself. If your entire focus is on using yourself as some sort of human shield or physical barrier, you’re doing it wrong.
Get a gun. Train with the gun. Carry the gun.
Know how to use your gun to defend your own life which will, in turn, enable you to defend your child. Before you train to defend your child, train to defend yourself.
You need those foundation skills in place before moving on to more advanced work. I’ve said it before but it bears repeating: you are no good to your child if you are dead. Learn to stay alive.
Sacrificial lambs make lousy protectors because when you’re gone, you’re gone and they are on their own. Your life has enormous value, so act like it. Planning to throw yourself on a proverbial grenade is not a smart way to protect your kids.
Do It One-Handed
Shooting one-handed is an oft-neglected skill in the gun world. You need to be spending more time firing one-handed–and that’s with your strong and support hands–and drawing one-handed, too.
This means learning to cross-draw your firearm with your support hand without muzzling innocent bystanders or fumbling the draw. Not only is this a valuable skill to master in case you have a child holding onto your hand but it is important because your strong hand might be pinned, injured, or otherwise unusable.
Get your one-handed skills on point!
A few tips for shooting one-handed. When gripping the gun with just one hand you’re going to automatically assume a thumbs-down grip. You’ll have far more control with your thumb angled down in a closer approximation of a fist.
Grip tightly; the last thing you need when shooting with one hand is to lose control over the firearm.
Aim the toes of your shooting-side foot toward your target. Blade your body behind whichever hand is holding the gun with the arm holding the gun fully extended. Your unused hand can be curled into a fist, bent at the elbow, and tucked into our body with your shoulder pulled back away from the target.
But if you have a child holding onto that so-called unused hand, dynamics change. More on that later. Learn to shoot accurately with one hand on your own before introducing other factors.
Lean into your target aggressively. Whether you leave your gun aligned in the traditional upright fashion or utilize the McMillian Tilt by canting the gun slightly inward is up to you and your needs.
The McMillan Tilt tends to work well for cross-dominant shooters and may improve your accuracy with one hand but not the other. Find out what works for you.
Consider Carry Positions
There are various schools of thought regarding where on your body to carry a gun when you have kids.
As a fan of AIWB (Appendix Inside the Waistband), I do tend to think it’s great when dealing with kids. In fact, I originally began carrying AIWB years ago because of my then-toddler daughter. If you’re going to be hoisting a child onto your hip the last thing you want to do is literally seat them on the grip of your gun.
Small of Back carry is a less-than-stellar plan since it not only slows your draw time but makes it much more difficult to draw without risking muzzling someone (like your child). You can certainly carry strong-side hip around the 3 o’clock position, and a lot of parents do, but you need to be aware of the pros and cons.
Having kids can and will influence how you carry your gun, as well it should.
Be realistic. Train using your carry gun and its associated holster and belt.
This is a great time to mention holsters. I’d like to believe none of you are using floppy nylon holsters or unsafe wrap-style “holsters.”
It is always important to use a quality holster and with kids it becomes paramount. Your holster must protect the trigger guard, provide secure retention, keep your gun precisely placed at all times, and have a mouth that stays open after the draw for holstering.
Pair your quality holster with a good gun belt for maximum success. Yes, your belt matters.
There is no valid reason to fail to carry a tourniquet. If you’re carrying a tool designed to make holes you should be carrying one to deal with the after-effects of holes being made.
That is not to say you should be administering aid to your assailant–that would be a totally separate article–but to say you need to be able to save lives. Get a tourniquet and learn how to use it.
The CAT and SOFTT-W are great designs to carry. For small children, the RATS can work well but it is not recommended for adults.
Have a proper tourniquet, please. If you use it and still need more, learn how to effectively improvise, but do not make half-ass measures your go-to. You’re a parent and a gun owner so I would like to assume you’re a responsible adult… right?
The age of your kids matters a lot for this one as does their individual comprehension.
When my daughter was little it was a simple enough thing to teach her not to hold my strong hand. I’m right-handed which meant I actively taught her to walk on my left-hand side and not to grab for my strong hand if something scary happened.
She knew not to crowd my gun side, crush it against my body, or otherwise hinder my ability to protect us both.
If you’re thinking you’re just going to frighten your kids by having such a frank discussion with them, well, all kids are different. It is up to you to figure out how much information and responsibility your kids can handle, when.
However, I will say it is far wiser to begin approaching these topics at a young age than it is to keep them in a protective, naïve bubble because you “don’t want to upset them.” Would you rather an attacker upset them for you? Don’t you think it is smarter to take this on in stages as they mature?
If your child is holding your hand (hopefully, your support-side hand), neither of you will be served well by allowing them to flop or hang from your hand.
Just as you hold your gun tightly when shooting one-handed you should be holding your child’s hand with a steel grip, preferably pinning them in place. They shouldn’t be swinging back and forth; your arm should be rigidly in place and pinning their hand or arm in place.
This is a technique you can practice with an adult friend on their knees beside you (encourage them to pull like a child might). Knowing how to stiff-arm a child away and slightly behind you is a good skill to have in your toolbox.
Of course, if you have an infant you’re going to have a choice to make. Do you hold them against your body as you shoot one-handed and hope for the best or do you attempt to rapidly put them down, typically be slipping them down the side of your body and leg?
This is a situational issue and one you should plan for in advance using the usual mental formula: if A then B, if X then Y. Plan ahead and practice with appropriately weighted dolls.
Remember, you don’t want to slam an infant’s head into the ground or put them at risk of being trampled. A very young baby you’re most likely going to want to keep against your body. Instances where it’ll be a good idea to put a baby on the ground are going to be few and far between.
What if you have multiple kids? This is a tough one.
Typically the older kids are going to have more responsibilities than the little ones.
If you have two kids and the age gap is, say, 18 months apart you don’t have a lot to work with when they’re small. Considering telling them to get behind you? Okay, that’s all well and good until you need to take a step backward in a rush and end up falling down and knocking them over in the process.
When your child is old enough to do so safely and effectively, teach them to get out rather than hiding behind you.
If you have an ambulatory, grade-school age child and also an infant you’re going to need to plan accordingly, meaning that older child either needs to understand how to get away and out or needs to be capable of staying behind you without grabbing either of your hands or tripping you.
Fights are Fluid
No two assaults look the same. You cannot plan out how a fight for your life will play out.
All you can do is train and prepare as much as possible and try to plan for every eventuality. Your fight will be fluid. That means we cannot tell you to do one specific thing with your child because the situation may evolve in such a way that the one specific thing is A Bad Idea.
This is also why you need to teach your kids to take self-defense and self-preservation into their own hands at a young age. Being taken by surprise is never good and the sooner you give your kids the tools to defend their own lives, the better.
Speed Counts
It is your job to stop the threat as quickly as possible. This is where your usual defensive handgun training comes in. The faster you stop the threat, the quicker your kids will be safe.
Shoot until the threat stops. Sounds easy, right?
It’s at least a simple concept to comprehend but if your attention is divided by a screaming toddler or hyperventilating junior higher things get sticky in a hurry. Understand that your top priority is to stop the threat.
That means being familiar with shot placement–for example, not all headshots are created equal–and on-the-spot decision-making. Your training must be up to the task.
Communication
Your kids should not only listen to you but do as you say without question. They must get down or back without argument. And they absolutely must understand that if and when you draw your firearm, you mean business.
The appearance of your gun is not a fun time or panic central, it’s time to take the situation seriously. This means you’re going to have to work with and teach your children.
Understanding Fear
I’m an overthinker. Throw me into any scenario and I guarantee I’ll come up with the most obscure, unlikely possibilities ever to the point you’re going to look at me like I’ve grown a second head.
There are pros to that kind of thought process, though: I am far less likely to be taken by surprise and tend to be pretty chill about things, at least as far as you can tell from the outside. It’s worth noting I did not come to this place overnight.
Today’s heightened awareness comes courtesy of being attacked and having an ex that wanted my daughter and me dead. And now, years later, I find myself responsible for bonus kids and approaching self-defense much differently than I did over a decade ago.
When it comes right down to it you don’t know how you’re going to react during a threat to your life and the lives of your children until it happens.
The best way to learn to handle the adrenaline dump and the need to make decisions fast is through training. Running scenarios in a shoot house or at the range is an excellent way to learn how to make snap decisions if you’re attacked and also gives you a chance to experience the effects of adrenaline.
Think you can’t get stressed in a controlled environment? Oh, but you can. Go take an advanced defensive handgun or active killer interdiction class and get back to me.
Hunters also have an edge here because we have experienced adrenaline time and again as well as having learned to breathe through it and make a clean shot.
Does that mean hunting is the perfect way to prepare for self-defense? Of course not, but it does give you an edge and I’ll take every scrap of control and power I can when it comes time to fight for the lives of my kids.
I want every possible advantage. I want an unfair fight, one where I’m the one given the so-called unfair advantage over my attacker.
Conclusion
Don’t be a martyr, be a fighter. Be a protector. Get yourself properly trained and have a plan–have lots of different plans–to defend your life and the lives of your kids.
Have you taken a self-defense class aimed at parents or guardians? Have you talked with your kids about self-defense? You also should check out our Best Concealed Carry Guns in Popular Calibers.Plus our review on USCCA, our go-to provider of concealed carry insurance because you never know!
Despite state legislation to monitor court sentencing data and race statistics, Ohio’s courts have not been collecting or sharing information vital to keep the courts and the public informed about judicial activity.
That’s what judges, including two from the state’s highest court, said about a new sentencing database they say will help keep judges honest about reasons for sentencing, and level the playing field for defendants.
In a public forum hosted by the Ohio Metropolitan Bar Association Consortium, Ohio Supreme Court Chief Justice Maureen O’Connor said the database that has been a dream for nearly three decades needs to happen.
“The establishment and the widespread use of databases that are truly useful for the fair and equitable administration of justice continues to elude us,” O’Connor said. “The efforts so far could easily be called haphazard.”
O’Connor said the lack of action isn’t just at the level of the courts, but in all aspects of the judicial system, all the way from law enforcement and prosecutors to judges.
“I believe that this situation should be an embarrassment to all of us,” O’Connor said. “I know I’m embarrassed about it.”
Ohio’s sentencing and criminal justice data is disparate and only focuses on a few outcomes, such as prison time. Sara Andrews, director of the Ohio Criminal Sentencing Commission, said what little current data there is misses other punishments like probation and community service, other outcomes post-trial.
“(What is needed) is a felony sentencing database that can and will enhance public confidence (and) trust in the system by making information accessible, consumable and reportable,” Andrews said.
Currently, Andrews said the major source of aggregate data is prison population.
“Knowing more about the people who don’t go to prison is essential to inform public policy,” Andrews said.
The process of creating a database to keep track of sentencing statistics, such as felony charges, race of the defendant and specific sentence information, was supposed to be enacted starting in 1996.
In July of that year, the 121st Ohio General Assembly passed Senate Bill 2, in which the legislature requested the Ohio Supreme Court require each common pleas court within the state maintain information about every felony case in a publicly accessible file.
“That has not been done,” O’Connor said.
A few years later, a state commission on racial fairness recommended that statistical data “as to race” be maintained. O’Connor said no action was taken on that recommendation either.
Judges are given a large amount of discretion when it comes to sentencing, as several of the judges in the public forum said should be the case. But publicizing those decisions is important to keep those judges accountable to those they serve and maintaining consistency in sentences for similar crimes.
“Public confidence is diminished when our citizens believe…that the outcomes of the criminal justice system don’t arise from necessarily the application of the rule of law,” state Supreme Court Justice Michael P. Donnelly said. “But, rather the impression that the outcome of your criminal case … is largely dependent on the judge that is assigned to your case at the arraignment room.”
Not only does the public need to know how their courts are working, but policy makers need the information provided from a universal database to make sure the current laws are working, or change the laws that need revision, said Judge Ray Headen, of the Eighth District Court of Appeals.
Judge Gene Zmuda, of the Sixth District Court of Appeals said the social unrest being exhibited throughout the country should be viewed as a motivation to make these databases a priority, so that those seeing the racial disparities in the justice system see a system trying to change its ways.
O’Connor said she plans to use the last two years of her term to make the database and monitoring a priority.
“This is the time to do something, I think the political will is present at this time, the momentum is present, and we are going to do something on this,” O’Connor said.
This article was republished with permission from Ohio Capital Journal. For more in Ohio political news, visit www.ohiocapitaljournal.com.
The Ohio Capital Journal is a hard-hitting, independent, nonprofit news organization dedicated to connecting Ohioans to their state government and its impact on their lives. The Capital Journal combines Ohio state government coverage with relentless investigative journalism, deep dives into the consequences of policy, political insight and principled commentary.
non critical
via ColumbusUnderground.com https://ift.tt/2oIG6w2
/** * This defines the start of the query, usually Model::query() but can also eagar load relationships and counts. */publicfunction query() : Builder;
/** * This defines the columns of the table, they don't necessarily have to map to columns on the table. */publicfunction columns() : array;
Rendering the Table
Place the following where you want the table to appear.
Laravel 6.x:
@livewire('users-table')
Laravel 7.x:
<livewire:users-table />
Obviously replace users-table with your component name.
Defining Columns
You can define the columns of your table with the column class:
Column::make('Name', 'column_name')
The first parameter is the name of the table header. The second parameter is the name of the table column. You can leave blank and the lowercase snake_case version will be used by default.
Here are a list of the column method you can chain to build your columns:
/** * This column is searchable, with no callback it will search the column by name or by the supplied relationship, using a callback overrides the default searching functionality. */publicfunction searchable(callable$callable = null) : self;
/** * This column is sortable, with no callback it will sort the column by name and sort order defined on the components $sortDirection variable */publicfunction sortable(callable$callable = null) : self;
/** * The columns output will be put through {!! !!} instead of . */publicfunction unescaped() : self;
/** * The columns output will be put through the Laravel HtmlString class. */publicfunction html() : self;
/** * This column will not look on the table for the column name, it will look on the model for the given attribute. Useful for custom attributes like getFullNameAttribute: Column::make('Full Name', 'full_name')->customAttribute() */publicfunction customAttribute() : self;
/** * This view will be used for the column, can still be used with sortable and searchable. */publicfunction view($view, $viewModelName = 'model') : self;
Properties
You can override any of these in your table component:
Table
Property
Default
Usage
$tableHeaderEnabled
true
Whether or not to display the table header
$tableFooterEnabled
false
Whether or not to display the table footer
$tableClass
table table-striped
The class to set on the table
$tableHeaderClass
none
The class to set on the thead of the table
$tableFooterClass
none
The class to set on the tfoot of the table
$responsive
table-responsive
Tables wrapping div class
Searching
Property
Default
Usage
$searchEnabled
true
Whether or not searching is enabled
$searchDebounce
350
Amount of time in ms to wait to send the search query and refresh the table
$disableSearchOnLoading
true
Whether or not to disable the search bar when it is searching/loading new data
$search
none
The initial search string
$searchLabel
Search…
The placeholder for the search box
$noResultsMessage
There are no results to display for this query.
The message to display when there are no results
Sorting
Property
Default
Usage
$sortField
id
The initial field to be sorting by
$sortDirection
asc
The initial direction to sort
Pagination
Property
Default
Usage
$paginationEnabled
true
Enables or disables pagination as a whole
$perPageEnabled
true
Displays per page
$perPageOptions
[10, 25, 50]
The options to limit the amount of results per page
$perPage
25
Amount of items to show per page
$perPageLabel
Per Page
The label for the per page filter
Loading
Property
Default
Usage
$loadingIndicator
false
Whether or not to show a loading indicator when searching
$loadingMessage
Loading…
The loading message that gets displayed
Offline
Property
Default
Usage
$offlineIndicator
true
Whether or not to display an offline message when there is no connection
$offlineMessage
You are not currently connected to the internet.
The message to display when offline
Checkboxes
Property
Default
Usage
$checkbox
false
Whether or not checkboxes are enabled
$checkboxLocation
left
The side to put the checkboxes on
$checkboxAttribute
id
The model attribute to bind to the checkbox array
$checkboxAll
false
Whether or not all checkboxes are currently selected
$checkboxValues
[]
The currently selected values of the checkboxes
Other
Property
Default
Usage
$wrapperClass
none
The classes applied to the wrapper div
$refresh
false
Whether or not to refresh the table at a certain interval. false = off, If it’s an integer it will be treated as milliseconds (2000 = refresh every 2 seconds), If it’s a string it will call that function every 5 seconds.
Table Methods
/** * Used to set a class on a table header based on the column attribute */publicfunction setTableHeadClass($attribute) : ?string;
/** * Used to set a ID on a table header based on the column attribute */publicfunction setTableHeadId($attribute) : ?string;
/** * Used to set any attributes on a table header based on the column attribute * ['name' => 'my-custom-name', 'data-key' => 'my-custom-key'] */publicfunction setTableHeadAttributes($attribute) : array;
/** * Used to set a class on a table row * You have the entre model of the row to work with */publicfunction setTableRowClass($model) : ?string;
/** * Used to set a ID on a table row * You have the entre model of the row to work with */publicfunction setTableRowId($model) : ?string;
/** * Used to set any attribute on a table row * You have the entre model of the row to work with * ['name' => 'my-custom-name', 'data-key' => 'my-custom-key'] */publicfunction setTableRowAttributes($model) : array;
/** * Used to set the class of a table cell based on the column and the value of the cell */publicfunction setTableDataClass($attribute, $value) : ?string;
/** * Used to set the ID of a table cell based on the column and the value of the cell */publicfunction setTableDataId($attribute, $value) : ?string;
/** * Used to set any attributes of a table cell based on the column and the value of the cell * ['name' => 'my-custom-name', 'data-key' => 'my-custom-key'] */publicfunction setTableDataAttributes($attribute, $value) : array;
Components
Along with being able to provide a view to a column, you can use pre-defined components that are built into the package. These are good for when you want to add actions to a column.
Note: By design using the components() method on a column will disable all other functionality (i.e. searching/sorting etc.).
If you would like to hide all the components for a given row, you may pass a callback as the second parameter of the components() method:
Column::make('Actions')
->components([
Link::make('Edit'),
Link::make('Delete'),
], function($model) {
// Hide the actions for model id 1return$model->id === 1;
})
Note: You should still assert on the backend that these functions can not be performed on this entity.
Building on that, if you would like to pass a custom message to that column when hiding the components for this row, you may pass another callback as the third parameter:
Column::make('Actions')
->components([
Link::make('Edit'),
Link::make('Delete'),
], function($model) {
// Hide the actions for model id 1return$model->id === 1;
}, function($model) {
return__('You can not alter role ' . $model->name . '.');
})
Methods
Of course two links that don’t do anything would be useless, here are a list of methods to be used for the built in components.
Inherited by all components
Method
Usage
setAttribute($attribute, $value)
Set an attribute on the component
setAttributes(array $attributes = [])
Set multiple attributes at once
getAttributes()
Get the array of available attributes
setOption($option, $value)
Set an option on the component
setOptions(array $options = [])
Set multiple options at once
getOptions()
Get the array of available options
hideIf($condition)
Hide this component if true
hide()
Hide this component forever
isHidden()
This component is currently hidden
By default, all components have access to the $attributes and $options arrays.
Link Component
Method
Usage
Type
text($text)
Set the text of the link
string/false
class($class)
Set the html class on the link
string
id($id)
Set the id of the link
string
icon($icon)
Set the icon of the link (font awesome)
string
href(function($model){})
Set the href of the link
string/callback
view($view)
The view to render for the component
string
Button Component
Method
Usage
Type
text($text)
Set the text of the button
string/false
class($class)
Set the html class on the button
string
id($id)
Set the id of the button
string
icon($icon)
Set the icon of the button (font awesome)
string
view($view)
The view to render for the component
string
Example
This example comes from the upcoming release of my popular Laravel Boilerplate Project. Here we render the roles table in the admin panel.
This example uses searching, sorting, relationships, custom attributes, counted relationships, and components:
publicfunctioncolumns() : array {
return [
Column::make('Name')
->searchable()
->sortable(),
Column::make('Permissions', 'permissions_label')
->customAttribute()
->html()
->searchable(function($builder, $term) {
return$builder->orWhereHas('permissions', function($query) use($term) {
return$query->where('name', 'like', '%'.$term.'%');
});
}),
Column::make('Number of Users', 'users_count')
->sortable(),
Column::make('Actions')
->components([
Link::make('Edit') // Optionally pass false to hide the text
->icon('fas fa-pencil-alt')
->class('btn btn-primary btn-sm')
->href(function($model) {
returnroute('admin.auth.role.edit', $model->id);
})
->hideIf(auth()->user()->cannot('access.roles.edit')),
Link::make('Delete')
->icon('fas fa-trash')
->class('btn btn-danger btn-sm')
->setAttribute('data-method', 'delete') // Javascript takes over and injects a hidden form
->href(function($model) {
returnroute('admin.auth.role.destroy', $model->id);
})
->hideIf(auth()->user()->cannot('access.roles.delete')),
], function($model) {
// Hide components for this row if..return$model->id === config('access.roles.admin');
}),
];
}
Inspiration From:
Changelog
Please see CHANGELOG for more information what has changed recently.
Wokeness is a cancer, it takes only a few woke cells can kill and entire body.
https://ift.tt/30gESdR
Bari Weiss resigned from The New York Times. She leans Left, but I respected her honesty. As a last act, she decided to toss a firebomb of a resignation behind her accusing the NTY of everything from being a hostile work environment, to anti-Semitism, to being cowards in the face of a tiny woke mob.
Taking out a wasp or hornet nest requires courage, precision, and speed—and a product that can do its job while keeping you as safe as possible. For that, you’ll need a can (or two, just to be sure) of a pyrethroid insecticide. Terro Wasp & Hornet Killer is a great place to start.
technology
via Wirecutter: Reviews for the Real World https://ift.tt/36ATBn1
Up until now, the values defined in the short-url.php config file were always validated. However, this sometimes caused issues if the application’s config was cached before running composer require. A new config variable has been added which can now be used to toggle whether if the validation should be run. By default, the validation is now disabled.
To enable the validation, you can add the following line to your short-url.php config file:
The ShortURLBuilder facade was deprecated in v3.0.0 to fit more with the Laravel naming conventions and standards. As of Short URL, v4.0.0 the ShortURLBuilder facade has now been removed in favour of a newer ShortURL facade.