PHP code example of sakanjo / laravel-flashy

1. Go to this page and download the library: Download sakanjo/laravel-flashy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sakanjo / laravel-flashy example snippets


php artisan vendor:publish --provider="Flashy\ServiceProvider"

public function store(Request $request) {
  User::create([
    'name' => 'Salah Kanjo',
    'email' => '[email protected]'
  ]);
  Success('Successfully created');
}

public function edit(Request $request) {
  Error_if(!auth()->user()->verified(), "Please verify your account first");

  ...
}

Flash('info', 'Account 

public function getData() {
  $user = Http::get('http://example.com/users/' . auth()->id);
  Error_if($user->failed(), 'Something went wrong');
  return $user;
}

public function index() {
  $data = getData(); // Stops execution here if user not found

  return inertia('Home', compact('data'))
}