Tinkerwell Snippets

Tinkerwell Snippets

https://ift.tt/2wXK1N8

Get Tinkerwell

Please not that you need a valid Tinkerwell-License which you can get from the official Tinkerwell-Website.

Get Tinkerwell (This website is a community-project and is NOT affiliated with Tinkerwell at all)

programming

via Laravel News Links https://ift.tt/2dvygAJ

February 28, 2020 at 09:22AM

Balloon Mayhem

Balloon Mayhem

https://ift.tt/2TsrIXQ

Balloon Mayhem

Link

Perhaps it’s some deep-seated childhood disappointment, but there’s something about the sound of balloons popping that sets us on edge. But that’s all you’re gonna get in this video from performance artist Jan Hakon Erichsen, as he uses a variety of knife rigs to shamelessly destroy a bunch of the party inflatables.

fun

via The Awesomer https://theawesomer.com

February 28, 2020 at 09:30AM

Laravel Livewire CRUD tutorial

Laravel Livewire CRUD tutorial

https://ift.tt/3d6a4Cb

Laravel Livewire is a frontend framework package for Laravel Framework. With the help of Laravel Livewire, you can run php code like JavaScript! It’s really an interesting and magical frontend framework package for Laravel. If you are looking for a step by step CRUD (Create, Read, Update, Delete) tutorial on Laravel livewire then this is the post where I’ll show you a complete step by step Laravel Livewire CRUD operation. If you are very new to Laravel Livewire, I’ll recommend you to read about Larave Livewire post. At the end of this tutorial, we’ll archive this kind of functionality where we can insert, edit, delete record from a single view (SPA) with the help of Larave Livewire without any page refresh.

laravel-livewire-crud.png

Table of Contents

  • Define a route
  • Make a view for CRUD operation
  • Make a model
  • Install Laravel Livewire
  • Setup the layout file
  • Create a Laravel Livewire component php class
  • Create Laravel Livewire component views
  • Conclusion

 

Define a route

Define a route into route file for returning a view for our CRUD operation. Here we’ll define just one simple route for our entire CRUD operation and rest of things will handle the Laravel Livewire itself! It’s magic and amazing things! no routes for API and blah blah.

Route::view('contacts','admin.contacts');

 

Make a view for CRUD operation

Make view for CRUD operation inside views directory with the name contacts.blade.php . This view just for a wrapper for our Livewire CRUD component.

@extends('layouts.app')
 @section('content')
 <div class="container">
 <div class="row">
 <div class="col-md-6">
 @livewire('contact-component')
 </div>
 </div>
 </div>
 @endsection

Here you can see, this view contains nothing fancy. Here we just placed a livewire component which we’ll create later.

 

Make a model

Make a contact model for database operation of our CRUD app. Our table name is contacts with fields id, name, phone. Here timestamp is false because we are not included created_at and update_at fields in our table which are required by default for a Laravel model.

<?php namespace App;
 
 use Illuminate\Database\Eloquent\Model;
 
 class Contact extends Model
 
 {
 
 public $timestamps = false;
 
 protected $table = 'contacts';
 
 protected $fillable = ['name','phone'];
 
 }

 

Install Laravel Livewire

Install the Laravel Livewire package via composer command.

composer require livewire/livewire

 

Setup the layout file

Open the template layout file app.blade.php and put the Laravel Livewire style and script directive. add @livewireStyles before </head> and add @livewireScripts before </body> .

 

Create a Laravel Livewire component php class

We can make the Livewire component with the help of artisan command that provides the package but here we will create from scratch so that we can set up things that we are used to. To do that, create a Livewire directory inside app/Http directory and create a php class name with ContactComponent.php and put the code into it.

<?php
 
 namespace App\Http\Livewire;
 
 use Livewire\Component;
 use App\Contact;
 
 class ContactComponent extends Component
 {
 public $data, $name, $phone, $selected_id;
 public $updateMode = false;
 
 public function render()
 {
 $this->data = Contact::all();
 return view('livewire.contacts.component');
 }
 
 private function resetInput()
 {
 $this->name = null;
 $this->phone = null;
 }
 
 public function store()
 {
 $this->validate([
 'name' => 'required|min:5',
 'phone' => 'required'
 ]);
 
 Contact::create([
 'name' => $this->name,
 'phone' => $this->phone
 ]);
 
 $this->resetInput();
 }
 
 public function edit($id)
 {
 $record = Contact::findOrFail($id);
 
 $this->selected_id = $id;
 $this->name = $record->name;
 $this->phone = $record->phone;
 
 $this->updateMode = true;
 }
 
 public function update()
 {
 $this->validate([
 'selected_id' => 'required|numeric',
 'name' => 'required|min:5',
 'phone' => 'required'
 ]);
 
 if ($this->selected_id) {
 $record = Contact::find($this->selected_id);
 $record->update([
 'name' => $this->name,
 'phone' => $this->phone
 ]);
 
 $this->resetInput();
 $this->updateMode = false;
 }
 
 }
 
 public function destroy($id)
 {
 if ($id) {
 $record = Contact::where('id', $id);
 $record->delete();
 }
 }
 }

Look at the codes inside contact component class. Here we have done all the things that we have to do for CRUD operation. We have declared the public properties ( $data, $name, $phone, $selected_id, $updateMode ) which will be rendered into our component views. This component class do as like as a typical Laravel controller.

 

Create Laravel Livewire component views

Now create livewire/contacts directories inside views directory and make a file name with component.blade.php inside that.

views
 livewire
 contacts
 component.blade.php
 create.blade.php
 update.blade.php

Create component.blade.php view.

<div>
 <div class="title">Laravel - Livewire CRUD</div>
 
 @if (count($errors) > 0)
 <div class="alert alert-danger">
 <a href="#" class="close" data-dismiss="alert">&times;</a>
 <strong>Sorry!</strong> invalid input.<br><br>
 <ul style="list-style-type:none;">
 @foreach ($errors->all() as $error)
 <li></li>
 @endforeach
 </ul>
 </div>
 @endif
 
 
 @if($updateMode)
 @include('livewire.contacts.update')
 @else
 @include('livewire.contacts.create')
 @endif
 
 
 <table class="table table-bordered table-condensed">
 <tr>
 <td>ID</td>
 <td>NAME</td>
 <td>PHONE</td>
 <td>ACTION</td>
 </tr>
 
 @foreach($data as $row)
 <tr>
 <td></td>
 <td></td>
 <td></td>
 <td width="100">
 <button wire:click="edit()" class="btn btn-xs btn-warning">Edit</button>
 <button wire:click="destroy()" class="btn btn-xs btn-danger">Del</button>
 </td>
 </tr>
 @endforeach
 </table>
 
 </div> 

Create create.blade.php view.

<div class="panel panel-default">
 <div class="panel-heading">
 <h3 class="panel-title">New Contact</h3>
 </div>
 
 <div class="panel-body">
 <div class="form-inline">
 <div class="input-group">
 Name
 <input wire:model="name" type="text" class="form-control input-sm">
 </div>
 <div class="input-group">
 Phone
 <input wire:model="phone" type="text" class="form-control input-sm">
 </div>
 <div class="input-group">
 <br>
 <button wire:click="store()" class="btn btn-default">Save</button>
 </div>
 </div>
 </div>
 </div>

Create update.blade.php view.

<div class="panel panel-default">
 <div class="panel-heading">
 <h3 class="panel-title">Update Contact</h3>
 </div>
 
 <div class="panel-body">
 <div class="form-inline">
 <input type="hidden" wire:model="selected_id">
 <div class="input-group">
 Name
 <input wire:model="name" type="text" class="form-control input-sm">
 </div>
 <div class="input-group">
 Phone
 <input wire:model="phone" type="text" class="form-control input-sm">
 </div>
 <div class="input-group">
 <br>
 <button wire:click="update()" class="btn btn-default">Update</button>
 </div>
 </div>
 </div>
 
 </div>

our Laravel Livewire CRUD app is ready to use. Browse the example.com/contacts and test the CRUD operation by insert, editing and deleting the table records.

Conclusion

Laravel Livewire is really a magical frontend framework for Laravel. If you did all the steps correctly, I assure you that you will be impressed about Laravel livewire. Hope this step by step Laravel Livewire tutorial post will help you to make a simple CRUD application from scratch with Laravel Livewire. If it’s helpful to you then please share this post with others.

 

programming

via Laravel News Links https://ift.tt/2dvygAJ

February 27, 2020 at 09:44AM

DOJ Study Shows That A “Gun-Show Loophole” Doesn’t Exist

DOJ Study Shows That A “Gun-Show Loophole” Doesn’t Exist

https://ift.tt/2uAY4Yc

Official Communication by Marion P. Hammer
Unified Sportsmen of Florida Executive Director
NRA Past President

Handguns on Table
DOJ Study Shows That A “Gun-Show Loophole” Doesn’t Exist

Florida – -(AmmoLand.com)- It has now been over a year since the DOJ issued a press release and the Report on where criminals acquire their crime guns. Clearly, the Report did not fit the narrative that the media wanted to promote — or you would have read or heard about it sooner. It’s now time for you to see it, use it and share it with those who need to know the facts.

Be aware: the so-called “gun show loophole” is just another manufactured anti-gun fraud. There is NO GUN SHOW LOOPHOLE. PERIOD.

In 2016 The U.S. Department of Justice conducted a study of prison inmates. Included in that study was the collection of data to show where prisoners get the guns they used in the commission of crimes. The DOJ Press Release explains how the study was conducted. The Pie Chart of DOJ Data distills the information and makes the results more clear. The full DOJ Report gives more detail.

THE BOTTOM LINE:

Gun Shows accounted for 0.8% of firearms acquired by criminals, while Underground/Street purchases accounted for 43.2%

Simply put, LESS THAN 1% of crime guns were purchased at gun shows while almost half of all guns used in crimes were purchased illegally from the underground/street black market.

Click Here for the DOJ Press Release

BJS RELEASES SOURCE AND USE OF FIREARMS INVOLVED IN CRIMES: SURVEY OF PRISON INMATES, 2016

WASHINGTON — The Department of Justice’s Bureau of Justice Statistics today released Source and Use of Firearms Involved in Crimes: Survey of Prison Inmates, 2016, which presents statistics that describe firearm possession of state and federal prisoners who were serving a sentence in 2016. This report describes—

•Firearm possession during the crime for which prisoners were serving time and by type of offense
•How the firearm was used during the crime•Type of firearms possessed
•Methods, sources, and processes of obtaining firearms

Findings are based on BJS’s 2016 Survey of Prison Inmates (SPI), formerly known as the Survey of Inmates in State and Federal Correctional Facilities. The SPI self-reported data were collected through face-to-face interviews with a national sample of state and federal prisoners.

TITLE: Source and Use of Firearms Involved in Crimes: Survey of Prison Inmates, 2016 (NCJ 251776)

AUTHORS: Mariel Alper and Lauren Glaze

WHERE:www.bjs.gov

The Bureau of Justice Statistics of the U.S. Department of Justice is the principal federal agency responsible for collecting, analyzing and disseminating reliable statistics on crime and criminal justice in the United States. Jeffrey H. Anderson is the director. The Office of Justice Programs, led by Principal Deputy Assistant Attorney General Matt M. Dummermuth, provides federal leadership in developing the nation’s capacity to prevent and control crime, administer justice and assist victims. OJP has six bureaus and offices: the Bureau of Justice Assistance; the Bureau of Justice Statistics; the National Institute of Justice; the Office of Juvenile Justice and Delinquency Prevention; the Office for Victims of Crime; and the Office of Sex Offender Sentencing, Monitoring, Apprehending, Registering and Tracking. More information about OJP and its components can be found at www.ojp.gov.

Click Here for the Pie Chart of DOJ DATA

Click Here for the DOJ Report on Crime Guns

  • https://ift.tt/2TnNPyW
  • https://ift.tt/32vbMID
  • https://ift.tt/383txjc

Source and Use of Firearms Involved in Crimes: Survey of Prison Inmates, 2016


Unified Sportsmen of FloridaAbout Unified Sportsmen of Florida;

Unified Sportsmen of Florida was organized in 1976 for the purpose of protecting the firearms rights of all law-abiding firearms owners in Florida.

Contact:

Unified Sportsmen of Florida
110-A South Monroe Street
P.O.Box 1387
Tallahassee, Florida 32302
850-222-9518

The post DOJ Study Shows That A “Gun-Show Loophole” Doesn’t Exist appeared first on AmmoLand.com.

guns

via AmmoLand.com https://ift.tt/2okaFKE

February 26, 2020 at 10:34AM

Middleware-Based Authorization

Middleware-Based Authorization

https://ift.tt/2wbpMLi

If you’d prefer not to execute authorization from within your controller actions, you can instead handle it as a route-specific middleware. I’ll show you how in this episode.

Published on Feb 26th, 2020.

programming

via Laracasts https://ift.tt/1eZ1zac

February 26, 2020 at 01:20PM

Smithsonian Releases 2.8 Million Images And 3D Models Into The Public Domain

Smithsonian Releases 2.8 Million Images And 3D Models Into The Public Domain

https://ift.tt/381QbZi

Here’s some good news for a change. The Smithsonian has just announced Smithsonian Open Access, in which it has released 2.8 million high quality digital images and 3D models into the public domain under a CC0 public domain dedication.

With Smithsonian Open Access, we’re increasing the public’s ability to use millions of digital assets—2D and 3D images and data. Open Access items carry what’s called a CC0 designation. This means the Smithsonian dedicates the digital asset into the public domain, meaning it is free of copyright restrictions and you can use it for any purpose, free of charge, without further permission from the Smithsonian. As new images are digitized, if they are determined to be copyright-free, the Smithsonian will dedicate them as CC0 ongoing.

It appears the plan is to keep adding to the database. The FAQ suggests that it won’t just be images and 3D models, but also songs and data sets and much more. And they make it clear that anyone can and should make use of it, without needing to get any permission — even for commercial use (for some reason, some people still think public domain works can’t be used commercially, but that’s just wrong).

Since the Smithsonian’s founding in 1846, its mission has been clear: “the increase and diffusion of knowledge.” We want to empower people everywhere to participate in that mission with us in new and innovative ways for the 21st century.

Smithsonian Open Access invites you to discover a world where you can learn, research, explore, and create in ways you couldn’t before. By making our trusted collections easier to access and use, we hope to inspire people to build new knowledge to understand our world—past and present.

Another cool part of the project is that they’re asking volunteers to help transcribe various scans of books and documents as well to help make everything even more searchable.

There are a growing number of sources of public domain material out there, but having the Smithsonian join in with such a huge chunk of content is a really great sign. The bigger the public domain, the better, but for it to work to spur new creativity, it also needs to be easily accessible, and the Smithsonian is helping out with that in a big, big way.

Permalink | Comments | Email This Story

geeky

via Techdirt https://ift.tt/1n7Sa38

February 25, 2020 at 10:58PM

Short URL v2.0.0 Released! – Add short URLs to your web app

Short URL v2.0.0 Released! – Add short URLs to your web app

https://ift.tt/2xBnFkK

Short URL v2.0.0

New Features

Added referer URL tracking options (#26)

There is now a new tracking option for the short URLs that allows you to track the referer URL of the visitor. For example, if the short URL is placed on a web page with URL “` https://ift.tt/2UeanlN “`, that URL will be recorded if the referer URL tracking is enabled.

If you want to override the default config option of whether if referer URL tracking is enabled or not when creating a shortened URL, you can use the ->trackRefererURL() method.

The example below shows how to enable referer URL tracking for the URL and override the default config variable:

$builder = new \AshAllenDesign\ShortURL\Classes\Builder();  $shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackRefererURL()->make();

Added device type tracking options (#27)

There is now a new tracking option for the short URLs that allows you to track the device type of the visitor. There are four possibilities of device type: “` mobile “`, “` desktop “`, “` tablet “`, “` robot “`. This can be particularly useful for analytical purposes.

If you want to override the default config option of whether if device type tracking is enabled or not when creating a shortened URL, you can use the ->trackDeviceType() method.

The example below shows how to enable device type tracking for the URL and override the default config variable:

$builder = new \AshAllenDesign\ShortURL\Classes\Builder();  $shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackDeviceType()->make();

Added functionality to set the tracking options for individual short URLs (#29)

Up until now, the tracking options were set in the config and affected all new and existing short URLs. In this release, the tracking options in the config are now used for defining the defaults. These values can now be overridden when creating your short URLs.

Updating the tracking options in the config now won’t affect the new short URLs that are created.

The example below shows how to enable IP address tracking for the URL and override the default config variable:

$builder = new \AshAllenDesign\ShortURL\Classes\Builder();  $shortURLObject = $builder->destinationUrl('https://destination.com')->trackVisits()->trackIPAddress()->make();

Learn more about setting the tracking options in the README.

Added functionality to set the redirect status code for individual short URLs (#25)

Up until now, all short URLs have redirected (if using the package’s provided controller) with a 301 HTTP status code. But, this can now be overridden when building the shortened URL using the “` ->redirectStatusCode() “` method.

The example below shows how to create a shortened URL with a redirect HTTP status code of 302:

$builder = new \AshAllenDesign\ShortURL\Classes\Builder();  $shortURLObject = $builder->destinationUrl('http://destination.com')->redirectStatusCode(302)->make();

Added a ShortURLVisited event (#24)

Each time a short URL is visited, the following event is fired that can be listened on:

AshAllenDesign\ShortURL\Events\ShortURLVisited 

This is useful for if you want to trigger some code via listeners whenever a short URL is visited without needing to override the package’s provided controller.

Added trackingEnabled() helper method (#30)

To check if tracking is enabled for a short URL, you can use the ->trackingEnabled() method. It will return true if tracking is enabled, and false if not.

The following example shows how to check if a short URL has tracking enabled:

$shortURL = \AshAllenDesign\ShortURL\Models\ShortURL::first(); $shortURL->trackingEnabled();

Added trackingFields() helper method (#30)

To check which fields are enabled for tracking for a short URL, you can use the ->trackingFields() method. It will return an array with the names of each field that is currently enabled for tracking.

The following example shows how to get an array of all tracking-enabled fields for a short URL:

$shortURL = \AshAllenDesign\ShortURL\Models\ShortURL::first(); $shortURL->trackingFields();

programming

via Laravel News Links https://ift.tt/2dvygAJ

February 25, 2020 at 09:25AM

Bowling Ball Trick Shots

Bowling Ball Trick Shots

https://ift.tt/2SVDCdU

Bowling Ball Trick Shots

Link

Skateboarding site The Berrics dusted off and remastered this classic clip of trick shot master Billy Marks tossing around a bowling ball in a skate park. He might only knock down one pin at a time, but he does it with so much style and grace.

fun

via The Awesomer https://theawesomer.com

February 25, 2020 at 11:00AM

Limit Access to Authorized Users

Limit Access to Authorized Users

https://ift.tt/390vTAQ

For any typical web application, some actions should be limited to authorized users. Perhaps only the creator of a conversation may select which reply best answered their question. If this is the case, we’ll need to write the necessary authorization logic. I’ll show you how in this lesson!

Published on Feb 24th, 2020.

programming

via Laracasts https://ift.tt/1eZ1zac

February 24, 2020 at 04:06PM