Bribin

Bribin

UX/UI Designer at Bahrain

Member Since 3 Years Ago

Experience Points 3,305
Experience
Level
Lessons Completed 26
Lessons
Completed
Best Reply Awards 0
Best Answer
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.

23 Aug
4 months ago

Bribin started a new conversation Laravel File Upload Different Versions And Formats Of A File

Let me know a sample. how can I store the uploaded file to the database; laravel ex. In the system, if upload a doc file, it will automatically convert to PDF.(via cloud convert API ). how I can save both files in the database

   ---------------------------------------------------
   |id|proposal_id|version_id|Status|fileName|filetype| 
   ---------------------------------------------------

Bribin left a reply on Help With Has Many Relationships Database Table

my usage is on upload docx .. automatically docx convert into PDF file & store files. after in show blade. based on proposal ID and Version ID- PDf version. im using cloudconvert Api for Converting PDF,

Bribin left a reply on Help With Has Many Relationships Database Table

@Yorki Let me know it the proper way of saving doc and pdf of the same version?

or ----------------------------------------------------------------------------------------------------------- | id | proposal_id | version_ID | Status | filetitle | fileNamedoc | fileNamePDF -----------------------------------------------------------------------------------------------------------

Bribin started a new conversation Help With Has Many Relationships Database Table

I have 2 Tables proposals & Proposal Attachments. each proposal has a docx file & Pdf File. let me know the below table design is correct

proposals ----------------------------------------------------

| id | proposalNo | ProposalTitle | Status | ---------------------------------------------------- | 1 | PRO 123 | sample | 0 | ----------------------------------------------------

proposal_attachments -----------------------------------------------------------------------------------

| id | proposal_id | version_ID | Status | fileName | filetype | ----------------------------------------------------------------------------------- | 1 | 1 | 1 | 1 | Sample1.docx | doctype | ---------- ------------------------------------------------------------------------- | 2 | 1 | 1 | 1 | Sample1.pdf | pdf | ----------------------------------------------------------------------------------- | 3 | 1 | 2 | 1 | Sample1.docx | doctype | ----------------------------------------------------------------------------------- | 4 | 1 | 2 | 1 | Sample1.pdf | pdf | ------------------------------------------------------------------------------------

is this the correct design of Table or Not?

14 Jan
1 year ago

Bribin left a reply on Laravel Invoice And Invoice Items - Foreach Hasmany Relationship

@Snapey that time. If I remove a exitising item from the form?

Bribin left a reply on Laravel Invoice And Invoice Items - Foreach Hasmany Relationship

@VijayKadiyam both if already is thre update. otherwise create

Bribin started a new conversation Laravel Invoice And Invoice Items - Foreach Hasmany Relationship

i have 2 tables . if update or create method

proposal
        id
        pro_amt
--------------------------------
invoice_items
        proposal_id
        item
        price

i can successfully save date. i have some problems with updating data

Save method

foreach ($request->proposalItems as $item)
{
$data = array(
'proposal_id' => $proposal->id,
'item' => $item['item'],
'price' => $item['price'],
);
$proposal->ProposalItems()->create($data);
}

Update Method

  $items =$request->proposalItems;
        foreach ($items as $item) {
            $data = array(
                'proposal_id' => $proposal->id,
                'item' => $item['item'],
               
                'price' => $item['price'],
            );
         $proposal->ProposalItems()->updateorcreate($data);
     }

my form

 @if (!empty($proposals->ProposalItems))
                                    <?php $count = 0; ?>
                                    @foreach ($proposals->ProposalItems as $item )
                                        <tr class="item-row">
                                            <td> <input type="hidden" name="proposalItems[<?php echo $count; ?>][item_id]" value="{{$item->id}}"> {!! Form::text('proposalItems['.$count.'][title]',$item->item, ['class' => 'form-control','required'=>'required'] ) !!}</td>
                                          
                                            <td>{!! Form::number('proposalItems['.$count.'][price]',$item->price, ['class' => 'form-control price','data-parsley-type'=>'number','required'=>'required'] ) !!}</td>
                                            @if ($count > 0)
                                                <td><button id="<?php echo $count; ?>" type="button" class="btn btn-danger delRow"><i class="fa fa-trash-o" aria-hidden="true"></i></button></td>
                                            @else
                                                <td><button id="addRow" type="button" class="btn btn-default"><i class="fa fa-plus" aria-hidden="true"></i></button></td>
                                            @endif
                                        </tr>
                                        <?php $count++ ?>
                                    @endforeach
                                @else
                                    <tr class="item-row">
                                        <td><input type="hidden" name="item_id[]" value=""> {!! Form::text('proposalItems[0][title]',NULL, ['class' => 'form-control','required'=>'required'] ) !!}</td>
                             
                                        <td>{!! Form::number('proposalItems[0][price]',NULL, ['class' => 'form-control price','data-parsley-type'=>'number','required'=>'required'] ) !!}</td>
                                        <td>
                                            <button id="addRow" type="button" class="btn btn-default"><i class="fa fa-plus" aria-hidden="true"></i></button>
                                        </td>
                                    </tr>
                                @endif

````


12 Jan
1 year ago

Bribin left a reply on Check If The Object Request Is Empty Before For Each

It's not a single key.its a request array having 3 fields

10 Jan
1 year ago

Bribin left a reply on Check If The Object Request Is Empty Before For Each

i tried this. its not working with my needs.

$contacts = collect($request->contacts);

Output is

[{"first_name":null,"last_name":null,"contact_email":null,"contact_phone":null,"contact_department":null}]

if the output values is null i dnt want to save the values. otherwise save the values

Bribin left a reply on Check If The Object Request Is Empty Before For Each

I want to insert the data into database not displaying

Bribin started a new conversation Check If The Object Request Is Empty Before For Each

  <tr >
                                    <td> {!! Form::text('contacts[][first_name]',NULL, ['class' => 'form-control'] ) !!}</td>
                                    <td> {!! Form::text('contacts[][last_name]',NULL, ['class' => 'form-control'] ) !!}</td>
                                    <td> {!! Form::text('contacts[][contact_email]',NULL, ['class' => 'form-control'] ) !!}</td>
                                    <td> {!! Form::text('contacts[][contact_phone]',NULL, ['class' => 'form-control'] ) !!}</td>
                                    <td> {!! Form::text('contacts[][contact_department]',NULL, ['class' => 'form-control'] ) !!}</td>
                                </tr>

check if the Object request is empty before foreach, without form validation


if(empty($request->contacts))
{
 do something
}

08 Jan
1 year ago

Bribin started a new conversation Checking If A Request Array Is NULL In Laravel

I have a dynamically generated form that gives me an array of inputs. However the array might be empty, then the foreach will fail.

if(null($request->contacts)) { #do something }

how to check if there is any no input in array

27 Sep
3 years ago

Bribin started a new conversation Dropzone Js + File Upload File Order

Hi, Im developing a project with Dropzone file upload, i want to pass the order of dropone file into data base , how i can save the order/position of the file in database

    $file = Input::file('file');
        $campaign =  Campaign::getCampaign($id);
           
        $uploadPath = 'uploads/stores/'.$campaign->store->id.'/'.$id.'/';
        $destinationPath = '/uploads/stores/'.$campaign->store->id.'/'.$id.'/';
        $filename = $id .'-'.$campaign->store->id.$file->getClientOriginalName();
        $upload_success = Input::file('file')->move($uploadPath, $filename);

            if ($upload_success) {
                    // resizing an uploaded file
                $thumb = Image::make($uploadPath.$filename)->resize(184, NULL,  function ($c) {
                    $c->aspectRatio();
                    $c->upsize();
                });
                $thumb->save($uploadPath.'thumb_'.$filename);
            }

        $campaign->flyers()->create(
                 ['path' => $destinationPath.$filename, 'order'=> $i ,'thumbnail'=>    $destinationPath.'thumb_'.$filename]
        );
    return  'success';

dropzone .js config

Dropzone.options.addflyer = { uploadMultiple: false, parallelUploads: 1, maxFilesize: 8, autoProcessQueue: false, addRemoveLinks: true, dictRemoveFile: 'Remove', dictFileTooBig: 'Image is bigger than 8MB',

         };
24 Sep
3 years ago

Bribin started a new conversation Project Flyer - File Name As Flyerid Counter & File Count

Hi,

I'm trying to implement Project flyer , How i can get the uploaded photos nameing like example [flyerID].[photo-1.png] [flyerID].[photo-2.png] [flyerID].[photo-3.png]

    $file = Input::file('file');
        $file_count = count($file);
        $destinationPath = public_path() . '/uploads/stores/' ;
        $filename = time() . $file->getClientOriginalName();
        $upload_success = Input::file('file')->move($destinationPath, $filename);
        $campaign =  Campaign::where(compact($id))->first();
        $campaign->flyers()->create(
            ['path' => $destinationPath]
             );
18 Sep
3 years ago

Bribin left a reply on DropzoneJs Files Save Order As Filename To Database Laravel 5

I have flyers and photos. Each flyer contains many photos.

namespace App;

use Image; use Illuminate\Database\Eloquent\Model; use Symfony\Component\HttpFoundation\File\UploadedFile;

class Photo extends Model {

/**
 * Database table
 *
 * @var string
 */
protected $table = 'flyer_photos';

/**
 * Fillable fields
 *
 * @var array
 */
protected $fillable = [
    'path',
    'name',
    'thumbnail_path'
];

/**
 * Base path to images
 *
 * @var string
 */
protected $baseDir = 'images/home_pics';


/**
 * Get instance from form
 *
 * @param $name
 * @return static
 * @internal param UploadedFile $file
 */
public static function named($name)
{

    return (new static)->saveAs($name);

}

/**
 * Set values to this
 *
 * @param $name
 * @return $this
 */
public function saveAs($name)
{

    $this->name = sprintf("%s-%s", time(), $name);
    $this->path =sprintf("%s/%s", $this->baseDir, $this->name);
    $this->thumbnail_path = sprintf("%s/tn-%s", $this->baseDir, $this->name);

    return $this;

}

/**
 * Move photo
 *
 * @param UploadedFile $file
 * @return $this
 */
public function move(UploadedFile $file)
{

    $file->move($this->baseDir, $this->name);

   $this->makeThumbnail();

    return $this;

}

/**
 * Generate thumbnail
 *
 */
private function makeThumbnail()
{

    Image::make($this->path)
        ->fit(200)
        ->save($this->thumbnail_path);
}


/**
 * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
 */
public function flyers()
{

    return $this->belongsTo('App\Flyer');

}

}

Bribin left a reply on DropzoneJs Files Save Order As Filename To Database Laravel 5

@sid405 yes. I want to Upload multiple images in the same order. and after uploading also i want to sort the order

Bribin started a new conversation DropzoneJs Files Save Order As Filename To Database Laravel 5

I am working on a project which involves file uploading. I am using DropzoneJS and Laravel for this project. Everything seems to work fine, i want to save files with order.i want to pass the image order and save image file in that order.

var baseUrl = "{{ url('/') }}"; var token = "{{ Session::getToken() }}";

Dropzone.autoDiscover = false;
var myDropzone = new Dropzone(".dropzone", {
    url: baseUrl + "/upload",
    params: {
        _token: token

    }
});
Dropzone.options.myAwesomeDropzone = {
    paramName: "flyers",
    acceptedFiles: "image/*",
    enqueueForUpload: true,
    forceFallback: false,
    dictDefaultMessage: "Drop files here to upload",
    autoProcessQueue: false,
    uploadMultiple: false,
    maxFilesize: 2, // MB
    addRemoveLinks: true,

    accept: function(file, done) {

    },
};
    

public function album() { $file = Input::file('file');

$destinationPath = 'uploads'; $filename = $file->getClientOriginalName();

$uploadSuccsess = Input::file('file')->move($destinationPath, $filename); if( $uploadSuccsess ) { return Response::json('success', 200); } else { return Response::json('error', 400); } }

25 May
3 years ago

Bribin left a reply on Add Database Record And Redirect To Edit View With New Record ID

@christophrumpel only empty rows with primary key. I want only primary Key. two Rows adding in each request

Bribin left a reply on Add Database Record And Redirect To Edit View With New Record ID

Thanks @christophrumpel

    public function create()
    {
    $page = new Page;
    $page->save();
    return Redirect::to("/dashboard/pages/" . $page->id . "/edit");
    }

its working Properly but its adding two rows to database :(

Bribin started a new conversation Add Database Record And Redirect To Edit View With New Record ID

How to Add Database Record and Redirect to Edit View with New Record ID in Create Route in resource controller ?

20 Mar
3 years ago

Bribin started a new conversation Requests Does Not Exit

ReflectionException in RouteDependencyResolverTrait.php line 53: Class App\Http\Controllers\PageRequests does not exist

use App\Page; use App\Http\Requests\PageRequest; use App\Http\Requests; use Illuminate\Http\Request;

class PageController extends Controller {

17 Mar
3 years ago

Bribin left a reply on Generate A Unique Slug From Title

@sitesense Thanks for Replay .. This also i tried . again im getting the same Error :(

Bribin left a reply on Generate A Unique Slug From Title

@sitesense

I Tried this method. but im getting this Error

FatalErrorException in PageController.php line 63: Class 'Str' not found

Bribin started a new conversation Generate A Unique Slug From Title

Please help me to generate a Unique Slug From Title

10 Mar
3 years ago

Bribin started a new conversation Changing Middleeware Auth Routes

How to change the middle ware auth route

domainname.com/auth/logii to domainname.com/auth/signin