Introducing Filament v3.2

https://picperf.io/https://laravelnews.s3.amazonaws.com/featured-images/Filament_3.2_Social_Image_1.png

Introducing Filament v3.2

We’re only 15 days into January, and Filament v3.2 has already launched! This release is packed with a bunch of really exciting updates, so let’s dive right in and take a look!

As always, if you prefer to read about the changes directly on Github, check out the v3.2 changelog here.

CSV/Excel Export Action

A screenshot of the list of potential columns to be exported

In Filament v3.1, we introduced the ability to import large amounts of data using a CSV. Since then, one of our most commonly requested features has been to add the exact opposite feature–exports! Now, in v3.2, a prebuilt ExportAction has been added to do just that.

Using a very similar API to the Import feature added in v3.1, developers can create Exporters that tell Filament how to export a given set of data.

Within the context of an Exporter, developers can define which columns should be included from the data, how they should be labeled, and even tweak the data itself that should be displayed in each table cell. Additionally, just like with Importers, Exporters can handle displaying data from related models via ExportColumn objects. At the most simple, they can be configured to display data from related models (the name of the User who wrote a Post object), but ExportColumns can even go so far as to aggregate relationships and output data based on the existence of a relationship.

This all just scratches the surface, so make sure to check out the official Export Action documentation on the Filament website for more details!

Clusters

A screenshot of the main sidebar and sub-navigation for a Products cluster

Clusters are one of the most exciting additions to Filament in v3.2! Building on the sub-navigation feature added in v3.1, clusters are a hierarchical structure within Filament panels that allow developers to group resources and custom pages together. To give a less abstract definition, clusters help to quickly and easily group multiple pages across your Filament panel together, bundling them into a single entry in your main Filament sidebar.

Creating and using clusters is incredibly simple and can be set up in a few easy steps:

  1. Use the discoverClusters() method in the Panel configuration file to tell Filament where to find your Cluster classes
  2. Run php artisan make:filament-cluster YourClusterName to have Filament set up a new Cluster class
  3. Add the protected static ?string $cluster = YourClusterName::class property to any resource or page class you want within a given cluster

Once you have completed these three steps, you’ll see your cluster appear on the main sidebar. And when clicked, Filament will open to a page with sub-navigation containing all resources and pages you gave the $cluster property.

This unlocks an incredible amount of flexibility and customizability when building panels in Filament. For more details on clusters and how best to use them, check out the documentation:

Deferred Table Filters

A screenshot of the deferred table filters UI

One of the most important features of the Filament tables package is the ability to quickly and easily create filters for the table data. In the past, whenever one of these filters was interacted with on the front-end, it would immediately fire off a request for new, filtered data. A lot of times, this was perfectly fine and users wouldn’t notice much of a delay (if any). However, there are certain occasions where interacting with a filter would cause a noticeable delay in the interface due to heavy queries, immense datasets, etc.

Now, in v3.2, table filters can now be deferred! When a table’s filters are deferred, the user can click around and toggle as many filters as they desire, but the actual query only gets run when the user clicks “Apply”. Enabling deferred filters for a table is as simple as adding one line of code to the $table object: ->deferFilters().

For more information on deferring table filters, take a look at the documentation:

Unsaved Changes Alerts

We’ve all been there. We’ve all been 90% of the way through a long and complex form when we accidentally navigate away from the page, wiping out all of our hard work. Well, thanks to the v3.2 release, this will no longer be a problem for Filament panels!

By chaining the unsavedChangesAlerts() method onto a $panel configuration object, Filament will automatically send an alert to users who try to navigate away from any given page without saving their in-progress changes. As you’d expect, these alerts are enabled for “Create” and “Edit” pages, but they are also enabled for any open action modals as well!

For more details on these alerts, see the following section of the panel configuration documentation:

ToggleButtons Component

A screenshot of the new ToggleButtons component

Filament v3.2 includes a new form component called ToggleButtons. ToggleButtons act as an alternative to the Select, Radio, and CheckboxList components by presenting a new UI for the same sort of functionality. ToggleButtons appear as a grouping of Filament buttons that the user can select one or more of, similarly to how a user would select one or more results from any of the alternative components listed above. As with all of Filament’s UI components, ToggleButtons have plenty of options when it comes to customizing their look and feel, so there should be a solution for every occasion.

Give them a try and let us know what you think!

For more information on ToggleButtons, check out the new dedicated documentation page:

Grouped Table Column Headers

A screenshot of a table with columns grouped with the new grouped table column headers

Sometimes, data that is contained within our models and database tables is connected in the business logic, but not in the actual data model itself. This is typically the case with loose groupings; for example, both a status and a is_featured column on a Post model may affect the overall “Visibility” of the Post. Previously, there was no good way in Filament to convey to the user that these two properties were related other than placing them next to each other in the table. However, that all changes with v3.2.

Now, with the same ease with which a developer would add a new column to a Filament table, they can also add column groups to bind columns together in the UI. For example, in our example earlier, status and is_featured are both grouped under the umbrella of “Visibility”. So, instead of just placing those two columns side-by-side and hoping that the association is picked up on by the user, we can wrap them in a ColumnGroup and let Filament display the association directly in the table.

The code for those columns would go from this:

TextColumn::make('status'),
IconColumn::make('is_featured'),

to this:

ColumnGroup::make('Visibility', [
TextColumn::make('status'),
IconColumn::make('is_featured'),
])

It’s that simple!

To learn more about grouping columns and the other ways you adjust the ColumnGroup object, take a look at the documentation linked below:

Revealable Password Fields

A screenshot showing the different states of the revealable password fields

This is a seemingly small update that has been asked for time and time again, so we’re very happy to bring revealable password fields to Filament v3.2!

This does exactly what it says on the tin. Now, by chaining the revealable() method onto your password field declaration, Filament will add a toggle button to the end of the TextInput field that will show/hide the password characters. No more having to hope that the characters behind the masked dots in the input are the ones that you intended to type! Just click and reveal your "password123" password in all its plain-text glory!

KeyValueEntry Infolist Component

A screenshot of the two-column table rendered by the new KeyValueEntry component

In v3.2, a new Infolist component has been added called the KeyValueEntry. KeyValueEntry components simply display a list of key-value pairs in a nicely formatted two-column table. This list of key-value pairs can be rendered from either a one-dimensional JSON object or a PHP array, which makes this entry exceptionally flexible to meet many use-cases.

The KeyValueEntry component also pairs very well with the existing KeyValueField in the Filament form builder!

For more information, check out the documentation:

Split Form Layout Component

A screenshot showing a two-column Split layout where the sidebar is only taking up as much width as its content needs

The Split form layout is another highly-requested feature that we’ve added into v3.2! Until now, form layouts were fairly strictly confined to using a grid with N number of columns. With the Split layout, however, forms can be built with flexibility in mind!

Split, unlike the Grid layout, will allow you to define your layouts with flexbox. This allows for form sections to grow and shrink as the content requires without needing to worry about the content clipping if the section is not wide enough.

One very common use-case for Split so far is to handle sidebars. Often, forms will have one main section that takes up the majority of the page’s horizontal space and will have another sidebar section for metadata, settings, etc. Using the Split layout, we can set the sidebar section to shrink to only take up as much width as the section contents require, allowing our main section to take up as much space as is available!

There are a lot of different uses for the Split component, so take a look at the documentation to see where you might be able to implement it in your app!

Enum Descriptions

This is a simple, but very handy quality-of-life change! Now, in v3.2, Filament offers a HasDescription interface that allows enums to have a textual description displayed in the UI, usually under the label. Similarly to the HasLabel interface, HasDescription will require developers to implement the getDescription() method on the given enum, returning the desired description string for each enum case.

For code examples and specific instructions, see our documentation here:

Sidebar Centering UI Tweaks

Last, but certainly not least, now, when you have a scrolling sidebar in your Filament panel, the active item will always attempt to remain as close to the vertical center of the window as possible when navigating between pages! Hopefully, this will further enhance the user experience, since your users won’t have to hunt around for the currently-active page!

Thank You!

As always, we could not have done this without the incredible Filament community! All of you are so crucial to the work that we do, and we are so thankful for the contributions, discussions, and ideas that each of you gives day in and day out in our Discord and on Twitter.

We’re so excited to finally have released v3.2 for all of you to use. Let us know what you think, we’d love to hear it!

Until next release!


The post Introducing Filament v3.2 appeared first on Laravel News.

Join the Laravel Newsletter to get all the latest Laravel articles like this directly in your inbox.

Laravel News

Creating a Laravel Excel Export with Dropdowns

Exporting data to an Excel file is a common requirement in many applications. Laravel Excel provides a straightforward way to generate Excel files with data from your application. In this guide, we’ll walk through the process of creating an Excel export file using Laravel Excel and including dropdowns with predefined options.

In this blog I’ll create an Excel file export, because I want to let the user define the relations already. The Excel export which can later be imported back in the Laravel app will contain the dropdown containing the name of the relations.

Setting Up Laravel Excel and the Export Class

To get started, make sure you have Laravel installed along with the Laravel Excel package. Next, create an export class (ItemExport in this case) that implements the necessary interfaces (FromCollection, WithHeadings, and WithEvents).



namespace App\Exports;

use App\Models\Supplier;
use Maatwebsite\Excel\Concerns\Exportable;


class ItemExport implements FromCollection, WithHeadings, WithEvents
{
    use Exportable;

    protected $selects;
    protected $rowCount;
    protected $columnCount;

    public function __construct()
    {
        
        $suppliers = Supplier::orderBy('name')->pluck('name')->toArray();

        
        $selects = [
            ['columns_name' => 'A', 'options' => $suppliers], 
        ];

        $this->selects = $selects;
        $this->rowCount = count($suppliers) + 1;
        $this->columnCount = 11; 
    }
}

Adding Dropdowns to Excel File

In the ItemExport class, the registerEvents() method is used to define the behavior after the Excel sheet is created. Inside this method, we’ll set up dropdowns for specified columns.

public function registerEvents(): array
{
    return [
        AfterSheet::class => function (AfterSheet $event) {
            $row_count = $this->rowCount;
            $column_count = $this->columnCount;

            $hiddenSheet = $event->sheet->getDelegate()->getParent()->createSheet();
            $hiddenSheet->setTitle('Hidden');
            $hiddenSheet->setSheetState(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN);

            foreach ($this->selects as $select) {
                $drop_column = $select['columns_name'];
                $options = $select['options'];

                
                foreach ($options as $index => $option) {
                    $cellCoordinate = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex(1) . ($index + 1);
                    $hiddenSheet->setCellValue($cellCoordinate, $option);
                }

                
                $validation = $event->sheet->getCell("{$drop_column}2")->getDataValidation();
                $validation->setType(\PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST);
                $validation->setShowDropDown(true);
                $validation->setFormula1('Hidden!$A$1:$A$' . count($options));

                
                for ($i = 3; $i <= $row_count; $i++) {
                    $event->sheet->getCell("{$drop_column}{$i}")->setDataValidation(clone $validation);
                }

                
                for ($i = 1; $i <= $column_count; $i++) {
                    $column = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($i);
                    $event->sheet->getColumnDimension($column)->setAutoSize(true);
                }
            }
        },
    ];
}

Usage and Output

To use the ItemExport class, instantiate it and export the data.

use App\Exports\ItemExport;
use Maatwebsite\Excel\Facades\Excel;


public function export()
{
    return Excel::download(new ItemExport(), 'exported_data.xlsx');
}

When executed, this will generate an Excel file (exported_data.xlsx) with the specified columns and dropdowns in the designated columns (A in this example), containing the predefined options.

Feel free to adjust the column names, options, and other configurations according to your specific use case.

Laravel News Links

Real Python: Using Python for Data Analysis

https://files.realpython.com/media/ie-data-analysis-workflowv3.bfb835b95c5e.png

Data analysis is a broad term that covers a wide range of techniques that enable you to reveal any insights and relationships that may exist within raw data. As you might expect, Python lends itself readily to data analysis. Once Python has analyzed your data, you can then use your findings to make good business decisions, improve procedures, and even make informed predictions based on what you’ve discovered.

In this tutorial, you’ll:

  • Understand the need for a sound data analysis workflow
  • Understand the different stages of a data analysis workflow
  • Learn how you can use Python for data analysis

Before you start, you should familiarize yourself with Jupyter Notebook, a popular tool for data analysis. Alternatively, JupyterLab will give you an enhanced notebook experience. You might also like to learn how a pandas DataFrame stores its data. Knowing the difference between a DataFrame and a pandas Series will also prove useful.

Get Your Code: Click here to download the free data files and sample code for your mission into data analysis with Python.

In this tutorial, you’ll use a file named james_bond_data.csv. This is a doctored version of the free James Bond Movie Dataset. The james_bond_data.csv file contains a subset of the original data with some of the records altered to make them suitable for this tutorial. You’ll find it in the downloadable materials. Once you have your data file, you’re ready to begin your first mission into data analysis.

Understanding the Need for a Data Analysis Workflow

Data analysis is a very popular field and can involve performing many different tasks of varying complexity. Which specific analysis steps you perform will depend on which dataset you’re analyzing and what information you hope to glean. To overcome these scope and complexity issues, you need to take a strategic approach when performing your analysis. This is where a data analysis workflow can help you.

A data analysis workflow is a process that provides a set of steps for your analysis team to follow when analyzing data. The implementation of each of these steps will vary depending on the nature of your analysis, but following an agreed-upon workflow allows everyone involved to know what needs to happen and to see how the project is progressing.

Using a workflow also helps futureproof your analysis methodology. By following the defined set of steps, your efforts become systematic, which minimizes the possibility that you’ll make mistakes or miss something. Furthermore, when you carefully document your work, you can reapply your procedures against future data as it becomes available. Data analysis workflows therefore also provide repeatability and scalability.

There’s no single data workflow process that suits every analysis, nor is there universal terminology for the procedures used within it. To provide a structure for the rest of this tutorial, the diagram below illustrates the stages that you’ll commonly find in most workflows:

diagram of a data analysis workflow with iterationsA Data Analysis Workflow

The solid arrows show the standard data analysis workflow that you’ll work through to learn what happens at each stage. The dashed arrows indicate where you may need to carry out some of the individual steps several times depending upon the success of your analysis. Indeed, you may even have to repeat the entire process should your first analysis reveal something interesting that demands further attention.

Now that you have an understanding of the need for a data analysis workflow, you’ll work through its steps and perform an analysis of movie data. The movies that you’ll analyze all relate to the British secret agent Bond … James Bond.

Setting Your Objectives

The very first workflow step in data analysis is to carefully but clearly define your objectives. It’s vitally important for you and your analysis team to be clear on what exactly you’re all trying to achieve. This step doesn’t involve any programming but is every bit as important because, without an understanding of where you want to go, you’re unlikely to ever get there.

The objectives of your data analysis will vary depending on what you’re analyzing. Your team leader may want to know why a new product hasn’t sold, or perhaps your government wants information about a clinical test of a new medical drug. You may even be asked to make investment recommendations based on the past results of a particular financial instrument. Regardless, you must still be clear on your objectives. These define your scope.

In this tutorial, you’ll gain experience in data analysis by having some fun with the James Bond movie dataset mentioned earlier. What are your objectives? Now pay attention, 007:

  • Is there any relationship between the Rotten Tomatoes ratings and those from IMDb?
  • Are there any insights to be gleaned from analyzing the lengths of the movies?
  • Is there a relationship between the number of enemies James Bond has killed and the user ratings of the movie in which they were killed?

Now that you’ve been briefed on your mission, it’s time to get out into the field and see what intelligence you can uncover.

Acquiring Your Data

Once you’ve established your objectives, your next step is to think about what data you’ll need to achieve them. Hopefully, this data will be readily available, but you may have to work hard to get it. You may need to extract it from the data storage systems within an organization or collect survey data. Regardless, you’ll somehow need to get the data.

In this case, you’re in luck. When your bosses briefed you on your objectives, they also gave you the data in the james_bond_data.csv file. You must now spend some time becoming familiar with what you have in front of you. During the briefing, you made some notes on the content of this file:

Heading Meaning
Release The release date of the movie
Movie The title of the movie
Bond The actor playing the title role
Bond_Car_MFG The manufacturer of James Bond’s car
US_Gross The movie’s gross US earnings
World_Gross The movie’s gross worldwide earnings
Budget ($ 000s) The movie’s budget, in thousands of US dollars
Film_Length The running time of the movie
Avg_User_IMDB The average user rating from IMDb
Avg_User_Rtn_Tom The average user rating from Rotten Tomatoes
Martinis The number of martinis that Bond drank in the movie

As you can see, you have quite a variety of data. You won’t need all of it to meet your objectives, but you can think more about this later. For now, you’ll concentrate on getting the data out of the file and into Python for cleansing and analysis.

Read the full article at https://realpython.com/python-for-data-analysis/ »


[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]

Planet Python

Step by Step: Building A Precision AR-15 Upper Receiver

https://www.thefirearmblog.com/blog/wp-content/uploads/2023/12/00-FEATURED-3-180×180.jpg

Step by Step: Building A Precision AR-15 Upper From PartsJust as it is with power tools, each type of firearm has its own purpose. With the modularity of platforms like the AR-15, one type of gun can be configured in many different ways, covering different kinds of tasks. In my personal collection, I have a shorty AR for close range, a standard 16” do-it-all […]

Read More …

The post Step by Step: Building A Precision AR-15 Upper Receiver appeared first on The Firearm Blog.

The Firearm Blog

Boker Wiener Warrior Kalashnikov Knife

https://theawesomer.com/photos/2024/01/boker_wiener_hot_dog_knife_t.jpg

Boker Wiener Warrior Kalashnikov Knife

 | Buy

This tasty knife from Boker looks like a hot dog. Its wiener-shaped red blade has a squiggle of mustard, while its aluminum handle cradles the dog like a golden-brown bun. It features Kalashnikov’s push-button automatic mechanism, a button lock, and a ketchup-colored pocket clip – a BladeHQ exclusive and part of the unique Warrior Buffet collection.

The Awesomer

David Lynch’s Lost Dune 2 Script Has Been Found

https://i.kinja-img.com/image/upload/c_fill,h_675,pg_1,q_80,w_1200/1819fc12e0867c8f7c11daf5cc425139.jpg

We’re all ready to see just what Denis Villeneuve and his crew do with Dune: Part Two in a few months, but what if nearly four decades ago we’d had a chance to get a sequel to compare it to? David Lynch’s planned script for a sequel to his wild 1984 movie has been missing for years, but now, an unfinished draft has been found.

Spoilers of the Week April 24-29

Over at Wired, Max Evry—author of A Masterpiece in Disarray: David Lynch’s Dune—An Oral Historyhas revealed details from an unfinished draft of Lynch’s Dune sequel, Dune Messiah, discovered last year in archives at California State University, Fullerton. There’s a ton of fascinating details in there, like how Lynch’s script opened with a notably new set of scenes compared to Herbert’s novel—picking up in the aftermath of the Harkonnen’s attack on Arrakeen that saw Duncan Idaho (Richard Jordan) killed in action.

Lynch’s Messiah would’ve revealed that Leonardo Cimino’s mysterious doctor from the first film was actually a major figure from Herbert’s novels: Scytale, a “face-dancer” of the sinister genetically enhanced beings known as the Bene Tleilax. Scytale takes Idaho’s body amid the chaos of the assault on Arrakeen, and what follows in Lynch’s script is a suitably Lynchian exploration of Scytale resurrecting Idaho as the clone “Ghola” Hayt, a surrealist trip into the Bene Tleilax’s homeworld that would’ve opened the film:

Scytale’s friends are laughing and wildly rolling marbles under their hands as they watch Scytale sing through eighteen mouths in eighteen heads strung together with flesh that is like a flabby hose. The heads are singing all over the pink room. One man opens his mouth and a swarm of tiny people stream out singing accompaniment to Scytale. Another man releases a floating dog which explodes in mid-air causing everyone to get small and lost in the fibers of the beautiful carpet. Though small they all continue to laugh, a laughter which is now extremely high in pitch. Scytale (now with only one head) crawls up a wall laughing hysterically.

There’s a lot more over at Wired, including how Lynch would’ve set the stages for the various political machinations surrounding Paul, now Maud’Dib, and his rule of Arrakis, and how the draft cuts off almost right as Lynch would’ve had to start exploring just how his sequel would’ve framed Paul’s ascension to power. It’s a fascinating insight into what could’ve been—and although Lynch himself, declining to speak about the script’s finding, cites his work on Dune as “a failure in his eyes, and not a particular time that he likes to think of or talk about” to Wired—it holds up a very compelling alternate mirror as to what we’re going to see when Dune: Part Two finally hits theaters on March 1.


Want more io9 news? Check out when to expect the latest Marvel, Star Wars, and Star Trek releases, what’s next for the DC Universe on film and TV, and everything you need to know about the future of Doctor Who.

Gizmodo

The Most Prolific Guns Ever Made, By The Numbers

https://www.alloutdoor.com/wp-content/uploads/2024/01/HK-G3.jpg

The Small Arms Survey estimates that, as of 2018, there are over one billion guns in circulation. A significant majority – around 85% – rest in the hands of the civilians, leaving about 133 million to military stores and 23 million for law enforcement agencies. That ten-digit figure grew by around 200 million in just a single decade, and the number in 2024 is likely to be even higher. After all, more than 7 million Americans became gun owners during the Pandemic alone. But which of those billion guns is the most popular or prolific guns in circulation? Many of the firearms contributing to that striking figure are archaic: World War and conflict relics, many of which were manufactured decades ago. Here are the top ten most prolific guns ever made, by the numbers. You have any preemptive guesses to what are the most prolific guns in history?…

Gun Coverage on AllOutdoor

#10 – Prolific Guns – Heckler & Koch G3

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: ~7.8 million
  • First Manufactured: 1959
  • Country: Germany
  • Caliber: 7.62×51 NATO

Sharing a contended title with the FN FAL as the “most successful battle rifle ever made,” the Heckler & Koch-produced G3 has seen service with over 70 countries’ militaries, with at least 15 of those nations manufacturing the rifle under license. The G3 remained the official rifle of the German armed forces until it was replaced by the G36 in the 90s. Some may claim the G3 is not deserving of this spot: They say other guns, like Russia’s Makarov, Japan’s Arisakas, Israel’s Uzis, and America’s M1 Garand were produced in greater numbers. But the production estimates of those and other guns that might fit here are poorly recorded, with figures attributed to secondhand accounts or otherwise lacking manufacturers’ citations. The Germans, however, are quite good at keeping numbers. Per a report from the Armament Research Services (ARES) in 2015, Heckler & Koch affirmed production of the G3 exceeds 7.8 million units; this is often rounded up to 8 million. The G3 is still produced, too, ensuring that – if it hadn’t already – it will exceed production numbers of those contested guns.

#9 – Prolific Guns – Marlin Model 60

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: ~11 million
  • First Manufactured: 1960
  • Country: U.S.
  • Caliber: .22 LR

If you’re an American who grew up in the 20th century, chances are high your first experience with a firearm involved shooting at cans with some .22 LR fired from a Marlin Model 60. Based on the defunct Marin Model 99, designed by Marlin engineer Ewald Nichol in 1959, the Model 60 became the most successful rimfire rifle ever sold to the American public, with approximately 11 million units sold – a figured collated by Walt Kuleck and Scott A. duff, author and publisher of of The Ruger 10/22 Complete Owner’s and Assembly Guide, respectively.

Its bull barrel contained a then-new “Micro Groove” technology introduced by Marlin a few years earlier. This rifling used 16 shallower lands and grooves – as opposed to the typical 5 deep grooves in competing barrels – to provide stabilization of the round while imparting less deformation upon it, resulting in greater accuracy. Coupled with factory taps for bolt-on scopes, the Marlin 60 became a top choice for varmint hunters. Although its manufacture ceased in 2020, the Model 60’s production numbers still eclipse that of its modern replacement, the Ruger 10/22.

#8 – Prolific Guns – Remington 870

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: 11+ million
  • First Manufactured: 1951
  • Country: U.S.
  • Caliber: Varies

The Model 870, produced by Remington and favored as the pump shotgun of choice by militaries and police departments globally, was made to replace the expensive and handcrafted Remington Model 31, designed by John Moses Browning in 1931. The Model 31 was produced to compete with the Winchester Model 1912 which was, at the time, the most popular shotgun sold on the civilian market. The M12 designation also served as a trench gun for the U.S Army, Navy, and Marine Corps in World Wars I and II.

After its debut in 1951, the Model 870 quickly became a commercial success and sold more than two million units by 1973, eclipsing all sales of the Model 31. A decade later, the Model 870 became the most sold shotgun in history, reaching 3 million units. The 870’s popularity again surged in 1996 with the introduction of its Express variant, an economy model that brought total sales up to 7 million units. Just over a decade later – on April 13, 2009 – Remington celebrated production of the ten millionth 870. With at least twelve factory variants available – and dozens more retailer-built configurations dotting store and digital shelves – for applications ranging from competition and self-defense to hunting, law enforcement, maritime and military use, the Remington 870 remains an affordable, utterly reliable everyman’s gun that can satisfy just about every shooting niche.

#7 – Prolific Guns – Mossberg 500

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: 12+ million
  • First Manufactured: 1961
  • Country: U.S.
  • Caliber: Varies

Trailing its direct competitor by a decade, the Mossberg 500 is to the Remington 870 what Coke is to Pepsi, or Ford to Chevy: A nearly identical peer in form and function, commanding as much popularity and proliferation as its counterpart – a statement certain to sound reductive and which will certainly rustle the feathers of staunch fans of either camp. But it’s true. The Mossberg 500 is, like the Model 870, one of the most popular shotguns ever produced, with O.F. Mossberg & Son declaring over 12 million variants have rolled off its factory floors. Though lighter and cheaper than its competitor – the 500 uses an aluminum receiver and some more plastic bits than the 870 – it is practically indecipherable from Remington’s gun at a glance, and police and military rely on the Mossberg as much as the Remington.

But unlike its peer, the Mossberg was made initially for military use only. It wasn’t until 1987 – 26 years after its initial manufacture – that Mossberg sold the 500 to the public and instead designed a newer variant, the M590, as the gun for uniformed use (though the 500 continued military service, too, as the M500). The 590A1 became the standard-issue shotgun for the United States Military and saw its first combat use in the 1991 Gulf War.

#6 – Prolific Guns – SKS

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: ~15 million
  • First Manufactured: 1945
  • Country: USSR
  • Caliber: 7.62x39mm

With an estimation of 15 million units produced – per data collated by Janes author and firearm historian Ian Hogg – The Samozaryadny Karabin sistemy Simonova, or SKS, became the most widely produced semiautomatic battle rifle, perhaps ever. Designed between 1941 and 1944 and first manufactured in 1945, the SKS was the Soviets’ answer to the Germans’ G43 and the Americans’ M1 rifles. Mechanically, the SKS was immediately inferior to those rifles and to its own Soviet counterpart, the SVT-40. While other semiautomatic battle rifles had detachable magazines, the SKS relied on an integral box magazine fed by stripped clips, limiting its reload speed and capping capacity at just 10 rounds. Some variants of the SKS also lacked a detention spring on the firing pin. The pin was instead allow to float inside the bolt – meaning that a forceful drop could slam the pin into the primer on a loaded round, allowing for potential slam fires.

The SKS was also rendered obsolete by its own nation with the production of the AK-47 just a decade later. But in spite of its limitations (and its short life in the limelight before being overshadowed by the AK-47) its simple, cheap design made it a favorable weapon for licensed production in China and dozens of other countries in the mid-20th century. Between 1988 and 1993, millions of Chinese and Russian SKS rifles were imported to the U.S. At publication, they’re still readily available on the secondhand market for between $600 and $2500, depending on condition and rarity.

#5 – Prolific Guns – Lee-Enfield

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: ~17 million
  • First Manufactured: 1895
  • Country: Britain
  • Caliber: .303 British

One of the first repeating rifles to use smokeless powder, the Lee-Enfield was Britain’s response to the Germans’ then-new Gewehr 88, a bolt-action rifle that also relied on smokeless powder and smaller 8mm rounds to obtain higher velocity and accuracy. A direct descendant of the Lee-Metford rifle, the Lee-Enfield’s new cartridge and detachable, 10-round box magazine provided British troops with significant advantages over opposing forces, many of which still relied on rifles fed by integrated magazines with lower capacities. The Lee-Enfield’s high capacity and reliability made it capable of providing some of the fastest rates of fire possible with a bolt action. Though citations are questionable, anecdotes from World War One include reports from German soldiers who claim they thought they’d encountered machine gunfire, when they had merely been fired upon by groups of British marksmen using Lee-Enfield rifles. The Lee-Enfield remained in service with the British military until the 1990s, when the sniper variant (the L42A1) was retired. But the rifle remains in service with some militaries and law enforcement organizations today – including the Bangladesh Police – making it one of the longest-serving rifles in existence.

#4 – Prolific Guns – AR-15/M4/M16 (and GLOCK)

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: ~20 million
  • First Manufactured: 1959 (AR-15), 1982 (GLOCK)
  • Country: U.S. (AR-15), Austria (GLOCK)
  • Caliber: Varies (both)

The AR-15

Two of the most popular modern firearms ever made share the next spot on this list. With over 20 million units sold, the AR-15 and GLOCK – and their endless variants – tie for the 4th most widely produced gun(s) in history. Originally developed by Eugene Stoner for ArmaLite in 1956, the AR-15 would first serve as an automatic rifle issued to U.S service members in the Vietnam War. ArmaLite sold the design to Colt in 1959; shortly after, the rifle would receive the M16 designation and be fielded by troops in 1963. Colt later introduced the semiautomatic variant of the M16 for civilian purchase, retaining the AR-15 namesake.

when Colt’s patent on the design expired in the 1970s, other manufacturers began producing AR-15 rifles. The rifle enjoyed widespread adoption and favorable review for its lightweight profile, simplicity, and good accuracy with little recoil thanks to its small, fast 5.56 NATO and .223 Remington loads. But the AR-15 would only become a rifle with a nearly occult following after it was thrust into the political theater. When the Assault Weapon Ban of 1994 expired in 2004, sales of the AR-15 exploded – as did the political commentary surrounding its legality and civilian ownership.

The GLOCK

Designed by Gaston Glock in Austria, the GLOCK handgun is, today, the most popular handgun manufactured and solid. The GLOCK was designed for the Austrian forces, earning its first contracts for military and police service in 1982 after becoming the favorite in field testing. The GLOCK beat competing designs from five manufacturers: H&K’s P7M and P9S; Sig’s P220 and P226; Beretta’s 92SB-F; an FN prototype based on the Browning Hi-Power; and the Steyr GB. Notably, Gaston Glock had no experience as a weapon designer. He was only an expert on synthetic polymers, but endeavored to use the material to produce a lightweight alternative to the steel and aluminum frames all handguns then relied upon. Glock assembled a team of firearm experts to compile the most desirable characteristics of a combat pistol to develop his first handgun. Friedrich Dechant, former Head of the Austrian Armaments and Defence Technology Agency, remarked on observing the GLOCK’s clear superiority over competing pistols. Today, GLOCK produces over 50 pistols of varying sizes and calibers, and it remains in service with thousands of police and military organizations globally.

#3 – Prolific Guns – Mosin-Nagant Rifle

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: ~37 million
  • First Manufactured: 1891
  • Country: Russia
  • Caliber: 7.62x54R

Holding the title as the longest-serving military rifle in existence, the Mosin-Nagant is one of the most recognizable bolt actions ever made. For collectors, the Mosin is usually the first “old war” gun to purchase. Just a decade ago, one could attend any public gun show and find the ever-present crates of Mosin rifles filled with M91/30s and M44s for less than $100 a piece. The Mosin-Nagant was designed to replace the Soviet empire’s aging stock of single-shot rifles, which contributed to heavy losses at the hands of the Ottoman Empire, whose troops were equipped with Winchester repeating rifles. In response, the Russian Ministry of Defense procured and tested the Lebel Model 1886, a French bolt action rifle, to spur development of what was officially called the 3-line rifle, M1891; the “3-line” refers to the Soviet rifle’s .30 caliber round. The Mosin also introduced the 7.62x54R cartridge, a round that became one of the most prolific machine gun cartridges ever fielded.

Although early Mosin rifles were finicky and suffered poor quality control, the M1891/30 – the “91/30” commonly available for sale on civilian marketplaces today – modernized the original design to improve feeding and disassembly. Since its widespread use by the Soviets in World Wars I and II, the Mosin-Nagant and its variants have traveled the globe, been used in more conflicts than any other bolt-action rifle – including present conflicts in the Middle East – and seen adoption by more than 40 countries.

#2 – Prolific Guns – Mauser 98

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: ~100 million
  • First Manufactured: 1898
  • Country: Germany
  • Caliber: M/88, 7.92x57mm

In spite of its relatively short lifespan – the rifle and its variants were only produced in large numbers between 1895 and 1945 – the Mauser Gewehr 98 (including rifles like the Karabiner 98k) remains the second most produced firearm in existence, with estimates placing total production north of 100 million guns. After initial delivery in 1898, the Mauser 98 saw immediate action during the Boxer Rebellion in the hands of German troops at Peking. By World War I, Germany had already produced nearly 2.3 million rifles; it would make an additional 7 million before the war ended. Originally chambered in M/88 – a long defunct, early smokeless cartridge – the Mauser 98 adopted the now infamous 7.92x57mm in 1903, commonly called 8mm Mauser.

The Mauser 98 also introduced the controlled feed method of cycling: the base of the shell casing is gripped by the bolt’s extractor claw before it’s stripped from the magazine and chambered; prior bolt action rifles relied on a simpler and less reliable “push feed” system, which relied on simple inertia and blunt contact to drive rounds into the chamber via the bolt face. The controlled feed system is relied upon to this day by all modern firearms that use conventional bolts and bolt carriers, and is regarded by many as one of the most important developments in modern rifle design. Although manufacture of the original 98 rifle ceased with Germany’s demise at the end of World War II, the rifle’s popularity spurred Mauser Jagdwaffen GmbH to resume production of 98 actions and rifles for civilian use in 1999. Modern iterations of the Mauser M98 are considered top-shelf safari guns, with big game models chambered in .30-06, .375, and .416 demanding $13,000 USD or more at retail.

#1 – Prolific Guns – AK-47

The Top 10 Most Prolific Guns Ever Made, By The Numbers

  • Number Produced: ~150 million
  • First Manufactured: 1948
  • Country: USSR
  • Caliber: 7.62x39mm

The Avtomat Kalashnikova needs no introduction. You’re probably not even surprised it’s number one. It is, after all, the single-most recognizable firearm ever made and, arguably, a creation that has defined humanity and influenced modern life as much as the automobile, airplane, and the internet. Conservative estimates place historical production figures of the AK-47 at a “measly” 75 million. But with licensed manufacturing and cloning of the most famous rifle spanning dozens of countries for decades, the figure is likely closer to 150 million.

If current production of modern variants like the Yugoslavian M70, American PSAK-47, Romanian WASR-10, and the Kalashnikov-licensed KR-103 (alongside other endless makes) are considered as part of the tally, the number of AK-47s roaming the planet is likely to climb in perpetuity. Even if the AK-47 were to disappear from all civilian markets, it would remain the most prolific firearm ever, as it continues to be the standard infantry rifle for 106 nations’ militaries. Speaking of AKs – Palmetto’s PSAK-47s ditch the archaic 7.62×39 in favor of decidedly superior cartridges, like 6.5 Grendel and 300 Blackout. Check ’em out here.

The post The Most Prolific Guns Ever Made, By The Numbers appeared first on AllOutdoor.com.

AllOutdoor.com

How To Build A Tire Hammer

http://blademag.com/wp-content/uploads/Tire-Hammer-Clutch.jpg

How To Build A Tire Hammer
The author’s power hammer uses a tire and a drive wheel. Stepping on the treadle lifts the drive wheel into the tire, engaging the hammer. This is similar to the Clay Spencer tire clutch but in a different configuration. The author added some 3/8-inch plate to the tire rim for weight, and added several attachment points so the stroke can be adjusted.

A clutch player in the knifemaker’s shop, the tire hammer gives more control than other D.I.Y. power hammers.

Like a variable-speed hand drill, your backyard power hammer should be able to run slowly, at full speed or in between, depending on the task. The simplest way to guarantee it does this is to use a slipping clutch.

There are two main designs of slipping clutch. One uses a slack belt, a flywheel and pulleys. The drive pulley rotates within a slack belt. The foot pedal linkage pushes an idler wheel into the slack belt, increasing the belt tension to the point that the belt begins to turn the pulley on the flywheel.

spring-arm-to-pitman attachment
The author modified the spring-arm-to-pitman attachment to make it adjustable. Depending on which attachment point is used, the leverage of the stroke changes.

Another design uses a tire clutch, where the foot pedal linkage pushes a drive wheel into an automobile tire, with the hub of the tire serving as the flywheel. The most common “tire hammer” design uses a similar clutch but turned the other way and connected to a linkage. Your available parts will dictate your design. 

Why A Clutch

A function of the clutch is to reduce the RPM of the motor speed to get the hammer rate of beats per minute (BPM) into a safe and useful range. You want the hammer rate to generally end up between 150 and 250 BPM, though many variables change with each hammer. In general, a heavier tup (aka hammer head assembly) requires a slower BPM, whereas a lighter hammer can have a higher BPM. You do not want your hammer running faster than you can control it, nor so fast that the inherent forces tear it apart. My hammer uses a 24-inch tire and a 3-inch drive wheel for an 8:1 reduction of a 1750 RPM motor, yielding a calculated 218 BPM at full speed. Your hammer will run differently depending on your motor RPM, your drive and driven wheel diameters, and the hammer’s overall design. I rarely run my hammer full speed during general forging work, and the tire clutch gives good speed control. Full speed works acceptably well for drawing out damascus billets or breaking down large stock.

My tire clutch has an integral flywheel bolted to the hub. On the flywheel I welded several different nuts for attaching the pitman arm (for more on the pitman arm, see part three last issue). Each nut is a different distance from the center of the hub. This allows me to vary the length of the stroke, in my case between 6.5, 7 and 7.5 inches, based on where I connect the arm to the flywheel. Coupled with an adjustable-length pitman arm, this setup allows a degree of tuning to get the hammer hitting in a way that transfers the power directly to the workpiece with efficiency, yet in a way that doesn’t place undue stress on the hammer itself.

Choosing A Motor For Your Tire Hammer

As for motors, the size may vary a bit depending on the overall tup weight of your hammer. For most homebuilt hammer sizes, a 1 or 1.5 HP motor is plenty. My 40-pound hammer uses a 1.5 HP motor running on 110v and does not trip a standard 15-amp breaker, suggesting that 1.5 HP is more than plenty for a 40-pound head. Whether the motor runs on 110v or 220v will depend on your shop setup and what you have available, but you’d be best served either way with a motor that runs in the 1700 RPM range, not one that runs in the 3400 RPM range. There’s no need to go three phase or variable speed unless you’re already set up for either.

Doug Davis’ homemade hammer
Doug Davis’ homemade hammer uses a series of pulleys and an idler. When you step on the treadle, the idler tightens the belt and engages the hammer.

You will need an on/off switch for your motor. To run the hammer, turn the motor on, then use the foot pedal linkage to engage the clutch.

Sourcing Dies

Most power hammers have a set of dies in between the anvil and the hammer shaft. Dies may be built in a variety of shapes and sizes, depending on how you want your hammer to move the metal. Two basic die designs are flat and crowned. Flat dies move the metal somewhat equally in all four directions, while crowned dies will draw out the length of your workpiece perpendicular to the crown on the dies. Some smiths design their hammers to accommodate various top or bottom tools, or spring swages as well.

Tire Hammer Die Attachment
The die attachment on Doug Davis’ power hammer is more robust on the ram-to-die connection, but time will tell how the bottom-die direct-weld works out. (Erik Greiner image)

On my personal hammer, the dies are built out of 1.5-inch square 4140 steel bar stock, heat treated and ground essentially flat, with slightly radiused corners. Some hammers are set up with dies that are interchangeable but mine is not. Full disclosure: My die attachment is one point of weakness in my design. I ultimately welded my bottom die plate straight to the anvil, and I’ve had to reinforce the top die connection and re-weld it several times. Perhaps a more skilled welder could have done better!

Creative Necessity

I can’t emphasize enough the creativity necessary to build a functioning power hammer from scrap. It’s one thing to watch a YouTube video and think, “It must be nice to have a power hammer.” It’s another thing entirely to watch the same video and try to discern how the rocker arm connects to the center post, or how the tire clutch axle is set up.

At the time of my hammer build, there was an online gallery hosted in Czechoslovakia that had hundreds of pictures of various homebuilt and factory built hammers. I couldn’t have built mine without those examples. I don’t speak Czech but the pictures tell the story well.

Read More On Power Hammers:


Download BLADE's Knife Guide Issue!NEXT STEP: Download Your Free KNIFE GUIDE Issue of BLADE Magazine

BLADE’s annual Knife Guide Issue features the newest knives and sharpeners, plus knife and axe reviews, knife sheaths, kit knives and a Knife Industry Directory.

Get your FREE digital PDF instant download of the annual Knife Guide. No, really!

We will email it to you right now when you subscribe to the BLADE email newsletter.

BLADE Magazine