inzmam

Experience

340

0 Best Reply Awards

  • Member Since 2 Months Ago
  • 0 Lessons Completed
  • 0 Favorites

15th February, 2018

inzmam left a reply on Getting Error As "array_merge(): Argument #2 Is Not An Array" • 1 week ago

I have tried the redirect one also that also does not help me it shows as trying to get property of non-object which means item gets deleted but same is not redirected to the page

12th February, 2018

inzmam left a reply on Getting Error As "array_merge(): Argument #2 Is Not An Array" • 1 week ago

Actually i totally don't understand why array_merge()???

inzmam left a reply on Getting Error As "array_merge(): Argument #2 Is Not An Array" • 1 week ago

i have tried the code shared by, but same has not helped me.

inzmam left a reply on Getting Error As "array_merge(): Argument #2 Is Not An Array" • 1 week ago

Thanks for your reply, i have used what you told but now i have got a new error as undefined variable 'post'

inzmam left a reply on Getting Error As "array_merge(): Argument #2 Is Not An Array" • 1 week ago

$post_id is grabbing the id of the post where it will be returned once the comment is deleted from the post. Actually when i'm deleting the comment, it shows me this error and when i'm going back to the page where i had clicked to delete the comment, it shows me a message as your comment has been deleted. I will share few more code that might help you to figure out the issue.

delete.blade.php

Do you really want to delete this comment?

{{Form::model($comment,['route'=>['comments.destroy',$comment->id],'method'=>'DELETE'])}} {{Form::submit('Delete',['class'=>'btn btn-danger btn-block'])}} {{Form::close()}} CommentsController.php

public function delete($id) { $comment=Comment::find($id); return view('comments.delete')->withComment($comment);

}

/**
 * Remove the specified resource from storage.
 *
 * @param  int  $id
 * @return \Illuminate\Http\Response
 */
public function destroy($id)
{
    
    $comment=Comment::find($id);
    $post_id=$comment->post->id;
    $comment->delete();
    Session::flash('success','your comment has been deleted');
    return view('posts.show',$post_id);
}

route: Route::delete('comments/{id}',['uses'=>'[email protected]','as'=>'comments.destroy']); Route::get('comments/{id}/delete',['uses'=>'[email protected]','as'=>'comments.delete']);

below given code is where i start the process of deleting the comment.

inzmam left a reply on Getting Error As "array_merge(): Argument #2 Is Not An Array" • 1 week ago

Thanks for your reply, i don't have any array in fact.

Probabbly i'm getting error here.

public function destroy($id) {

    $comment=Comment::find($id);
    $post_id=$comment->post->id;
    $comment->delete();
    Session::flash('success','your comment has been deleted');
    return view('posts.show',$post_id);
}           

inzmam started a new conversation Getting Error As "array_merge(): Argument #2 Is Not An Array" • 1 week ago

When i am going to delete the comment from post, i am getting error as "array_merge(): Argument #2 is not an array". I am unable to guess the source of this error. Can someone help me this case.

10th January, 2018

inzmam left a reply on Unable To Load Form/Html In Laravel 5.4.36 Version • 1 month ago

yes i did,

app.php

'providers' => [

    /*
     * Laravel Framework Service Providers...
     */
    Illuminate\Auth\AuthServiceProvider::class,
    Illuminate\Broadcasting\BroadcastServiceProvider::class,
    Illuminate\Bus\BusServiceProvider::class,
    Illuminate\Cache\CacheServiceProvider::class,
    Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
    Illuminate\Cookie\CookieServiceProvider::class,
    Illuminate\Database\DatabaseServiceProvider::class,
    Illuminate\Encryption\EncryptionServiceProvider::class,
    Illuminate\Filesystem\FilesystemServiceProvider::class,
    Illuminate\Foundation\Providers\FoundationServiceProvider::class,
    Illuminate\Hashing\HashServiceProvider::class,
    Illuminate\Mail\MailServiceProvider::class,
    Illuminate\Notifications\NotificationServiceProvider::class,
    Illuminate\Pagination\PaginationServiceProvider::class,
    Illuminate\Pipeline\PipelineServiceProvider::class,
    Illuminate\Queue\QueueServiceProvider::class,
    Illuminate\Redis\RedisServiceProvider::class,
    Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
    Illuminate\Session\SessionServiceProvider::class,
    Illuminate\Translation\TranslationServiceProvider::class,
    Illuminate\Validation\ValidationServiceProvider::class,
    Illuminate\View\ViewServiceProvider::class,
    Collective\Html\HtmlServiceProvider::class,

],

'aliases'=>[ 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, ],

composer.json

"require": { "php": ">=5.6.4", "laravel/framework": "5.4.*", "laravel/tinker": "~1.0", "laravelcollective/html": "^5.4.0" },

9th January, 2018

inzmam left a reply on Unable To Load Form/Html In Laravel 5.4.36 Version • 1 month ago

Getting error as Class 'Form' not found

inzmam started a new conversation Unable To Load Form/Html In Laravel 5.4.36 Version • 1 month ago

I want to make use of Form/Html in Laravel 5.4.36 version. I have tried to follow the instructions given in "https://laravelcollective.com/docs/5.4/html" but unfortunately that did not work for me. Can somebody help me in this case?

inzmam left a reply on Unable To Load HTML/Form Helper Laravel 5 • 1 month ago

I am using laravel 5.4.36 version, i have followed the steps as mentioned in laravelcollective.com, but i am unable to use the form and html, please help me somebody

4th January, 2018

inzmam left a reply on Admin And User Login Redirection • 1 month ago

When i log in as an admin it redirects me to admin dashboard but when i log it out it doesn't take me to admin logim page instead takes me to home page....

And when i login as a user, it takes me to admin dashboard which i don't want to happen...

inzmam left a reply on Admin And User Login Redirection • 1 month ago

Somebody...please help me in this case..

2nd January, 2018

inzmam started a new conversation Admin And User Login Redirection • 1 month ago

In my project, i am having a user login page and admin login page. I want my admin login page to redirect to admin-login.blade.php view on successful authentication and redirect back to admin login page on unsucessful, and i also want it redirect to admin-dashboard.blade.php if admin is already authenticated not to the admin login page. I have written code in RedirectIfAuthenticated.php to make it happen as below.

switch ($guard) { case 'admin': if(Auth::guard($guard)->check()) { return redirect()->route('admin.dashboard'); }

            break;
        default:
            if (Auth::guard($guard)->check())
            {
            return redirect('/home');
            }
        break;
    }
    return $next($request);

And in Handler.php as below:-

if ($request->expectsJson()) { return response()->json(['error' => 'Unauthenticated.'], 401); }

    $guard=array_get($exception->guards(),0);
    switch ($guard) {
        case 'admin':
            # code...
            $login='admin.login';
            break;
        
        default:
            # code...
            $login='login';
            break;
    }
    return redirect()->guest(route($login));

web.php

Route::get('/home', '[email protected]')->name('home'); Route::prefix('admin')->group(function() { Route::get('/login','Auth\[email protected]')->name('admin.login'); Route::post('/login','Auth\[email protected]')->name('admin.login.submit'); Route::get('/', '[email protected]')->name('admin.dashboard'); });

25th December, 2017

inzmam left a reply on Base Table Or View Already Exists:1050 Table 'users' Already Exists In Connection.php Line 449 • 1 month ago

Thanks @RamjithAp , it has worked for me. Great help

23rd December, 2017

inzmam left a reply on Base Table Or View Already Exists:1050 Table 'users' Already Exists In Connection.php Line 449 • 2 months ago

can you please show me the code??

inzmam started a new conversation Base Table Or View Already Exists:1050 Table 'users' Already Exists In Connection.php Line 449 • 2 months ago

I am trying to create an admin migration but when i run the migration it shows error which i am unable to fix. However, i have tried a lot to serach an answer for this but didn't get.

php artisan make:migration create_admins_table --create=admins

this command creates migration but shows error while running the same.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.