Nosean

Nosean

Member Since 1 Year Ago

Experience Points
1,700
Total
Experience

3,300 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
1,700 XP
May
04
5 months ago
Activity icon

Replied to Dynamic Var Name By Store Method

thanks that's work's

May
03
5 months ago
Activity icon

Started a new conversation Dynamic Var Name By Store Method

How can I give a variable a dynamic name? Have 5 form fields to be entered in a DB. The name of the fields I have assigned value1 to value5.

My Store Method:

 public function store(Request $request)
    {
        switch ($request->formElement) {
            case 'input':
            case 'checkbox':
            case 'textarea':
                // Anlegen eines Extras Anhand der undercategorie ID und der FormElement Input, Checkbox, Textarea
                $extra = new UnderCategorieExtra;
                $extra->under_categorie_id = $request->undercategorie_id;
                $extra->extra_name_de = $request->fieldname_de;
                $extra->extra_name_en = $request->fieldname_en;
                $extra->extra_form_element = $request->formElement;
                $extra->placeholder_de = $request->placeholder_de;
                $extra->placeholder_en = $request->placeholder_en;
                $extra->save();
                return back();
                break;
            case 'select':
            case 'radio':
                // Anlegen des Extras Anhand der undercategorie_id und der Formelemente Select, Radio
                $extra = new UnderCategorieExtra;
                $extra->under_categorie_id = $request->undercategorie_id;
                $extra->extra_name_de = $request->fieldname_de;
                $extra->extra_name_en = $request->fieldname_en;
                $extra->extra_form_element = $request->formElement;
                $extra->placeholder_de = $request->placeholder_de;
                $extra->placeholder_en = $request->placeholder_en;
                $extra->save();

                // Values werden gespeichert mit ID
                for($i=0; $i<5; $i++) {
                    $extra_value = new ExtraValue;
                    $extra_value->under_categorie_extras_id = $extra->id;
                    $extra_value->extra_form_element = $request->formElement;
                    $extra_value->extra_form_value = $request->value1;
                    $extra_value->save();
                };

            return back();

        }
    }

Now how can I write the name dynamically so that the store method recognizes the 5 different fields and stores the entries

Did it with `$ request-value. $ I` tried without success

Thanks

Apr
28
5 months ago
Activity icon

Replied to Redirect After Check Auth

done!

I solved it that way. Can one do it like this or

    Route::name('advertisement.')->group(function () {

        Route::middleware('auth', 'can:is-privat')->group(function () {
            if(auth()) {
                Route::view('/', 'advertisement.index');
            } else {
                return redirect('login');
            }
        });
    });

Thats work's

Activity icon

Started a new conversation Redirect After Check Auth

Hello, Sometimes a question how to use this authentication method after check (check fail, user not logged in) to redirect to another URL?

Route::prefix('advertisement')->group(function() {

    Route::name('advertisement.')->group(function () {

        Route::middleware('auth', 'can:is-privat')->group(function () {
                Route::view('/', 'advertisement.index');
        });
    });

});

Thanks a lot

Apr
23
5 months ago
Activity icon

Started a new conversation Middleware

Hello,

how can I allow different rolls to access the backend?

Have 5 different roles admin, private, farmer, dealer and guest!

It should all in the backend except guest:

My code:

        Route::middleware('auth', 'can:is-admin, is-haendler, is-privat, is-landwirt')->group(function () {
            Route::view('/', 'backend.index');
        });

Once the user is not an is-admin, he can not get in! Why ?

Apr
22
5 months ago
Activity icon

Started a new conversation Array To String Conversion ???

Hello,

i have a problem with Seeds.

My Seeder Code:


    public function run()
    {
        $author = Role::create([
            'name' => 'Admin',
            'slug' => 'admin',
            'permissions' => [
                'is-admin' => true,
            ]
        ]);

    }

when I try to execute the following command: php artisan db:seed, I receive the following error message:

 Array to string conversion (SQL: insert into `roles` (`name`, `slug`, `permissions`, `updated_at`, created_at`) values (Admin, admin, 1, 2019-04-22 08:36:33, 2019-04-22 08:36:33))

I wonder why the permissions value is 1 and not {is-admin "true}. The DB field is a long text field

anyone an idea?

Apr
19
5 months ago
Activity icon

Replied to Foreign Key Constraints

Thx update the filed from integer to biginteger work's

Activity icon

Started a new conversation Foreign Key Constraints

I become a error message when i try the migration:

QLSTATE[HY000]: General error: 1005 Can't create table blog.#sql-33c_b2 (errno: 150 "Foreign key constraint is incorrectly formed") (SQL: alter table posts add constraint posts_user_id_foreign foreign key (user_id ) references users (id))

my Schema file:

        Schema::enableForeignKeyConstraints();

        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title');
            $table->string('slug')->unique();
            $table->text('body');
            $table->boolean('published')->default(false);
            $table->integer('user_id')->unsigned();
            $table->timestamps();
            $table->foreign('user_id')->references('id')->on('users');
        });
``

Why ?
Apr
17
5 months ago
Activity icon

Replied to Gates And Polieces

video ? Link ?

Activity icon

Started a new conversation Gates And Polieces

Hello

I'm trying to build a role-based login. Have a table user, roll, and a pivottabelle user_role. User with authorization (SQL table roles, longtext field = permissions, value: {"is-admin": true}; is created.

I do this with Gates and Polieces

My AuthServiceProvider.php

     public function boot()
    {
        $this->registerPolicies();
        $this->registerAdminPolicies();

        //
    }

    public function registerAdminPolicies()
    {
        Gate::define('is-admin', function ($user) {
            return $user->hasAccess(['is-admin']);
        });
    }

My User.php


    public function roles () {
        return $this->belongsToMany(Role::class, 'user_roles', 'user_id', 'role_id');
    }

    public function hasAccess(array $permissions) : bool
    {
        foreach($this->roles as $role) {
            if($role->hasAccess($permissions)) {
                return true;
            }
            return false;
        }
    }

My Role.php

    public function users () {
        return $this->belongsToMany(User::class, 'user_roles', 'role_id', 'user_id');
    }

    public function hasAccess(array $permissions) : bool
    {
        foreach ($permissions as $permission) {
            if($this->hasPermission($permission))
                return true;
        }

        return false;
    }


    private function hasPermission(string $permission) : bool
    {
        return $this->permissions[$permission] ?? false;
    }

header.blade.php

<!-- LOGO UND HEADNAVBAR -->
<div class="row">
    <div class="col-xl-3">

        @auth
            {{ auth()->user()->name }} {{ auth()->user()->roles()->pluck('name') }}
        @else
            Gast
        @endauth
        @can('is-admin')
            <a href="{{ route('admin.index') }}">Admin</a>
        @endcan
    </div>
    <div class="col-xl-9 text-right">
        <a href="lang/de" id="de"><img src="{{asset('layout/images/Germany-icon.png')}}" width="30px" height="30px"></a>
        <a href="lang/en" id="en"><img src="{{asset('layout/images/United-Kingdom-icon.png')}}" width="30px" height="30x"></a>
    </div>
</div>

Login works as well!

Now I have tried in my Blade file with @can ('is-admin') to insert a link to the admin area. This is unfortunately not displayed. In the debugbar I get the following error message under the tab Gates

error
array:4 [▼
  "ability" => "is-admin"
  "result" => false
  "user" => 14
  "arguments" => "[]"
]

Therefore, in the blade between the tags @can ('is-admin') and @endcan Has somebody an idea what is the problem?

Apr
06
6 months ago
Activity icon

Started a new conversation Migration Json Field

Hello,

i have a problem with json field migration. I get the following error message after confirming the migrate command:

   Illuminate\Database\QueryException  : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'json null, `is_active` tiny
int(1) not null default '0', `created_at` timestamp n' at line 1 (SQL: create table `roles` (`id` int unsigned not null auto_increment primary key, `name` varchar(191) not null, `slug` varchar(191) null, `description` text null, `permissions` json null, `is_act
ive` tinyint(1) not null default '0', `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

my migration file:

 public function up()
    {
        Schema::create('roles', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('slug')->nullable();
            $table->text('description')->nullable();
            $table->json('permissions')->nullable();
            $table->boolean('is_active')->default(false);
            $table->timestamps();
        });
    }

Where is the problem ?

Apr
04
6 months ago
Activity icon

Replied to How Can I Pass Variables To The Register Form?

hi, i know but i will pass a list of country to registerform. I cant find the controller to pass the variable per compact to view.

Activity icon

Started a new conversation How Can I Pass Variables To The Register Form?

how can I pass variables to the register form?

Activity icon

Replied to After Register

Yes, that's right. Have probably deleted the return earlier

thanks :)

Activity icon

Started a new conversation After Register

Hi Guys,

After registering, I receive the following error message. Have changed the create () method to my liking. how can I solve the problem ?

Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, null given, called in C:\xampp\htdocs\agramarket\vendor\laravel\framework\src\Illuminate\Foundation\Auth\RegistersUsers.php on line 35

my registercontroller:

<?php

namespace App\Http\Controllers\Auth;

use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;

class RegisterController extends Controller
{
    /*
    |--------------------------------------------------------------------------
    | Register Controller
    |--------------------------------------------------------------------------
    |
    | This controller handles the registration of new users as well as their
    | validation and creation. By default this controller uses a trait to
    | provide this functionality without requiring any additional code.
    |
    */

    use RegistersUsers;

    /**
     * Where to redirect users after registration.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest');
    }

    /**
     * Get a validator for an incoming registration request.
     *
     * @param  array  $data
     * @return \Illuminate\Contracts\Validation\Validator
     */
    protected function validator(array $data)
    {
        return Validator::make($data, [
            'firmaname' => ['string', 'max:255'],
            'anrede' => ['required', 'string', 'max:5'],
            'name1' => ['required', 'string', 'max:255'],
            'strasse' => ['required', 'string', 'max:255'],
            'plz' => ['required', 'string', 'max:10'],
            'ort' => ['required', 'string', 'max:255'],
            'land_id' => ['required'],
            'name' => ['required','string', 'max:255'],
            'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
            'password1' => ['required', 'string', 'min:6'],
            'password2' => 'required|min:8|same:password1',
        ]);
    }

    /**
     * Create a new user instance after a valid registration.
     *
     * @param  array  $data
     * @return \App\User
     */
    protected function create(array $data)
    {
            User::create([
            'firmaname' => $data['firmaname'],
            'haendler' => 'nein',
            'anrede' => $data['anrede'],
            'name' => $data['name'],
            'strasse' => $data['strasse'],
            'plz' => $data['plz'],
            'ort' => $data['ort'],
            'land_id' => $data['land_id'],
            'name1' => $data['name1'],
            'email' => $data['email'],
            'password' => Hash::make($data['password1'])
        ]);

    }
}

Thx for help

Mar
30
6 months ago
Activity icon

Replied to Dynamic Dependant Select Box

Oh Boy ...

Time for bed :)

My Error:

Use of undefined constant categories - assumed 'categories' (this will throw an Error in a future version of PHP) (View: C:\xampp\htdocs\agramarket\resources\views\sections\searchtron.blade.php)

Thx

Activity icon

Started a new conversation Dynamic Dependant Select Box

Hello Guys

I will create an Dynamic Dependant Select Box View.

My HomeController:

 public function index()
    {
        // Alle Kategorien werden geladen
       $categories = DB::table('categories')->pluck("category_name", "id")->all();
       return view('home', compact('categories'));
    }

    public function subcategories (Request $request) {
        if($request->ajax()){
            $under_categories = DB::table('under_categories')->where('categorie_id',$request->categorie_id)->get();
            $data = view('sections.searchtron',compact('under_categories'))->render();
            return response()->json(['options'=>$data]);
        }
    }

My View:

           {!! Form::open() !!}
            
                <div class="row align-items-end">
                    <div class="col">
                        <label for="categorie">Kategorie</label>
                            {!! Form::select('categorie',[''=>'--- Select Country ---']+categories,null,['class'=>'form-control', 'id'=>'categorie']) !!}

                    </div>
                    <div class="col">
                        <label for="subcategorie">Maschinenart</label>
                        <select class="form-control" name="subcategorie" id="subcategorie">
                            <option value="any">Beliebig</option>
                            @if(!empty($data))
                                @foreach($states as $key => $value)
                                    <option value="{{ $key }}">{{ $value }}</option>
                                @endforeach
                            @endif

                        </select>
                    </div>
                    <div class="col">
                        <label for="manufacturer">Maschinenart</label>
                        <select class="form-control" disabled name="manufacturer">
                            <option value="any">Beliebig</option>
                            <option value=""></option>
                        </select>
                    </div>
                    <div class="col ">
                        <input type="submit" class="form-control btn btn-success" name="search" value="Suchen">
                    </div>
                </div>

                <input type="hidden" name="_token" value="{{ csrf_token() }}">
                
            {!! Form::close() !!}

And my JS:

$(document).ready(function() {

    $("select[name='categorie'").change(function () {
        var categorie_id = $(this).val();
        var token = $("input[name='_token']").val();
        $.ajax({
            url: "/subcategorie",
            method: 'POST',
            data: {categorie_id: categorie_id, _token: token},
            success: function (data) {
                $("select[name='subcategorie'").html('');
                $("select[name='subcategorie'").html(data.options);
            }
        });
    });

});

Anyone can help??

Thx

Mar
07
7 months ago
Activity icon

Replied to Production.ERROR: SQLSTATE[22003]: Numeric Value Out Of Range: 1264 Out Of Range Value For Column 'attempts' At Row 1

Yes, I checked. It works offline, but it does not want to work online.

Activity icon

Started a new conversation Production.ERROR: SQLSTATE[22003]: Numeric Value Out Of Range: 1264 Out Of Range Value For Column 'attempts' At Row 1

Hi Guys,

I have a problem with executing jobs (mail job) but only in productive mode. I get the following error message recorded in the log:

production.ERROR: SQLSTATE [22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1

This error comes only online on the server. Local on my PC (WIN10 / XAMPP / PHP7.2.7) it works fine. All jobs are executed successfully.

My Build File:

 public function build()
    {
        $date = $this->details['date'];
        $yesterday = $this->details['yesterday'];
        $kto = $this->details['kto'];
        $name = $this->details['name'];
        $name2 = $this->details['name2'];
        $adress = $this->details['adress'];
        $zip = $this->details['zip'];
        $city = $this->details['city'];
        $user_email = $this->details['user_email'];



        $data = Array(
            'date' => $this->details['date'],
            'yesterday' => $this->details['yesterday'],
            'kto' => $this->details['kto'],
            'name' => $this->details['name'],
            'city' => $this->details['city']
        );

        $filename = $kto . '.pdf';
        $path = storage_path('pdf\') . $filename;

        if(!file_exists(storage_path('pdf\' . $filename))) {
            $pdf = PDF::loadView('orderform', ['data' => $data])
                ->setPaper('a4', 'landscape')
                ->save($path);
        }

        return $this->subject('Bestellerinnerung')
                    ->from('[email protected]')
                    ->view('admin.sendrememberemail')
                    ->with([
                        'kto' => $kto,
                        'date' => $date,
                        'yesterday' => $yesterday,
                        'name' => $name,
                        'name2' => $name2,
                        'adress' => $adress,
                        'zip' => $zip,
                        'city' => $city,
                        'user_email' => $user_email
                    ])
                ->attach($path,
                    ['as' => $filename,
                        'mime' => 'application/pdf',
                    ]);
    }

My handle File:

    public function handle()
    {
        $email = new SendRememberEmail($this->details);
        Mail::to($this->details['user_email'])->send($email);
    }

Thanks for Help!

Feb
25
7 months ago
Activity icon

Started a new conversation Resource Controller Destroy Method

I would like to delete a record. I have only one string (Categorie_name) as ID. My Link:

<a href="{{ route('admin.categorie.destroy', ['categorie_name' => $key]) }}"><i class="fas fa-trash-alt"></i></a>

and my web.php:

Route::resource('categorie', 'AdminCategorieController');

and my Controller:

    public function destroy(Categorie $categorie_name)
    {
        // Id finden anhand der Categorie_name Varibale


        $categorie_id = DB::table('categories')
                        ->where('categorie_name', '=', '$categorie')->first();

        dd($categorie_id)

    }

After clicking on link comes only an empty page instead of the DD dump.

Can anyone Help ?

Feb
22
7 months ago
Activity icon

Replied to Display A Collection

Hello,

I created the collection in a similar way!

        // Abfrage Kategorien mit Unterkategorien
        $categories = DB::table('categories')
            ->join('under_categories', 'categories.id', '=', 'under_categories.categorie_id')->get();

        $categories = $categories->groupBy('category_name');
               return view('admin.categorie', compact('categories'));

thx

Feb
21
7 months ago
Activity icon

Started a new conversation Display A Collection

Hey Guys, i have the follow Collection

Collection {#1141 ▼
  #items: array:2 [▼
    "Aussattechnik" => Collection {#1139 ▼
      #items: array:2 [▼
        0 => {#1054 ▼
          +"id": 2
          +"category_name": "Aussattechnik"
          +"deleted_at": null
          +"created_at": "2019-02-21 12:52:55"
          +"updated_at": "2019-02-21 12:52:55"
          +"categorie_id": 1
          +"undercategorie_name": "Direktsaatmachine"
        }
        1 => {#1055 ▼
          +"id": 3
          +"category_name": "Aussattechnik"
          +"deleted_at": null
          +"created_at": "2019-02-21 12:53:17"
          +"updated_at": "2019-02-21 12:53:17"
          +"categorie_id": 1
          +"undercategorie_name": "Drillmachine"
        }
      ]
    }
    "Bagger & Lader" => Collection {#1140 ▼
      #items: array:2 [▼
        0 => {#1056 ▼
          +"id": 4
          +"category_name": "Bagger & Lader"
          +"deleted_at": null
          +"created_at": "2019-02-21 12:53:34"
          +"updated_at": "2019-02-21 12:53:34"
          +"categorie_id": 3
          +"undercategorie_name": "Arbeitsbühne"
        }
        1 => {#1057 ▼
          +"id": 5
          +"category_name": "Bagger & Lader"
          +"deleted_at": null
          +"created_at": "2019-02-21 12:55:13"
          +"updated_at": "2019-02-21 12:55:13"
          +"categorie_id": 3
          +"undercategorie_name": "Bagger"
        }
      ]
    }
  ]
}

Would like to have the collection displayed in something like this:

1. Aussatmachine 
1.1 Direktsaatm.
1.2 Drillmachine
2. Bagger & Lader
2.1 Arbeitsbühne
2.2 Bagger

etc.

Anyone have an idea how I should proceed? thx

Feb
11
8 months ago
Activity icon

Started a new conversation Passing Data From Mailable Job To Balde View

Find a solution to the following problem: How do I transfer data from the controller (dispatch statement) via the job to the mailable and then to the view?

My Controller:

public function sendjob(Request $request) {

        $date = $request->lieferdatum;
        $today  = Carbon::createFromFormat('d.m.Y', $request->lieferdatum);
        $yesterday = date_format($today->subDay(), 'd.m.Y');


        $i = 5;
        foreach($request->user_id as $kto) {

            $users = DB::table('users')
                ->where('Kto', '=', $kto)
                ->first();

            $details = Array(
                'date' => $date,
                'yesterday' => $yesterday,
                'user_name' => $users->Name,
                'user_name2' => $users->Name2,
                'user_adress' => $users->LieferStrasse,
                'user_zip' => $users->LieferPLZ,
                'user_city' => $users->LieferOrt,
                'user_email' => $users->EMail,
                'user_kto' => $users->Kto
            );

                dispatch(new SendRememberEmailJob($details))->delay($i);

            $i = $i + 5;
        }

    }

My Job:

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Mail;
use App\Mail\SendRememberEmail;


class SendRememberEmailJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $details;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($details)
    {
        $this->details = $details;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $email = new SendRememberEmail($this->details);
        Mail::to($this->details['user_email'])->send($email);
    }
}

And my Mailable:

<?php

namespace App\Mail;

use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;

class SendRememberEmail extends Mailable
{
    use Queueable, SerializesModels;

    protected $details;

    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($details)
    {
        $this->details = $details;
    }

    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {

        return $this->subject('Bestellerinnerung')
                    ->from('[email protected]')
                    ->view('admin.sendrememberemail')
                    ->with('details', $this->details);


    }
}

ANd My Blade:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Bestellerinnerung</title>
</head>
<body>
Bestellerinnerung

{{ $details->user_email }}

</body>
</html>

Error Message from laravel log file: [2019-02-11 10:08:29] local.ERROR: Undefined variable: details (View: C:\xampp\htdocs\PFPortal\resources\views\admin\sendrememberemail.blade.php) {"exception":"[object] (ErrorException(code: 0): Undefined variable: details (View: C:\xampp\htdocs\PFPortal esources\views\admin\sendrememberemail.blade.php) at C:\xampp\htdocs\PFPortal\storage\framework\views\cabf0836bfe8b9cbd9fb98c097e84b67da3feac3.php:10, ErrorException(code: 0): Undefined variable: details at C:\xampp\htdocs\PFPortal\storage\framework\views\cabf0836bfe8b9cbd9fb98c097e84b67da3feac3.php:10) [stacktrace]

Can anyone Help me ?

Thx

Feb
08
8 months ago
Activity icon

Replied to Send Email With Jobs

I've looked again and receive the following message in the logfile:

[2019-02-08 10:31:44] local.ERROR: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: update jobs set reserved_at = 1549621904, attempts = 256 where id = 6360) {"exception":"[object] (Illuminate\Database\QueryException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 (SQL: update jobs set reserved_at = 1549621904, attempts = 256 where id = 6360) at C:\xampp\htdocs\PFPortal\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664, PDOException(code: 22003): SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'attempts' at row 1 at C:\xampp\htdocs\PFPortal\vendor\laravel\framework\src\Illuminate\Database\Connection.php:483) [stacktrace]

Thx for help...

Activity icon

Replied to Send Email With Jobs

Oh i look in the logfile but i cant see anymore Infomation about the error. The last entry is form 2018??? Why ?

Activity icon

Started a new conversation Send Email With Jobs

hi Guys I'm desperately looking for a solution to my problem. I'm trying to send multiple mail per queue job.

My controller:

public function sendjob(Request $request) {

        $date = $request->lieferdatum;
        $today  = Carbon::createFromFormat('d.m.Y', $request->lieferdatum);
        $yesterday = date_format($today->subDay(), 'd.m.Y');



        foreach($request->user_id as $kto) {

            $users = DB::table('users')
                ->where('Kto', '=', $kto)
                ->first();

            $data = Array(
                'date' => $date,
                'yesterday' => $yesterday,
                'user_name' => $users->Name,
                'user_name2' => $users->Name2,
                'user_adress' => $users->LieferStrasse,
                'user_zip' => $users->LieferPLZ,
                'user_city' => $users->LieferOrt,
                'user_email' => $users->EMail,
                'user_kto' => $users->Kto
            );

        }

        $details = $data;

        dispatch(new SendRememberEmailJob($details))->delay(now()->addSecond(5));

    }

My Job

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use App\Mail\SendRememberEmail as SendRememberEmail;
use Mail;

class SendRememberEmailJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;


    protected $details;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($details)
    {
        $this->details = $details;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        Mail::to($this->details['user_email'])->send(new SendRememberEmail());
    }
}

My Blade


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Bestellerinnerung</title>
</head>
<body>


TEST NACHRICHT

</body>
</html>

If I now execute the job via artisan queue: work, emial will not be sent and the entries in the job table will not be deleted either. Does anyone see the error ???

Sep
26
1 year ago
Sep
25
1 year ago
Activity icon

Started a new conversation Queue Job Pass The Mail::to Email Adress

I try to send many emails to different recipients.

my dispatch function:

    public function sendEmail () {
        $ users = User :: all () -> take (5);
        foreach ($ users as $ user) {
            $ data ['email'] = $ user-> email;
            dispatch (new SendEmailJob ($ data));
        }
       
    }

and my job class:

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\Mail;
use App\Mail\SendMailable;


class SendEmailJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;


    protected $data;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        $this->data = $data;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        Mail::to('[email protected]')->send(new SendMailable());
    }
}

how do I tell the mail :: to method with which a different email address should be used again and again.

thanks

Activity icon

Replied to MS SQL Could Not Find The Driver

oh year i have insallt the pdo_sqlsvr Driver. now i see the pdo_sqlsrv section.

thx

Sep
24
1 year ago
Activity icon

Started a new conversation MS SQL Could Not Find The Driver

have the following problem. I'm trying to connect laravel to MS SQL. Have all new drivers installed and released in the php.ini.

I can successfully test the connection.

    if(DB::connection()->getDatabaseName())
        {
            echo "conncted sucessfully to database ".DB::connection()->getDatabaseName();
            
        }

but if I try to start a query by Eloquent I get the following error message

            $test = DB::table('PFFahrzeuge')->get();
            dd($test);

Illuminate \ Database \ QueryException could not find driver (SQL: select * from [PFFahrzeuge])

Anyone an Idea ???

Sep
19
1 year ago
Activity icon

Started a new conversation Sending A Lot Of Mail Via Mail::send Method

Hey,

I send a lot of email via Mail::send Method.

Thats my Code

                Mail::send('admin.pricerise', ['user_email' => $user_email], function ($message) use ($user_email) {
                    $message->from('[email protected]', 'Propan-Fischer Team');
                    $message->to($user_email);
                    $message->subject("Propan-Fischer Preisänderung");
                });

when I start the script now I get the following error message:

Expected response code 354 but got code "554", with message "554 5.5.1 Error: no valid recipients "

Can anyone Help?

Sep
14
1 year ago
Activity icon

Replied to Send Mail Action "Maximum Execution Time Of 30 Seconds Exceeded"

Good Morning,

Ok i have

Unable to open file for reading [HTTP/1.0 200 OK Cache-Control: no-cache, private Content-Disposition: attachment; filename="orderform.pdf" Content-Type: application/pdf Date: Fri, 14 Sep 2018 05:38:30 GMT %PDF-1.3 1 0 obj << /Type /Catalog /Outlines 2 0 R /Pages 3 0 R >> endobj 2 0 obj << /Type /Outlines /Count 0 >> endobj 3 0 obj << /Type /Pages /Kids [6 0 R ] /Count 1 /Resources << /ProcSet 4 0 R /Font << /F1 8 0 R /F2 9 0 R >> >> /MediaBox [0.000 0.000 841.890 595.280] >> endobj 4 0 obj [/PDF /Text ] endobj 5 0 obj << /Producer (��dompdf <5113accd> + CPDF) /CreationDate (D:20180914053830+00'00') /ModDate (D:20180914053830+00'00') /Title (��Gasbestellung von Portal Propan-Fischer) >> endobj 6 0 obj << /Type /Page /MediaBox [0.000 0.000 841.890 595.280] /Parent 3 0 R /Contents 7 0 R >> endobj 7 0 obj << /Filter /FlateDecode /Length 510 >> stream 

ok i set the execution time high to 300, now i get this error message.

someone else an idea ???

or does anyone have an idea how to do it differently?

Sep
13
1 year ago
Activity icon

Started a new conversation Send Mail Action "Maximum Execution Time Of 30 Seconds Exceeded"

Hey ,

i have a problem with send Mail incl. Attachment

public function actionsendremember (Request $request) {

        $date = $request->lieferdatum;
        $today  = Carbon::createFromFormat('d.m.Y', $request->lieferdatum);
        $yesterday = date_format($today->subDay(), 'd.m.Y');

        foreach($request->user_id as $kto) {

            $users = DB::table('users')
                    ->where('Kto', '=', $kto)
                    ->first();

                    $data = Array(
                        'date' => $date,
                        'yesterday' => $yesterday,
                        'user_name' => $users->Name,
                        'user_name2' => $users->Name2,
                        'user_adress' => $users->LieferStrasse,
                        'user_zip' => $users->LieferPLZ,
                        'user_city' => $users->LieferOrt,
                        'user_email' => $users->EMail,
                        'user_kto' => $users->Kto
                        );

                    // Erstelle PDF


                    $pdf = PDF::loadView('orderform', ['data' => $data])
                                ->setPaper('a4', 'landscape');


                    // Email senden
                    Mail::send('admin.remember', ['data' => $data, 'pdf' => $pdf],  function ($message) use ($data, $pdf)
                    {
                        $message->from('[email protected]', 'Propan-Fischer Team');
                        $message->to($data['user_email']);
                        $message->subject("Propan-Fischer Bestellerinnerung");
                        $message->attach($pdf->download('orderform.pdf'));
                    });
        }

        Session::flash('message', 'Alle Bestellerinnerungen wurden versendet');
        return back();

    }

I become a Error Message:

Maximum execution time of 30 seconds exceeded

Am I doing something wrong?

Activity icon

Replied to DomPDF Error !!!

Ähm ok, i thinks i must create a directory. Sorry for the question :)

Activity icon

Started a new conversation DomPDF Error !!!

Hey Guys,

I use the DomPDF package. When I load a view, I get the following error:

fopen(C:\xampp\htdocs\PFPortal\storage\fonts/\e9147d504d81ac94f954aeadcaa831b0.ufm): failed to open stream: No such file or directory

Can anyone help ?

Thx

Sep
10
1 year ago
Activity icon

Replied to German Date Substract 1 Day

thx i use the carbon snippet!

Activity icon

Started a new conversation German Date Substract 1 Day

Hey Guys,

I have a german date 12.09.2018. Now I would like to deduct 1 day so 11.09.2018.

$date = $request->deliverydate;
$date_1 = date('dd.mm.Y', strtotime('-1 Day', strtotime('$date')));

My Result is: "3131.1212.1969"

what am I doing wrong?

Aug
31
1 year ago
Activity icon

Replied to Name Of Input Fields

Yes, now i have the Key's, but i need the values of the input fields. How can i run a foreach Loop over the filled Fields and send the filled Field via mail.

I looking for example???

Activity icon

Started a new conversation Name Of Input Fields

Hi Guys,

i have a question about Form Fields.

I have a form with about 56 fields. Now I would like to mail this content, but I do not want every field.

 $ title = $ request-> input ('title');

passed to the builder. Special about an array or a loop.

Anyone know how to get the names of the input fields?

Aug
29
1 year ago
Activity icon

Replied to Laravel Jquery Get Variable Into A $.getJSON Request

    public function show(User $user) {

        $user = User::where('id', $user->id)->get();
        return response()->json($user);

    }

Thats work's

Thanks

Activity icon

Replied to Laravel Jquery Get Variable Into A $.getJSON Request

Hi,

My Controller:

    public function show(User $user) {

        $user = User::where('id', $user->id)->first();
        return json_decode($user);

    }

My Jquery:

    $('#selectCustomer')
        .editableSelect()
        .on('select.editable-select', function (e, li) {
            $.getJSON('/usersshow/'+li.val()+'', function (data) {
              console.log(data);
            });
        });

I still have a little problem. I changed the code. Now I constantly get an error message:

500 (internal server error)

Do you have an idea ??

Activity icon

Started a new conversation Laravel Jquery Get Variable Into A $.getJSON Request

Hey Guys,

I need your help. How do I pass a variable li.val () to the getJSON request??


 $('#selectCustomer')
        .editableSelect()
        .on('select.editable-select', function (e, li) {
            console.log(li.val());
            $.getJSON("{{ route('users.show', +li.val()+) }}", function (data) {
              console.log(data);
            });

            $('#user_name').val();
            $('#last-selected').html(
                li.val() + '. ' + li.text()
            );
        });

Thanks

Aug
23
1 year ago
Activity icon

Replied to Jquery And Add New Row +data To Select Field

ok I have a new row ... but the data of the foreach loop are not available. I really have no idea what that is.

Activity icon

Started a new conversation Jquery And Add New Row +data To Select Field

Hello,

I have a problem I would like to insert via jquery in a table a new line. so far so good now i would like to pass data into a select field again and again.

my jquery code:

 $(document).ready(function(){
        var i=1;
        $("#add_row").click(function(){b=i-1;
            $('#addr'+i).html($('#addr'+b).html()).find('td:first-child').html(i+1);
            $('#tab_logic').append('<tr id="addr'+(i+1)+'"></tr>');
            i++;
        });
        $("#delete_row").click(function(){
            if(i>1){
                $("#addr"+(i-1)).html('');
                i--;
            }
            calc();
        });

        $('#tab_logic tbody').on('keyup change',function(){
            calc();
        });
        $('#tax').on('keyup change',function(){
            calc_total();
        });


    });

and my html Code:

 <tr id='addr0'>
    <td>1</td>
        <td>
               <select name="produkt[]" class="editSelect form-control form-control-sm">
                       @foreach($articles as $article)
                            <option value="2">{{ $article->article_name }}</option>
                       @endforeach
                </select>
           </td>
           <td><input type="number" name='qty[]' placeholder='Enter Qty' class="form-control qty" step="0" min="0"/></td>
           <td><input type="number" name='price[]' placeholder='Enter Unit Price' class="form-control price" step="0.00" min="0"/></td>
            <td><input type="number" name='total[]' placeholder='0.00' class="form-control total" readonly/></td>
</tr>

When I insert a new line I do not get the data $ article in line 2 anymore.

Why ?

Thank you

Aug
19
1 year ago
Activity icon

Replied to Update Validation

update:

I have solved the problem with jquery.

default Layout

$(document).on('change', '.unitprice', function() {
    $(this).val($(this).val().replace(/,/g, '.'));
});

Validation:

    $data = $this->validate(request(), [
        'article_name' => 'required',
        'article_description' => 'required|max:255',
        'article_number' => 'required',
        'article_nettoprice' => 'numeric|between:0.00, 999999.99',
        'article_tax_id' => 'required',
        'article_bruttoprice' => 'numeric|between:0.00, 999999.99',
        'article_unit_id' => 'required',
        'article_selfprice' => 'numeric|between:0.00, 999999.99'

    ]);

Thanks for help

Activity icon

Started a new conversation Update Validation

Hey Guys,

i have a question about update validation:

My Code:

´´´ public function update(Article $article) {

    $data = $this->validate(request(), [
        'article_name' => 'required',
        'article_description' => 'required|max:255',
        'article_number' => 'required',
        'article_nettoprice' => array([
            'required',
            'regex:/^[0-9]{1,3}(,[0-9]{3})*(\.[0-9]+)*$/']),
        'article_tax_id' => 'required',
        'article_bruttoprice' => 'numeric|between:0.00, 999999.99',
        'article_unit_id' => 'required',
        'article_selfprice' => 'numeric|between:0.00, 999999.99'

    ]);


    $article->update(request()->except('_token'));
    Session::flash('message', 'Artikel erfolgreich aktualisiert');
    return back();
}

´´´

When I pass an invalid number of article_nettorprice (80,011ll) I get the following SQL error message:

SQLSTATE[01000]: Warning: 1265 Data truncated for column 'article_nettoprice' at row 1 (SQL: update articles set article_nettoprice = 80.04gg, updated_at = 2018-08-19 08:21:31 where id = 6)

Ok my question:

why I will not be back in the validation on the previous page with the note net price wrong.

Thank you

Aug
16
1 year ago
Activity icon

Replied to Session Variable After Login Action

Hi,

If I use this code,

    protected function authenticated(Request $request, $user)
    {
        $userdata = $request->session()->put('CompanyName', $user->company_name);
    }

I get the following error message

Argument 1 passed to App\Http\Controllers\Auth\LoginController::authenticated() must be an instance of App\Http\Controllers\Auth\Request, instance of Illuminate\Http\Request given, called in C:\xampp\htdocs\mayWaWi\vendor\laravel\framework\src\Illuminate\Foundation\Auth\AuthenticatesUsers.php on

I do not understand that somehow

Activity icon

Started a new conversation Session Variable After Login Action

I would like to save session variables after login. Unfortunately, I can not find the entry point. Where should I start the session ??? LoginController ??? I use the login system Auth provided by Laravel ...

thank you for your help

Aug
05
1 year ago
Activity icon

Replied to Blade Output

yes its work

thx