• TIP-0014

    CSS Rainbow Animation

  • Creates a continuously looping color animation for elements to grab user attention. Give a read to css tips tricks repository to learn when to use prefer-reduced-motion media feature

  • 
    button{
      animation: rainbow-animation 200ms linear infinite;
    }
    
    @keyframes rainbow-animation {
      to{
        filter: hue-rotate(0deg);
      }
     from{
        filter: hue-rotate(360deg);
      }
    }
    
    
    
    https___dev-to-uploads.s3.amazonaws.com_uploads_articles_60jgrr09vgsckx9h2irl.gif 290.18 KB


  • TIP-0009

    CSS Paused Pseudo Class

  • Use :paused selector to style media elements when in paused state likewise :paused we also have :playing.

  • /* πŸ“’ currently, only supported in Safari */
    
    video:paused {
      opacity: 0.6;
    }


  • TIP-0008

    CSS Fill Text With Image

  • You can fill your text with image

  • h3{
      background-image: url('images/rose.jpg');
      background-clip: text;
      color: transparent;
      background-color: white;
    }
    


  • TIP-0007

    CSS The Custom Cursors

  • you can set your custom cursor

  • Β Checkout the github repository css tips tricks to learn more about it.Β 

    html{
      cursor:url('no.png'), auto;
    }
  • TIP-0006

    Laravel String Snake

  • The Str::snake method converts the given string to snake_case:

  • use Illuminate\Support\Str;
     
    $converted = Str::snake('fooBar');
     
    // foo_bar
     
    $converted = Str::snake('fooBar', '-');
     
    // foo-bar


  • TIP-0005

    Laravel String Trim

  • The Str::trim method strips whitespace (or other characters) from the beginning and end of the given string. Unlike PHP's native trim function, the Str::trim method also removes unicode whitespace characters:

  • use Illuminate\Support\Str;
     
    $string = Str::trim(' foo bar ');
     
    // 'foo bar'


  • TIP-0004

    Laravel String Transliterate

  • The Str::transliterate method will attempt to convert a given string into its closest ASCII representation:

  • use Illuminate\Support\Str;
     
    $email = Str::transliterate('β“£β“”β“’β“£@ⓛⓐⓑⓐβ“₯β“”β“›.β“’β“žβ“œ');
     
    // 'test@laravel.com'


  • TIP-0003

    Laravel String to html string

  • The Str::toHtmlString method converts the string instance to an instance of Illuminate\Support\HtmlString, which may be displayed in Blade templates:

  • use Illuminate\Support\Str;
     
    $htmlString = Str::of('Nuno Maduro')->toHtmlString();


  • TIP-0002

    Laravel String to Base64

  • The Str::toBase64 method converts the given string to Base64:

  • use Illuminate\Support\Str;
     
    $base64 = Str::toBase64('Laravel');
     
    // TGFyYXZlbA==


  • TIP-0001

    Laravel Ajax Render View

  • Rendering laravel blade view using ajax from controller to HTML DOM.

  • In your controller

    public function getView(Request $request)
    {
        // Fetch any required data
        $data = [
            'key' => 'value', // Example data
        ];
    
        // Render the view
        $view = view('your-blade-view', $data)->render();
    
        // Return the rendered view as a JSON response
        return response()->json(['html' => $view]); 
    }

    In your view file

    <div id="render-html"></div>
    
    <script>
       $.ajax({
        url: '/get-view',
        type: 'POST',
        data: {
            _token: $('meta[name="csrf-token"]').attr('content'), // CSRF token
            someData: 'value', // Optional data
        },
        success: function(response) {
            $('#render-html').html(response.html); // Update content
        },
        error: function(xhr, status, error) {
            console.error('Error:', error);
        }
      });
    </script>