Jason Miller
@zeleni-zub
0
Views
0
Likes
0
Following
0
Followers
0
Posts
Jason Miller
Edited 2 years ago

#laravel how to check does request contain specific POST parameter. Actually there are couple of methods we can use in this case.
Here they are in another #laraveltip

                    $request->has('eventName')

// or

$request->exists('eventName')

// or 

$request->filled('eventName')
                  
Jason Miller
2 years ago

#laravel

Do you know how to show hidden model field just for specific query request? Do you know about makeVisible() method?
Checkout this #laraveltip

                    class User extends Model
{
// in our User model we are hiding id 
protected $hidden=['id'];

}

// select all users
$user = new User();
$users = $user->all();

// show id for this query
$users->makeVisible(['id']);

return $users; // will contain id

                  
Jason Miller
Edited 2 years ago

#laraveltip how to validate date in submit form❓️ Here is the simple example of validating different types of dates passed from submit form:

                    <?php
// eventDate = 16/02/2000
$request->validate([
	'eventDate' => 'required|date_format:d/m/Y',
]);
?>
                  
Jason Miller
2 years ago

#music error 404

error 404 dubstep
Jason Miller
Edited 2 years ago
Jason Miller
3 years ago

simple #HTML rendered in #PHP

                    function renderHtml($contentRenderer = null)
{
    echo "<!DOCTYPE HTML>n";
    echo '<html>';
    if ($contentRenderer) $contentRenderer();
    echo '</html>';
}
                  
Jason Miller
3 years ago
Jason Miller
3 years ago

#JavaScript convert Array to String:

                    const numberArray = ["one", "two", "three", "four"];
const output = numberArray.toString();
// output: one,two,three,four
                  

About

Member since: September, 2020

Not yet a member?