• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Passing a boolean value from checkbox in Laravel form

phplaravel


PHP Snippet 1:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Post extends Model
{
    protected $casts = [
        'is_featured' => 'boolean',
        'is_place' => 'boolean',
    ];
}

PHP Snippet 2:

<input type="checkbox" name="is_featured" class="switch-input" value="1" {{ old('is_featured') ? 'checked="checked"' : '' }}/>

PHP Snippet 3:

$post->is_featured = $request->has('is_featured');

Related Snippets

add_action() function in wordpress not working [duplicate]

Laravel print last executed SQL query with Query log

Target Laravelista is not instantiable

laravel MVC execution flow

Search for array row with specific column value and return another value from qualifying row

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255

I want a way to give path to my files which are outside of public folder in laravel

laravel MVC execution flow

How to remove Deprecated SymfonyComponentDebugDebugClassLoader?

Fatal error: [] operator not supported for strings

java URL working on browser but not in client program

Cache clear probem in Larave

How to change the app environment at run time?

Artisan, creating tables in database

Inserting data into SQL Server Db An Invalid direction was specified

About Contact Privacy policy Terms and conditions