Everyone!
I am trying to make a Package in Laravel 5.6 The functionality of that package is to send the email by using Mail facade and Laravel queues.
I know this thing is super easy but I am doing this first time that why totally blank about what to do next.
I have done with creating a service provider, controller, views and other things needed.
Here are my pieces of code, have a look:
The ServiceProvider:
<?php
namespace hamtech\rapidmailer;
use Illuminate\Support\ServiceProvider;
class RapidMailerServiceProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
$this->loadViewsFrom(__DIR__.'/views', 'rapidmailer');
$this->publishes([
__DIR__.'/views' => base_path('resources/views/hamtech/pages'),
__DIR__.'/mail' => base_path('app/Mail'),
]);
}
/**
* Register services.
*
* @return void
*/
public function register()
{
include __DIR__.'/routes.php';
$this->app->make('hamtech\rapidmailer\RapidMailerController');
}
}
The Controller:
<?php
namespace hamtech\rapidmailer;
use App\Http\Controllers\Controller;
use App\Mail\RapidMailerMessage;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
class RapidMailerController extends Controller
{
public function index()
{
return view('rapidmailer::mailform');
}
public function SendMessage(Request $request)
{
Mail::to($request->email)->send(new RapidMailerMessage);
}
}
The Routes.php:
Route::get('/rapid-mailer', 'hamtech\rapidmailer\RapidMailerController@index');
Route::post('/send-message', 'hamtech\rapidmailer\RapidMailerController@SendMessage');
The composer.json of laravel project:
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/",
"hamtech\\rapidmailer\\": "packages/hamtech/rapidmailer/src"
}
},
The app.php:
hamtech\rapidmailer\RapidMailerServiceProvider::class,
I think this stuff would be enough :)
Please guide me what to do?
I am getting this error:
https://prnt.sc/ijoadm
Thanks :)
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2CiCutR
via IFTTT
Aucun commentaire:
Enregistrer un commentaire