mDelshad

mDelshad

Member Since 7 Months Ago

Experience Points 4,540
Experience Level 1

460 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 Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

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

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

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

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

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

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

09 Apr
2 weeks ago

mDelshad started a new conversation Laravel Seeder Array To String Conversion

my migration :

        Schema::create('money', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('slug');
            $table->json('details');
            $table->timestamps();
        });

and seeder

        Money::create([
            'name' => 'pay',
            'slug' => 'PayPal',
            'details' => ([
                'status' => true,
                'sell' => [
                    'status' => true,
                    'sellesPrice' => '12300',
                ],
                'buy'=>[
                    'status'=> true,
                    'PurchasePrice'=>'11265',
                ],
            ])
        ]);
    }

but i get this error :

   Illuminate\Database\QueryException  : Array to string conversion (SQL: insert into `money` (`name`, `slug`, `details`, `updated_at`, `created_at`) values (پی پال, PayPal, 1, 2019-04-09 16:00:26, 2019-04-09 16:00:26))

  at M:\source\boiler\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   ErrorException::("Array to string conversion")
      M:\source\boiler\vendor\laravel\framework\src\Illuminate\Database\MySqlConnection.php:80

  2   PDOStatement::bindValue([])
      M:\source\boiler\vendor\laravel\framework\src\Illuminate\Database\MySqlConnection.php:80

  Please use the argument -v to see more details.

what is problem?

08 Apr
2 weeks ago

mDelshad started a new conversation Get Data From Xml Api

hi guys

i want get the currency rate from this api :

http://parsijoo.ir/api?serviceType=price-API&query=Currency

but this is xml api and I do not know how can i get data... i was convert this xml to json, With this code :

$response = file_get_contents('http://parsijoo.ir/api?serviceType=price-API&query=Currency');       
    $xml = simplexml_load_string($response);
    $json = json_encode($xml);
    $array = json_decode($json,TRUE);

But returns (name, price, change, percent ) values empty what is problem?

07 Apr
2 weeks ago

mDelshad started a new conversation Storing Order Information In Table

I have these services on the site

Buy PayPal - Perfect Money and ...
Registration of exam
GIF card services

How should the structure of the order table be? Because each service receives different information from the user, for example:

Registration of exam => receives (exam's price, time, exam's site and...) from user
and

how can storing this information on order's table??

05 Apr
2 weeks ago

mDelshad started a new conversation Create Custom Input For Each Product

i want the admin will be can create custom input for each product (optional) for example you want add a product And when the user orders that product, you also want to get some information from the user that is only needed for this product and not other products. so you can when create the this product, add a custom input for it that show to user in order form

I want to create this feature (as described in the screenshot below).

https://imgurl.ir/uploads/u175269_.png

Is this the right way? And if so, how can I put any row inside an array؟

29 Mar
3 weeks ago

mDelshad started a new conversation Many Error In Project

hi

i'm install this package for code analysis

https://github.com/nunomaduro/larastan

and when i run this command

php artisan code:analyse

it Found 203 errors

Most of the errors are the same

 ------ -----------------------------------------------------------------------------------------------------------------
  Line   app\Repositories\Frontend\Auth\UserRepository.php
 ------ -----------------------------------------------------------------------------------------------------------------
  37     PHPDoc tag @param has invalid value ($token): Unexpected token "$token", expected TOKEN_IDENTIFIER at offset 19
  54     PHPDoc tag @param has invalid value ($uuid): Unexpected token "$uuid", expected TOKEN_IDENTIFIER at offset 19
  56     Call to an undefined method Illuminate\Database\Eloquent\Model::uuid().
  73     PHPDoc tag @param has invalid value ($code): Unexpected token "$code", expected TOKEN_IDENTIFIER at offset 19
  100    Parameter #1 $prefix of function uniqid expects string, int given.
  108    If condition is always true.
  112    Call to an undefined method Illuminate\Database\Eloquent\Model::assignRole().
  124    Call to an undefined method Illuminate\Database\Eloquent\Model::notify().
  142    PHPDoc tag @param has invalid value ($id): Unexpected token "$id", expected TOKEN_IDENTIFIER at offset 25
  186    Call to an undefined method
         Illuminate\Database\Eloquent\Collection|Illuminate\Database\Eloquent\Model::canChangeEmail().
  196    Parameter #1 $prefix of function uniqid expects string, int given.
  198    Call to an undefined method
         Illuminate\Database\Eloquent\Collection|Illuminate\Database\Eloquent\Model::notify().
  223    PHPDoc tag @param has invalid value ($input): Unexpected token "$input", expected TOKEN_IDENTIFIER at offset 24
  244    PHPDoc tag @param has invalid value ($code): Unexpected token "$code", expected TOKEN_IDENTIFIER at offset 19
  270    PHPDoc tag @param has invalid value ($data): Unexpected token "$data", expected TOKEN_IDENTIFIER at offset 19
  270    PHPDoc tag @param has invalid value ($provider): Unexpected token "$provider", expected TOKEN_IDENTIFIER at
         offset 40
  302    Parameter #1 $user of class App\Events\Frontend\Auth\UserProviderRegistered constructor expects
         App\Models\Auth\User, Illuminate\Database\Eloquent\Model given.
  306    Call to an undefined method
         Illuminate\Database\Eloquent\Model|static(App\Repositories\Frontend\Auth\UserRepository)::hasProvider().
  308    Call to an undefined method
         Illuminate\Database\Eloquent\Model|static(App\Repositories\Frontend\Auth\UserRepository)::providers().
  316    Call to an undefined method
         Illuminate\Database\Eloquent\Model|static(App\Repositories\Frontend\Auth\UserRepository)::providers().
  334    PHPDoc tag @param has invalid value ($fullName): Unexpected token "$fullName", expected TOKEN_IDENTIFIER at
         offset 19
 ------ -----------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------
  Line   app\Repositories\system\Document\DocumentRepository.php
 ------ -------------------------------------------------------------------------------------
  8      Class App\Notifications\backend\auth\RejectDocument referenced with incorrect case:
         App\Notifications\Backend\Auth\RejectDocument.
  9      Class App\Notifications\backend\auth\VerifyDocument referenced with incorrect case:
         App\Notifications\Backend\Auth\VerifyDocument.
  35     Variable $input might not be defined.
  35     Variable $input might not be defined.
  57     Class App\Notifications\backend\auth\VerifyDocument referenced with incorrect case:
         App\Notifications\Backend\Auth\VerifyDocument.
  68     Class App\Notifications\backend\auth\RejectDocument referenced with incorrect case:
         App\Notifications\Backend\Auth\RejectDocument.
 ------ -------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------
  Line   app\Rules\Auth\UnusedPassword.php
 ------ ---------------------------------------------------------------------------------------------------------------
  19     PHPDoc tag @var has invalid value (): Unexpected token "\r\n     ", expected TOKEN_IDENTIFIER at offset 16
  27     PHPDoc tag @param has invalid value ($user): Unexpected token "$user", expected TOKEN_IDENTIFIER at offset 63
 ------ ---------------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------
  Line   app\helpers.php
 ------ -----------------------------------------------------------------------------------------------------------------
  50     PHPDoc tag @param has invalid value ($folder): Unexpected token "$folder", expected TOKEN_IDENTIFIER at offset
         127
  53     Class RecursiveDirectoryIterator referenced with incorrect case: recursiveDirectoryIterator.
  54     Class RecursiveIteratorIterator referenced with incorrect case: recursiveIteratorIterator.
  57     Call to an undefined method RecursiveIteratorIterator::isDot().
  57     Call to an undefined method RecursiveIteratorIterator::isFile().
  57     Call to an undefined method RecursiveIteratorIterator::isReadable().
  99     PHPDoc tag @param has invalid value ($url): Unexpected token "$url", expected TOKEN_IDENTIFIER at offset 25
  114    PHPDoc tag @param has invalid value ($url): Unexpected token "$url", expected TOKEN_IDENTIFIER at offset 25
  129    PHPDoc tag @param has invalid value ($cancel_to): Unexpected token "$cancel_to", expected TOKEN_IDENTIFIER at
         offset 26
  129    PHPDoc tag @param has invalid value ($title): Unexpected token "$title", expected TOKEN_IDENTIFIER at offset 59
  143    PHPDoc tag @param has invalid value ($title): Unexpected token "$title", expected TOKEN_IDENTIFIER at offset 26
  156    PHPDoc tag @param has invalid value ($str): Unexpected token "$str", expected TOKEN_IDENTIFIER at offset 19
 ------ -----------------------------------------------------------------------------------------------------------------

 [ERROR] Found 203 errors

But at the time of run my project, I'm not getting any error and everything is correct

what is your opinion Can these errors make problems?

20 Mar
1 month ago

mDelshad started a new conversation Can't Update Config File

i can't update config file ... what is problem

  Config::set('gateways.zarinpal.merchat-id' ,'xxxxxxxxxxxx');
  'zarinpal'     => [
        'name'         => 'Zarinpal',
        'active'       => true,
        'order'        => 11,
        'merchant-id'  => xxx',
        'type'         => 'normal',             // Types: [zarin-gate || normal || zarin-gate-sad || zarin-gate-sep]
        'server'       => 'de',                // Servers: [germany || iran || test]
        'description'  => 'description',
        'callback-url' => '/',
    ],

There are no errors

mDelshad started a new conversation Is It Better To Store Platform Configuration In Database Or A File?

what is better/faster approach?

mDelshad left a reply on Can't Use Helper Functions In Config File

@ftiersch @johnbaron I have a lot of data (Perhaps more than 20 items) to be recorded in the files in the config folder Now if I use AppServiceProvider this way

  config([
            'app.name' => getSetting('app_name'),
            'sms.drivers.kavenegar.apiKey' => getSetting('kavenegar_api'),
            'sms.drivers.kavenegar.from' => getSetting('number'),
            ]);

There are many queries that push the server If I read the cache, many more queries will not be executed and there will not be much pressure on the server. It is true? And in terms of the number of data I've said, perhaps more than 20, do you think this is a problem? Or there is no problem with the number of data

19 Mar
1 month ago

mDelshad started a new conversation Get Values With A Specified Prefix From The Table

Hello I have the general settings and payment gateway settings.

The settings are saved as their key:

general.setting_name  => general settings
gateway.setting_name => payment gateway settings

Now how can I get the only values ​​that have a general prefix?

18 Mar
1 month ago

mDelshad left a reply on Best Solution For App Settings

@TYKUS - I save the settings to the table in this way

    public function store(Request $request)
    {
        $data = $request->only('app_name','app_desc','company_phone','company_address','service_wage'
                ,'kavenegar_api'
                ,'kavenegar_number'
        );
        foreach ($data as $key => $value) {
            Setting::updateOrInsert(
                ['name' => $key],
                ['val' => $value]
            );
        }
        return redirect()->back()->withFlashSuccess("saved");
    }

now how can i cache in loop? That is correct?

Cache::forever('key', 'value');

and if cache cleared..how should get the settings from db and again store in the cache?

mDelshad started a new conversation Best Solution For App Settings

If I save the settings in the database, there are definitely a lot of requests to the database to get the settings and this will put a lot of pressure on the server. Now if I save these settings inside a file that will be placed in the Config folder, do you think it's the right way? And security? You do not have the right solution?

mDelshad started a new conversation Can't Use Helper Functions In Config File

hi

I can not use the helper settings in the config folder files

What is your solution to this problem?

15 Mar
1 month ago

mDelshad started a new conversation Problem In Use Switchery In Laravel

i'm use switchery for checkbox...But only one of the checkboxes takes a stylist. The rest of the checkboxes have a typical style

screenshot:

https://screenshots.firefox.com/x3TSE0U1kd4AWgNg/127.0.0.1

js:

import Switchery from './switchery.min'


var elems = Array.prototype.slice.call(document.querySelectorAll('.switch-input'));

elems.forEach(function(html) {
  var switchery = new Switchery(html);
});

and blade :

                                        <td>
                                            @if($roles->count())
                                                @foreach($roles as $role)
                                                    <div class="card">
                                                        <div class="card-header">
                                                            <div class="checkbox d-flex align-items-center">
                                                                {{ html()->label(
                                                                        html()->checkbox('roles[]', in_array($role->name, $userRoles), $role->name)
                                                                                ->class('switch-input')
                                                                                ->id('role-'.$role->id)
                                                                        . '<span class="switch-slider" data-checked="on" data-unchecked="off"></span>')
                                                                    ->class('switch switch-label switch-pill switch-primary mr-2')
                                                                    ->for('role-'.$role->id) }}
                                                                {{ html()->label(ucwords($role->name))->for('role-'.$role->id) }}
                                                            </div>
                                                        </div>
                                                        <div class="card-body">
                                                            @if($role->id != 1)
                                                                @if($role->permissions->count())
                                                                    @foreach($role->permissions as $permission)
                                                                        <i class="fas fa-dot-circle"></i> {{ ucwords($permission->name) }}
                                                                    @endforeach
                                                                @else
                                                                    @lang('labels.general.none')
                                                                @endif
                                                            @else
                                                                @lang('labels.backend.access.users.all_permissions')
                                                            @endif
                                                        </div>
                                                    </div><!--card-->
                                                @endforeach
                                            @endif
                                        </td>

mDelshad left a reply on Add Html Tag In Lang File

@SNAPEY - How can i do this?

mDelshad left a reply on Add Html Tag In Lang File

@cronix @esmaill23

throw new GeneralException({!! __('exceptions.frontend.auth.confirmation.resend', ['url' => route('frontend.auth.account.confirm.resend', $user->{$user->getUuidName()})]!!}));

this error displayed :

syntax error, unexpected 'throw' (T_THROW)
14 Mar
1 month ago

mDelshad started a new conversation Add Html Tag In Lang File

hi

i'm write a html tag in a lang file

'resend' => 'Your account is not confirmed. Please click the confirmation link in your e-mail, or <a href=":url">click here</a> to resend the confirmation e-mail.',

But it does not display well on the output :

https://screenshots.firefox.com/WEQzcvKw2RXmBaIS/127.0.0.1
09 Mar
1 month ago

mDelshad started a new conversation Undefined Variable In Notification

i'm create a markdown notification, but when i want send a email this error displayed

notification class :

<?php

namespace App\Notifications\backend\auth;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class RejectDocument extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
     protected $description,$name;
    public function __construct($description , $name)
    {
        $this->description = $description;
        $this->name = $name;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail'];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage)
        ->with($this->description,$this->name)
        ->subject('Reject Docs')
        ->markdown('emails.backend.RejectDocument');
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            //
        ];
    }
}

blade file :

@component('mail::message')
hello {{$name}}
@component('mail::panel')
  {{$description}}
@endcomponent

Thanks,<br>
{{ config('app.name') }}
@endcomponent

and this for send:

  $user = App\Models\Auth\User::first();
    $user->notify(new RejectDocument("Your Document Rejected",$user->name));

08 Mar
1 month ago

mDelshad started a new conversation Change Email Template

Can you provide an email template for larvae? I wanted to change the template, but it had a lot of problems

06 Mar
1 month ago

mDelshad left a reply on Submit Form With Sweet Alert

@TANGENTE - Still has problem... this is html code

                <button type="button" id="verifyDoc" class="btn btn-success">تایید</button>
                <form action="{{route('admin.auth.document.update' , [$document->id])}}" id="verifyDocForm" method="post">
                                    {{ csrf_field() }}
                                    {{method_field('PATCH')}}
                  <input type="hidden" name="actionCode" value="1">
                </form>

mDelshad left a reply on Submit Form With Sweet Alert

@TANGENTE - If you mean this I tried it, but it has the it problem

jQuery(document).ready(function(){
    jQuery('button#verifyDoc').on('click', function(event ){
event.preventDefault();
      swal({
        title: "",
        text: "...",
        type: "info",
        showCancelButton: true,
            buttonsStyling: true,
        confirmButtonText: "ok",
        cancelButtonText: "cancel",
      }).then(function(isConfirm){
            if(isConfirm){
        jQuery("#verifyDocForm").submit();
            }
      });
    });
});

mDelshad started a new conversation Submit Form With Sweeto Alert

What is the problem with this code I want to submit if user click on confirm But in this code, if user click Cancel or outside of the sweet alert, the form will still be submitted

jQuery(document).ready(function(){
    jQuery('button#verifyDoc').on('click', function(){
      swal({
        title: "",
        text: "...",
        type: "info",
        showCancelButton: true,
            buttonsStyling: true,
        confirmButtonText: "ok",
        cancelButtonText: "cancel",
      }).then(function(isConfirm){
            if(isConfirm){
        jQuery("#verifyDocForm").submit();
            }
      });
    });
});
04 Mar
1 month ago

mDelshad left a reply on Update User Information

@CRONIX - thank you I will certainly edit this

mDelshad started a new conversation Update User Information

this is controller for update user information

    public function update($id, array $input)
    {

        $user = $this->getById($id);
        $user->first_name = $input['first_name'];
        $user->last_name = $input['last_name'];
        $user->avatar_type = $input['avatar_type'];
        $user->National_Code = $input['National_Code'];
        $user->phone_number = $input['phone_number'];
        $user->mobile_number = $input['mobile_number'];
        $user->state = $input['state'];
        $user->city = $input['city'];
        $user->address = $input['address'];
        $user->postal_code = $input['postal_code'];

        if ($user->phone_number != $input['phone_number']) {
          $user->phone_verify  = 0;
        }

        if ($user->mobile_number != $input['mobile_number']) {
          $user->mobile_verify  = 0;
        }


        $user->save();
    }


In this code, if the previous number of the user is not equal to the new number, the value of mobile_verify must be 0 , All user information is updated, but this does not change the mobile_verify and phone_verify case

mDelshad started a new conversation Code Analysis

What happens in this code? , What exactly does it do?

preConfirm: function (code) {
                            return new Promise(function (resolve) {
                                setTimeout(function () {
                                    if (email === '[email protected]') {
                                        swal.showValidationError('This email is already taken.')
                                    }
                                    resolve();
                                }, 2000);
                            });
                        },
03 Mar
1 month ago

mDelshad left a reply on Ajax Request In Sweet Alert

@CRONIX - thanks bro, how can i get input value (in sweet alert)?

mDelshad started a new conversation Ajax Request In Sweet Alert

I show to user a sweet alert after sending the activation code...This sweet alert has an input that the user must enter received code and send in the ajax request how can do this?

swal({
                        title: 'enter confirmation code',
                        input: 'text',
                        inputPlaceholder: 'confirmation code',
                        showCancelButton: true,
                        inputClass: 'form-control',
                        inputValidator: function (value) {
                            return !value && 'You need to write something!'
                        }
                    }).then(function (result) {
                        if (result.value) {
                            swal({
                                type: 'success',
                                html: 'code, ' + result.value
                            });
                        }
                    });
02 Mar
1 month ago

mDelshad started a new conversation Get The Distance Between Two Times

I get the updated_atfield of record

And I want to check if beetween the current time and updated_at are more than 3 minutes apart, displaying the expiration message.

How can i do this?

mDelshad started a new conversation Create A Code With Expiration Time

i want add the mobile verification, How can i Create a code with expiration time?

01 Mar
1 month ago

mDelshad left a reply on Create Form Builder

@TRAY2 - Yes, that's exactly that

mDelshad left a reply on Create Form Builder

@MUNAZZIL - thank you But that was not what I meant I want admin can create different forms with ui (in admin panel), not with code

mDelshad started a new conversation Create Form Builder

how can create a form builder like wordpress form builder plugins?

28 Feb
1 month ago

mDelshad left a reply on Call To A Member Function Connection() On Null

@RDELORIER - Thanks,

You could update the config option in the boot method of AppServiceProvider tho.

How can i do this?

mDelshad left a reply on Call To A Member Function Connection() On Null

@MUNAZZIL - I ckecked it

Fatal error: Uncaught RuntimeException: A facade root has not been set. in M:\source\boiler\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:234 Stack trace: #0 M:\source\boiler\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(397): Illuminate\Support\Facades\Facade::__callStatic('replaceNamespac...', Array) #1 M:\source\boiler\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(374): Illuminate\Foundation\Exceptions\Handler->registerErrorViewPaths() #2 M:\source\boiler\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(289): Illuminate\Foundation\Exceptions\Handler->renderHttpException(Object(Symfony\Component\HttpKernel\Exception\HttpException)) #3 M:\source\boiler\vendor\laravel\framework\src\Illuminate\Foundation\Exceptions\Handler.php(188): Illuminate\Foundation\Exceptions\Handler->prepareResponse(Object(Illuminate\Http\Request), Object(Symfony\Component\HttpKernel\Exception\HttpException)) #4 M:\source\boiler\app\Exceptions\Handl in M:\source\boiler\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 234

mDelshad left a reply on Call To A Member Function Connection() On Null

@REALRANDYALLEN - ``` 'name' => getSetting('app_name')


I think the problem is this code:
    return Setting::where('name',$setting)->first()->val;
Because I deleted this code and did not display any errors

mDelshad left a reply on Call To A Member Function Connection() On Null

@REALRANDYALLEN - I tested it, but it again show this error

mDelshad started a new conversation Call To A Member Function Connection() On Null

i'm create a helper to get settings

if (! function_exists('Setting')) {

    /**
     * @param $setting
     *
     * @return string
     */
    function Setting($setting)
    {
        return Setting::where('name',$setting)->first()->val;
    }


}

in config/app.php and Application name i'm set this code Setting('app_name')

but this error displayed

Call to a member function connection() on null

mDelshad started a new conversation SQLSTATE[23000]: Integrity Constraint Violation: 1062 Duplicate Entry

i'm storing data with this code

public function store(Request $request)
    {
        $data = $request->only('app_name','app_desc');
        foreach ($data as $key => $value) {
            Setting::updateOrInsert(
                ['name' => $key, 'val' => $value],
            );
        }
    }

but this error displayed.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'app_name' for key 'settings_name_unique' (SQL: insert into `settings` (`name`, `val`) values (app_name, example site desc))

mDelshad left a reply on Storing Data With Loops

@SERGIU17 - the table just have two field

key => input name,
value => input value

Is this code correct?

 $data = $request->all();
         foreach ($data as $key => $value) {
            User::create([
        'key' => $key;
    'value' =>$value
         ]);
         }

mDelshad started a new conversation Storing Data With Loops

For example, I have ten fields and Each field will be saved at one row How can I save these values ​​using loops?

mDelshad started a new conversation Get All Input Value With Name Attribute

how i can get all input value with name Attribute?