PHP code example of robertseghedi / laravel-advanced-security

1. Go to this page and download the library: Download robertseghedi/laravel-advanced-security 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/ */

    

robertseghedi / laravel-advanced-security example snippets


 // your providers

RobertSeghedi\LAS\LASProvider::class,
 

use RobertSeghedi\LAS\Models\LAS;
  

public function add_post(Request $req)
{
    $post = new Post();
    $post->title = $req->input('title');
    $post->description = $req->input('description');
    $post->user = Auth::user()->id;
    $post->ip = LAS::ip(); // grabs the user IP
    $post->browser = LAS::browser(); // grabs the user browser
    $post->os = LAS::os(); // grabs the user OS
    $saved_post = $post->save();
    if($saved_post) return redirect()->back()->with('success', 'Article posted.');
}

public function insert_log($user_id = null)
{
    $user = User::find($user_id);
    $log = LAS::log($user_id, "$user->name joined the chat.");
    if($log) return redirect()->back();
}
config/app.php

  php artisan migrate