inzmam

Experience

680

0 Best Reply Awards

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

17th March, 2018

inzmam left a reply on Unable To Upload Video File • 5 months ago

thanks for your reply @Snapey . Issue is fixed now. When i use has() instead of hasFile() it finds the file, after that there was an issue of file size which i fixed it by modifying the correct php.ini file.

Thanks to all of you who have been with me for so long.

inzmam left a reply on Unable To Upload Video File • 5 months ago

Keeping

 $video=$request->file('Upload_video');
 dd($video);

It shows me the file details but when keep the same code inside the if block it does not. Just wanted to know from you what are the possible reasons for @if section not being excuted.

inzmam left a reply on Unable To Upload Video File • 5 months ago

Yeah same i have tried to check if at least it contains the name of the file, then it does not contain the name also because if section is not being executed.

I am surprised when i am uploading the images instead videos, it contains all the details of images but it does not contain the video details while uploading the same.

inzmam left a reply on Unable To Upload Video File • 5 months ago

Yeah i have tried previous answers also, when i am keeping this code

 $vid->filename='inzmam';
 $vid->path='ul haq';

inside the if section to check if this string is printed, then also it does not print it. What i want to bring it to your notice is, my if section itself is not being executed at all. What could be possible reasons for this.

inzmam left a reply on Unable To Upload Video File • 5 months ago

The video size is just 7MB, i have also configured the php.ini file to increase the max file size.

inzmam left a reply on Unable To Upload Video File • 5 months ago

I am sorry, if it has caused confusion.

$vid->filename='inzmam';
$vid->path='ul haq';

was just written for debugging purpose. However, I have just noticed that my code execution does not enter inside the @if code block.

The actual data that i want to pass into the database table is

 $vid->filename=$filename;
             $vid->path=$path;

inzmam left a reply on Unable To Upload Video File • 5 months ago

thanks for your reply! Yeah it does, meant anything of the uploaded video, but when i upload images, it shows all the info??

inzmam left a reply on Unable To Upload Video File • 5 months ago

Someone please help me.......

inzmam left a reply on Unable To Upload Video File • 5 months ago

dd($vid) does not contain anything, however when i upload images instead of video it has all the info.

does laravel support video upload or it needs different configuration. I think it needs some different config.

please help me in this case. I am stuck in this since a long time

16th March, 2018

inzmam left a reply on Unable To Upload Video File • 5 months ago

$vid is an object of VideoStores model and move function is being used to store the video in video folder under public, do we have any other way out to upload video files and why can't it be done on the same way as i did it to upload images??

inzmam left a reply on Unable To Upload Video File • 5 months ago

Interestingly, i have used FORM facade only to upload images which was uploaded successfully and stored in database table also. Just wanted to ask you if below code is causing an error,

//Image::make($video)->resize(400,200)->save($location);

    $vid->move($location,$filename);
    $vid->filename=$filename;
     $vid->path=$video;
    

inzmam left a reply on Unable To Upload Video File • 5 months ago

Here is my form

' {{Form::open(['route'=>'pages.uploadVideo','files'=>true])}} {{Form::file('Upload_video',['style'=>'margin-top:10px;'])}} {{Form::submit('Upload Video',['class'=>'btn btn-default','style'=>'margin-top:10px;'])}} {{Form::close()}} '

inzmam started a new conversation Unable To Upload Video File • 5 months ago

When i am going to upload a video file i m getting an error as "SQLSTATE[HY000]: General error: 1364 Field 'filename' doesn't have a default value (SQL: insert into video_stores (updated_at, created_at) values (2018-03-16 04:14:58, 2018-03-16 04:14:58))".

I don't why this error is being thrown, however i am passing all the values. Please help me in this case.

HomeController:- 'public function uploadVideo(Request $request) { $vid=new VideoStore; if($request->hasFile('Upload_video')) { $video=$request->file('Upload_video'); $filename=time().'.'.$video->getClientOriginalExtension(); $location=public_path('video/'.$filename);

        //Image::make($video)->resize(400,200)->save($location);
       
        $vid->move($location,$filename);
        $vid->filename='inzmam';
         $vid->path='ul haq';
        
    }
    $vid->save();
    Session::flash('success','Your video has been uploaded');
    return redirect()->route('pages.index');
}'

Migration:-

'public function up() { Schema::create('video_stores', function (Blueprint $table) { $table->increments('id'); $table->string('filename'); $table->string('path'); $table->timestamps(); }); }

/**
 * Reverse the migrations.
 *
 * @return void
 */
public function down()
{
    Schema::dropIfExists('video_stores');
}'.

6th March, 2018

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

How can i achieve this, do you mean to say i need to write the below code

public function announcement($id) { $ann=announcement::find($id); return view('announcement.announcement')->withAnn($ann); }

if yes, i think i need to modify the Route also to achieve this which i have done but does not help me

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

yes, bcoz i need to display the data on the same view

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

How can i fix it then?

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

But this function is not being used to display the data,Its just being used to invoke the announcement.announcement view

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

Please check if this can help you in finding the issue.. But one thing is clear that when i pass the id of the announcement in URL manualy, it fixes the concern. Probabbly there is issue either in route or HomeController

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

('

public function announcement() { return view('announcement.announcement'); } public function storeAnnouncement(Request $request) { $messages=['title.required'=>'Please enter the title', 'announcement'=>'Please enter your announcement message']; $this->validate($request,[ 'title'=>'required|max:255', 'announcement'=>'required' ],$messages); $announcement=new announcement;

    $announcement->title=$request->title;
    $announcement->announcement=$request->announcement;

    $announcement->save();
    Session::flash('success','Your data has been saved');
    return redirect()->route('announcement.announcement',$announcement->id);
    
}
public function showAnnouncement($id)
{
    $ann=announcement::find($id);
    return view('announcement.announcement',['ann'=>$ann]);
    /*return view('announcement.announcement')->with('ann', $ann);*/
    /*return View::make('announcement.announcement',compact($ann));*/
}

')

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

I am unable to post the HomeController codes inspite of wrapping the code

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

('

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

When i pass the id of announcement in URL it displays the data perfectly. It might give you an idea about this issue

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

Here is Homecontroller.

================================

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

inzmam left a reply on Not Able To Pass Data To View • 5 months ago

It does not fix the issue, I don't really understand why it is showing this error, earlier i have been passing the data to view in this way.

What could be any other probable reason??

inzmam started a new conversation Not Able To Pass Data To View • 5 months ago

I am trying to pass a variable called $ann to the page called "announcement.announcement" but it shows as undefined variable.

Route::get('/announcement',['as'=>'announcement.announcement','uses'=>'[email protected]']); Route::post('/storeAnnouncement',['as'=>'announcement.storeAnnouncement','uses'=>'[email protected]']); Route::get('/announcement/{id}',['as'=>'announcement.show','uses'=>'[email protected]']);

=======================

public function storeAnnouncement(Request $request) { $messages=['title.required'=>'Please enter the title', 'announcement'=>'Please enter your announcement message']; $this->validate($request,[ 'title'=>'required|max:255', 'announcement'=>'required' ],$messages); $announcement=new announcement;

    $announcement->title=$request->title;
    $announcement->announcement=$request->announcement;

    $announcement->save();
    Session::flash('success','Your data has been saved');
    return redirect()->route('announcement.announcement',$announcement->id);
    
}
public function showAnnouncement($id)
{
    $ann=announcement::find($id);
    return view('announcement.announcement')->withAnn($ann);
}

========================================

section('title','|Announcement')

@section('content')

{{$ann->title}}

{!!Form::open(['route'=>'announcement.storeAnnouncement','class'=>'form-horizontal'])!!} {{Form::label('title','Title*')}} {{Form::text('title',null,['class'=>'form-control bottom-space'])}} {{Form::label('announcement','Announcement*')}} {{Form::textarea('announcement',null,['class'=>'form-control bottom-space'])}} {{Form::submit('Submit',['class'=>'btn btn-color btn-block'])}} {!!Form::close()!!} @endsection

15th February, 2018

inzmam left a reply on Getting Error As "array_merge(): Argument #2 Is Not An Array" • 6 months 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" • 6 months 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" • 6 months 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" • 6 months 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" • 6 months 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" • 6 months 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" • 6 months 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 • 7 months 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 • 7 months ago

Getting error as Class 'Form' not found

inzmam started a new conversation Unable To Load Form/Html In Laravel 5.4.36 Version • 7 months 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 • 7 months 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 • 7 months 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 • 7 months ago

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

2nd January, 2018

inzmam started a new conversation Admin And User Login Redirection • 7 months 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 • 7 months 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 • 7 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 • 7 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.