CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

17 October, 2022

Laravel 9.35 Released

 Programing Coderfunda     October 17, 2022     Laravel, php     No comments   

 The Laravel team released 9.35 with an exciting new alternate mailable syntax, an Eloquent "strict mode" feature, and more.

Alternate mailable syntax

Taylor Otwell contributed an alternate mailable syntax to works by returning "slim value objects that specify the content and attributes of the mailable"

Here's an example from his pull request description:

1namespace App\Mail;
2 
3use Illuminate\Bus\Queueable;
4use Illuminate\Contracts\Queue\ShouldQueue;
5use Illuminate\Mail\Mailable;
6use Illuminate\Mail\Mailables\Address;
7use Illuminate\Mail\Mailables\Attachment;
8use Illuminate\Mail\Mailables\Content;
9use Illuminate\Mail\Mailables\Envelope;
10use Illuminate\Queue\SerializesModels;
11 
12class InvoicePaid extends Mailable
13{
14 use Queueable, SerializesModels;
15 
16 /**
17 * Create a new message instance.
18 *
19 * @return void
20 */
21 public function __construct()
22 {
23 //
24 }
25 
26 /**
27 * Get the message envelope.
28 *
29 * @return \Illuminate\Mail\Mailables\Envelope
30 */
31 public function envelope()
32 {
33 return new Envelope(
34 subject: 'Invoice Paid',
35 cc: [new Address('foo@example.com', 'Example Name')],
36 tags: [],
37 metadata: [],
38 );
39 }
40 
41 /**
42 * Get the message content definition.
43 *
44 * @return \Illuminate\Mail\Mailables\Content
45 */
46 public function content()
47 {
48 return new Content(
49 view: 'html-view-name',
50 text: 'text-view-name',
51 );
52 }
53 
54 /**
55 * Get the attachments for the message.
56 *
57 * @return \Illuminate\Mail\Mailables\Attachment[]
58 */
59 public function attachments()
60 {
61 return [
62 Attachment::fromPath('/path/to/file'),
63 ];
64 }
65}

The traditional way of defining mailables using build() will not be removed. I like how the above example is obvious what is happening using PHP 8's named arguments.

Eloquent "strict" mode

Chris Morrell and Taylor Otwell collaborated on an Eloquent strict mode, which enables the following:

  • No lazy loading
  • Exceptions when assigning non-fillable attributes
  • Exceptions accessing attributes that weren't retrieved or didn't exist

Ideally, you'll use strict mode in development by adding the following to the boot() method of a registered service provider:

1Model::shouldBeStrict();

The shouldBeStrict() method is a shortcut for enabling all of the following:

1Model::preventLazyLoading();
2Model::preventSilentlyDiscardingAttributes();
3Model::preventsAccessingMissingAttributes();

Load trashed models with resource routes

Andrew Brown contributed the ability to load trashed models with resource routes using the following routing syntax:

1// All endpoints
2Route::resource('users', UserController::class)->withTrashed();
3 
4// Only `show`
5Route::resource('users', UserController::class)->withTrashed(['show']);

Release Notes

You can see the complete list of new features and updates below and the diff between 9.34.0 and 9.35.0 on GitHub. The following release notes are directly from the changelog:

v9.35.0

Added

  • Allow loading trashed models for resource routes (#44405)
  • Added Illuminate/Database/Eloquent/Model::shouldBeStrict() and other (#44283)
  • Controller middleware without resolving controller (#44516)
  • Alternative Mailable Syntax (#44462)

Fixed

  • Fix issue with aggregates (withSum, etc.) for pivot columns on self-referencing many-to-many relations (#44286)
  • Fixes issue using static class properties as blade attributes (#44473)
  • Traversable should have priority over JsonSerializable in EnumerateValues (#44456)
  • Fixed make:cast --inbound so it's a boolean option, not value (#44505)

Changed

  • Testing methods. Making error messages with json_encode more readable (#44397)
  • Have 'Model::withoutTimestamps()' return the callback's return value (#44457)
  • only load trashed models on relevant routes (#44478)
  • Adding additional PHP extensions to shouldBlockPhpUpload Function (#44512)
  • Register cutInternals casters for particularly noisy objects (#44514)
  • Use get methods to access application locale (#44521)
  • return only on non empty response from channels (09d53ee, 3944a3e)
  • Correct channel matching (#44531)
  • Migrate mail components (#44527)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

cURL Converter - A tool convert cURL commands to Laravel's HTTP Client

 Programing Coderfunda     October 17, 2022     Laravel     No comments   

 Last week Shift released the cURL Converter. It allows you to quickly convert curl requests to an Http client request. Now all those example API calls you find within documentation can actually be used for your Laravel apps.

For example, take the following curl example from Fathom.

1curl https://api.usefathom.com/v1/account \
2 -H "Authorization: Bearer API_TOKEN_HERE"

Shift's cURL Converter outputs its equivalent Http request:

1Http::withToken('API_TOKEN_HERE')
2 ->get('https://api.usefathom.com/v1/account');

The underlying code for Shift's cURL Converter is available as a package on GitHub. This package provides an artisan command which wraps curl, allowing you to convert requests to Http code from the command line.

For convenience, Shift also has an online version of the tool. This allows you to quickly paste and convert curl requests. No need to install a Composer package.

If you’re interested in the development of this tool, JMac (Jason McCreary), the creator of Shift, live streamed coding it. You may also check out the laravel-shift/curl-converter repo to review its code or contribute.

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

05 September, 2022

Generate random number in Laravel Title Tag

 Programing Coderfunda     September 05, 2022     Laravel, php     No comments   


Generate Title tag to change secrate code in Laravel and PHP 


Satrt *

1). Portable Storage Units 


Show data : PSU1482




$xx = '' ;

$pop  = rand(110,63654);

$string = rand(10,1000);


$bc = "+=";

$string = 'Portable Storage Units ' .$string;


//



// random_int(100000, 999999);


function initials($str) {

    $ret = '';

    foreach (explode(' ', $str) as $word)

        $ret .= strtoupper($word[0]);

    return $ret;

}


$st = initials($string);

$a = uniqid($st);

$b= substr($a, 0, 7);

echo $b ;



output: PSU1482

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Generate Title tag to change secrate code in Laravel and PHP

 Programing Coderfunda     September 05, 2022     Laravel, php     No comments   

 


$xx = '' ;

$pop  = rand(110,63654);

$string = rand(10,1000);


$bc = "+=";

$string = 'Portable Storage Units ' .$string;


//



// random_int(100000, 999999);


function initials($str) {

    $ret = '';

    foreach (explode(' ', $str) as $word)

        $ret .= strtoupper($word[0]);

    return $ret;

}


$st = initials($string);

$a = uniqid($st);

$b= substr($a, 0, 7);

echo $b ;


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Generate Randam Encrypted Number in Laravel

 Programing Coderfunda     September 05, 2022     Laravel, php     No comments   

 Satrt *

1). Portable Storage Units 


Show data : PSU1482




$xx = '' ;

$pop  = rand(110,63654);

$string = rand(10,1000);


$bc = "+=";

$string = 'Portable Storage Units ' .$string;


//



// random_int(100000, 999999);


function initials($str) {

    $ret = '';

    foreach (explode(' ', $str) as $word)

        $ret .= strtoupper($word[0]);

    return $ret;

}


$st = initials($string);

$a = uniqid($st);

$b= substr($a, 0, 7);

echo $b ;

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Make first letter of each word capital In PHP

 Programing Coderfunda     September 05, 2022     Laravel, php     No comments   

$string = 'Portable Storage Units ';

function initials($str) {

    $ret = '';

    foreach (explode(' ', $str) as $word)

        $ret .= strtoupper($word[0]);

    return $ret;

}


$st = initials($string);

                echo $st; 


Output : PSU

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg

Show Each Word 1st Charactor Like Hello Word "HW"

 Programing Coderfunda     September 05, 2022     Laravel, php     No comments   

 

            $string = 'Hello Word ' 

function initials($str) {

    $ret = '';

    foreach (explode(' ', $str) as $word)

        $ret .= strtoupper($word[0]);

    return $ret;

}


$st = initials($string);


OutPut : HW

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Newer Posts Older Posts Home

Meta

Popular Posts

  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • Write API Integrations in Laravel and PHP Projects with Saloon
    Write API Integrations in Laravel and PHP Projects with Saloon Saloon  is a Laravel/PHP package that allows you to write your API integratio...
  • iOS 17 Force Screen Rotation not working on iPAD only
    I have followed all the links on Google and StackOverFlow, unfortunately, I could not find any reliable solution Specifically for iPad devic...
  • C++ in Hindi Introduction
    C ++ का परिचय C ++ एक ऑब्जेक्ट ओरिएंटेड प्रोग्रामिंग लैंग्वेज है। C ++ को Bjarne Stroustrup द्वारा विकसित किया गया था। C ++ में आने से पह...
  • Python AttributeError: 'str' has no attribute glob
    I am trying to look for a folder in a directory but I am getting the error.AttributeError: 'str' has no attribute glob Here's ...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (68)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • July (2)
  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda