vendredi 2 mars 2018

Laravel : Config value set at runtime is shared among concurrent requests

I am using laravel 5.1. I have read that if any config is set at runtime, its new value is available only in the current request. However, I am experiencing that this is not true for concurrent requests. If two concurrent requests are setting and getting configs then config value gets shared. How can this be avoided?



via Chebli Mohamed

Update on "user" and "technicien" with one to one connection

I have two tables user and technician with one to one connection, technician inherits from user. After editing technician information through edit form and saving no update happens on tables user and technician. and no errors as well.Here is my code Could anyone help me with this, please ? Thank you for the attention you give to my question and for not judging me.

Controllers

public function edit($id)
{
    $technicien=technicien::find($id);
    $user = $technicien->user;
    return view('technicien.edit',['technicien'=>$technicien])->with('user',$user);
}

public function update(Request $request, $id)
{
    // do some request validation

    $technicien=technicien::find($id);
    $technicien->update($request->all());
    $technicien->user->update($request->get('user'));
    $user->nom = $request->update('nom');

    return redirect('/technicien');
    }

View

 @extends('Layouts/app')
 @extends('Layouts.master')
 @section('content')
<div class="container">
    <div class="row">
        <div class="col-md-10">
            <h1>Modifier Technicien</h1>
        <form action="" method="update">
        
        


             <div class="form-group">
            <label for="nom">Nom</label>
            <input id="nom" type="text" class="form-control" name="user[nom]" value="" >
        </div>
        <div class="form-group">
            <label for="prenom">Prenom</label>
            <input id="prenom" type="text" class="form-control" name="user[prenom]" value="" >
        </div>
        <div class="form-group">
            <label for="prenom">Email</label>
            <input id="prenom" type="text" class="form-  control" name="user[email]" value="" >
        </div>

        <div class="form-group">
            <label for="">moyenne Avis</label>
            <input type="text"  name="moyenne_avis" class="form-control" value ="" >
        </div>
        <div class="form-group">
            <label for="">Etat Technicien</label>
            <input type="text"  name="actif" class="form-control" value ="" >
        </div>

        <div class="form-group">
            <input type="submit" value="enregistrer"        class="form-control btn btn-primary">
        </div>
            </div>




        </form>
    </div>
</div>
@endsection

Route.php

Route::get('/technicien/{id}/edit', 'TechnicienController@edit'); Route::patch('/technicien/{id}', 'TechnicienController@update')->name('technicien.update');



via Chebli Mohamed

update on "user" and "technicien" whith one to one connection

I have two tables user and technicien with one to one connection, technicien inherits from user. After editing technicien information through edit form and saving no update happens on tables user and technicien. and no errors as well.Here is my code Could anyone help me with this please ? Thank you

controllers

public function edit($id)
{
$technicien=technicien::find($id);
$user = $technicien->user;
return view('technicien.edit',['technicien'=>$technicien])-
>with('user',$user);
}

public function update(Request $request, $id)
{
// do some request validation

$technicien=technicien::find($id);
$technicien->update($request->all());
$technicien->user->update($request->get('user'));
$user->nom = $request->update('nom');

return redirect('/technicien');
}

View

@extends('Layouts/app')
@extends('Layouts.master')
@section('content')
<div class="container">
<div class="row">
    <div class="col-md-10">
        <h1>Modifier Technicien</h1>
    <form action="" method="update">
    
    


         <div class="form-group">
        <label for="nom">Nom</label>
        <input id="nom" type="text" class="form-control" name="user[nom]" value="" >
    </div>
    <div class="form-group">
        <label for="prenom">Prenom</label>
        <input id="prenom" type="text" class="form-control" name="user[prenom]" value="" >
    </div>
    <div class="form-group">
        <label for="prenom">Email</label>
        <input id="prenom" type="text" class="form-control" name="user[email]" value="" >
    </div>

    <div class="form-group">
        <label for="">moyenne Avis</label>
        <input type="text"  name="moyenne_avis" class="form-control" value ="" >
    </div>
    <div class="form-group">
        <label for="">Etat Technicien</label>
        <input type="text"  name="actif" class="form-control" value ="" >
    </div>

    <div class="form-group">
        <input type="submit" value="enregistrer" class="form-control btn btn-primary">
    </div>
        </div>

    </form>
</div>
</div>
@endsection

route.php

Route::get('/technicien/{id}/edit', 'TechnicienController@edit');
Route::patch('/technicien/{id}', 'TechnicienController@update')-
>name('technicien.update');



via Chebli Mohamed

jeudi 1 mars 2018

Class 'Anand\LaravelPaytmWallet\PaytmWalletServiceProvider' not found

I tried to install Laravel Paytm Wallet plugin from AnandSiddharth using composer on my GoDaddy deluxe shared hosting server. I was unable to install it in laravel folder. I copied the vendor files from my desktop to the server and updated config/app.php page in providers and alias category. Then the web server throws an error

Class 'Anand\LaravelPaytmWallet\PaytmWalletServiceProvider' not found

I tried to install it in server home folder and move to vendor but it is showing the same error. The composer.json file gets updated. You can see the screenshots. Any working solution will be helpful. Thanks.

error Log

FatalThrowableError in ProviderRepository.php line 146:
Class 'Anand\LaravelPaytmWallet\PaytmWalletServiceProvider' not found in ProviderRepository.php line 146
at ProviderRepository->createProvider('Anand\LaravelPaytmWallet\PaytmWalletServiceProvider') in ProviderRepository.php line 114
at ProviderRepository->compileManifest(array('Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Routing\ControllerServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Pipeline\PipelineServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'App\Providers\AppServiceProvider', 'App\Providers\AuthServiceProvider', 'App\Providers\EventServiceProvider', 'App\Providers\RouteServiceProvider', 'Anand\LaravelPaytmWallet\PaytmWalletServiceProvider')) in ProviderRepository.php line 60
at ProviderRepository->load(array('Illuminate\Foundation\Providers\ArtisanServiceProvider', 'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Broadcasting\BroadcastServiceProvider', 'Illuminate\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Routing\ControllerServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Database\DatabaseServiceProvider', 'Illuminate\Encryption\EncryptionServiceProvider', 'Illuminate\Filesystem\FilesystemServiceProvider', 'Illuminate\Foundation\Providers\FoundationServiceProvider', 'Illuminate\Hashing\HashServiceProvider', 'Illuminate\Mail\MailServiceProvider', 'Illuminate\Pagination\PaginationServiceProvider', 'Illuminate\Pipeline\PipelineServiceProvider', 'Illuminate\Queue\QueueServiceProvider', 'Illuminate\Redis\RedisServiceProvider', 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', 'Illuminate\Session\SessionServiceProvider', 'Illuminate\Translation\TranslationServiceProvider', 'Illuminate\Validation\ValidationServiceProvider', 'Illuminate\View\ViewServiceProvider', 'App\Providers\AppServiceProvider', 'App\Providers\AuthServiceProvider', 'App\Providers\EventServiceProvider', 'App\Providers\RouteServiceProvider', 'Anand\LaravelPaytmWallet\PaytmWalletServiceProvider')) in Application.php line 507
at Application->registerConfiguredProviders() in RegisterProviders.php line 17
at RegisterProviders->bootstrap(object(Application)) in Application.php line 203
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 222
at Kernel->bootstrap() in Kernel.php line 117
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
at Kernel->handle(object(Request)) in index.php line 53

config/app.php

Anand\LaravelPaytmWallet\PaytmWalletServiceProvider::class,



via Chebli Mohamed

Laravel : no errors and no update on database happens after saving the edit

I have two tables user and technicien with one to one connection. After editing technicien information through edit form and saving no update happens on database and no errors as well.Here is my code Could anyone help me with this please ? Thank you

controllers

public function edit($id)
{
    $technicien=technicien::find($id);
    $user = $technicien->user;
    return view('technicien.edit',['technicien'=>$technicien])->with('user',$user);
}

public function update(Request $request, $id)
{
    // do some request validation

    $technicien=technicien::find($id);
    $technicien->update($request->all());
    $technicien->user->update($request->get('user'));
    $user->nom = $request->update('nom');

    return redirect('/technicien');
}

View

@extends('Layouts/app')
@extends('Layouts.master')
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-10">
            <h1>Modifier Technicien</h1>
        <form action="" method="update">
        
        


             <div class="form-group">
            <label for="nom">Nom</label>
            <input id="nom" type="text" class="form-control" name="user[nom]" value="" >
        </div>
        <div class="form-group">
            <label for="prenom">Prenom</label>
            <input id="prenom" type="text" class="form-control" name="user[prenom]" value="" >
        </div>
        <div class="form-group">
            <label for="prenom">Email</label>
            <input id="prenom" type="text" class="form-control" name="user[email]" value="" >
        </div>

        <div class="form-group">
            <label for="">moyenne Avis</label>
            <input type="text"  name="moyenne_avis" class="form-control" value ="" >
        </div>
        <div class="form-group">
            <label for="">Etat Technicien</label>
            <input type="text"  name="actif" class="form-control" value ="" >
        </div>

        <div class="form-group">
            <input type="submit" value="enregistrer" class="form-control btn btn-primary">
        </div>
            </div>




        </form>
    </div>
</div>
@endsection

route.php

Route::get('/technicien/{id}/edit', 'TechnicienController@edit');
Route::patch('/technicien/{id}', 'TechnicienController@update')-
>name('technicien.update');



via Chebli Mohamed

Laravel :error when updating the database after editing data

I have two tables table "technician" and table "user" with a connection one to one and I have a form through which I edit the technician information. When I save the changes I get an error and the update doesn't work.Here is my form my code and a screenshot of the error Thank you in advance.

route.php

Route::get('/technicien/{id}/edit', 'TechnicienController@edit');
Route::patch('/technicien/{id}', 'TechnicienController@update')-
>name('technicien.update');

edit.php

@extends('Layouts/app')
@extends('Layouts.master')
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-10">
            <h1>Modifier Technicien</h1>
        <form action="" method="update">
        
        


             <div class="form-group">
            <label for="nom">Nom</label>
            <input id="nom" type="text" class="form-control" name="user[nom]" value="" >
        </div>
        <div class="form-group">
            <label for="prenom">Prenom</label>
            <input id="prenom" type="text" class="form-control" name="user[prenom]" value="" >
        </div>
        <div class="form-group">
            <label for="prenom">Email</label>
            <input id="prenom" type="text" class="form-control" name="user[email]" value="" >
        </div>

        <div class="form-group">
            <label for="">moyenne Avis</label>
            <input type="text"  name="moyenne_avis" class="form-control" value ="" >
        </div>
        <div class="form-group">
            <label for="">Etat Technicien</label>
            <input type="text"  name="actif" class="form-control" value ="" >
        </div>

        <div class="form-group">
            <input type="submit" value="enregistrer" class="form-control btn btn-primary">
        </div>
            </div>




        </form>
    </div>
</div>
@endsection

controller1.php

public function edit($id)
{
    $technicien=technicien::find($id);
    $user = $technicien->user;
    return view('technicien.edit',['moyenne_avis'=>$technicien],
    ['actif'=>$technicien],['user_id'=>$technicien])->with('user',$user);
}

controller2.php

public function update(Request $request, $id)
{
    // do some request validation

    $technicien=technicien::find($id);
    $technicien->update($request->all());
    $technicien->user->update($request->get('user'));
    return redirect('technicien');
}

enter image description here



via Chebli Mohamed

Laravel : Property [nom] does not exist on this collection instance

i have two tables user and technicien with one to one connection. When i edit a technicien using my form "Modifier Techicien" below i want the form to be autofilled with current information from both tables user and technicien. At this time the form is autofilled with only information from technicien. Could anyone help me with this please ?

enter image description here

controller

public function edit($id)
{
    $technicien=technicien::find($id);
    $users = user::orderBy('id', 'asc')->get();
    return view('technicien.edit',['moyenne_avis'=>$technicien],
['actif'=>$technicien],['user_id'=>$technicien])-
>with('users',$users);
}

public function update(Request $request, $id)
{
    // do some request validation
    $technicien=technicien::find($id);
    $technicien->update($request->all());
    return redirect('technicien');
}

edit.blade.php

@extends('Layouts/app')
@extends('Layouts.master')
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-10">
            <h1>Modifier Technicien</h1>
        <form action="" method="post">
        
        


            <div class="form-group">
                <label for="">Nom</label>
                <input id="nom" type="text" class="form-control" name="nom" value="" >
            </div>
            <div class="form-group">
                <label for="">Prenom</label>
                <input id="nom" type="text" class="form-control" name="nom" value="" >
            </div>

            <div class="form-group">
                <label for="">moyenne Avis</label>
                <input type="text"  name ="moyenne_avis" class="form-control" value ="" >
            </div>
            <div class="form-group">
                <label for="">Etat Technicien</label>
                <input type="text"  name ="actif" class="form-control" value ="" >
            </div>



            <div class="form-group">

                <input type="submit" value = "enregistrer" class="form-control btn btn-primary">
            </div>
        </form>
    </div>
</div>
@endsection



via Chebli Mohamed