I am new using laravel and what I want to do to incorporate into my project a class of my own that I have developed.
I tried to follow the steps of this link but it does not work out, what I done so far is the following:
1.) Create the Alias config \ app.php:
'Alert' => 'Facades\App\Alert',
2.) Create the File that stores the class in the App folder (app \ Alert.php ) This is the content of the class:
<?php
namespace App;
class Alert
{
public function message($message, $type)
{
return $message;
}
public function render()
{
return 'render';
}
}
?>
3.) Create the AlertController Driver as follows:
php artisan make:controller AlertController
Add the facade to the controller:
<?php
namespace Sistem_Administrador\Http\Controllers;
use Illuminate\Http\Request;
use Facades\App\Alert; //<-Facade agregado
class AlertController extends Controller
{
public function index()
{
return Alert::message('Mensaje1','Typo1');
}
}
4.) Create the Route in the routes \ web.php file
Route::get('/Alert','AlertController@index');
I do not know if I need a step but as far as I saw on the page that I mentioned before, that would be all, the laravel version I have is 5.4
The error that returns to me says that Class App \ Alert does not exist, as seen in the following image: