{{ $var or 'No Phone' }} === {{ isset($var)? $var : 'No Phone' }} Because $user->phone is defined you should use this: {{ $user->phone? $user->phone : 'No Phone' }} Or, you can go nice Laravel way and create your own directive for Blade templates and use it like this: @var($user->phone,...

If you read on the R help page for as.Date by typing ?as.Date you will see there is a default format assumed if you do not specify. So to specify for your data you would do nmmaps$date <- as.Date(nmmaps$date, format="%m/%d/%Y") ...

You can only send serializable entities to the queue. This includes Eloquent models etc. But not the PDF view instance. So you will probably need to do the following: Mail::queue('emails.factuur', array('factuur' => $factuur), function($message) { $pdf = PDF::loadView('layouts.factuur', array('factuur' => $factuur)); $message->to(Input::get('email'), Input::get('naam'))->subject('Onderwerp'); $message->attach($pdf->output()); }); ...

zip the lists and use a for loop: def downloadData(n,i,d): for name, id, data in zip(n,i,d): URL = "http://www.website.com/data/{}".format(name) #downloads the file from the website. The last part of the URL is the name r = requests.get(URL) with open("data/{}_{}_{}.csv".format(name, id, data), "wb") as code: #create the file in the format...

Corresponding to official manual for mysqli_fetch_array: mysqli_fetch_array — Fetch a result row as an associative, a numeric array, or both You coded MYSQLI_ASSOC flag, so yo get associative array for one row of data: By using the MYSQLI_ASSOC constant this function will behave identically to the mysqli_fetch_assoc() See examples of...

Not sure there is a way in pandas but checking if the file exists would be a simple approach: import os # if file does not exist write header if not os.path.isfile('filename.csv'): df.to_csv('filename.csv',header ='column_names') else: # else it exists so append without writing the header df.to_csv('filename.csv',mode = 'a',header=False) ...

you need to turn x and y into type np.array before you calculate above_threshold and below_threshold, and then it works. In your version, you don't get an array of bools, but just False and True. I added comma delimiters to your input csv file to make it work (I assume...

Well, this error occurred because I had '.' in place of '->'. I couldn't figure out why it was always throwing the exact same error regardless if I did $this.belongsTo('App\User'); or $this.hasMany('App\User'); or even $this.thecakeisalie('App\User'); until I sat staring at the text between my many models yet again. Then, lo...

You can use Auth::user() in the whole application. It doesn't matter where you are. But, in response to your question, you can use the 'Controller' class present in your controllers folder. Add a constructor there and make the reference to the user ID. <?php namespace App\Http\Controllers; use Illuminate\Foundation\Bus\DispatchesCommands; use Illuminate\Routing\Controller...

Until Predis' zAdd method is updated to support the changes in Redis v3.0.2, your best bet is to explore the wonderful world of RawCommand: https://github.com/nrk/predis/blob/master/src/Command/RawCommand.php It should let you construct your own commands, including the ZADD NX ... variant....

You can build the whole dictionary first, with the lists containing all the values for each key. Then once the dictionary is made, you can go through every key and take the largest and smallest values. yourdict = dict() with open(file) as f: filedata = f.read().splitlines() for line in filedata:...

What do you mean by difference? The answer to that gives you two distinct possibilities. If a row is considered same when all columns are same, then you can get your answer via the following code: import csv f1 = open ("olddata/file1.csv") oldFile1 = csv.reader(f1) oldList1 = [] for row...

Use datetime.timedelta() objects to model the durations, and pass in the 3 components as seconds, minutes and hours. Parse your file with the csv module; no point in re-inventing the character-separated-values-parsing wheel here. Use a dictionary to track In and Out values per user; using a collections.defaultdict() object will make...

Having a look at your repository in https://github.com/Yunishawash/api-guard it looks like it doesn't have a branch called dev-fullauth. Instead there is a branch dev-bugfix. But you must not name your branch including the dev- prefix. Rename your branch at github from dev-bugfix to bugfix and then your require section would...

That's simple php stuff. Set the attribute as static and access it with ::. class LanguageMiddleware { public static $languages = ['en','es','fr','de','pt','pl','zh','ja']; } @foreach (App\Http\Middleware\LanguageMiddleware::$languages as $lang) ... @endforeach You should not have that in a middleware though. You'd better add a configuration (i.e in /config/app.php) with that array, and...

Actually, you should reserve in config/app.php file. Then, you can add In the Service Providers array : 'Menu\MenuServiceProvider', In the aliases array : 'Menu' => 'Menu\Menu', Finally, you need to run the following command; php artisan dump-autoload I assume that you already added this package in composer.json Sorry, I didn't...

When creating a foreign key constraint, you can also decide what should happen with the constraints. For instance, if you want to delete all articles when a category is deleted (as I guess is your question): Schema::table('articulos', function($table) { $table->foreign('categoria_id')->references('id')->on('categorias')->onDelete('cascade'); $table->foreign('creador_id')->references('id')->on('users'); }); Also see documentation. The cascade identifies to the...

In your admin template you set the goto url as sessions.store which hits SessionsController::store in that method you have a debug function dd() which is throwing that string. It get's called because auth::attempt() returns false as by your own code: if($attempt) return Redirect::intended('/'); So the behavior is exactly doing what...

Probably in your case the simplest way to do it is to change the current thread culture then restore it. Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US"); You can also specify a format provider in (prop.GetValue(entityObject, null) ?? "?").ToString() but in this case you probably need to check if prop.GetValue(entityObject, null) is IFormattable...

1. Theoretically there is no difference between Controller validation and Validation using FormRequest. Normally you should use FormRequest. This will keep your controller clean and Minimal. But some time it is sensible to use Validator within controller, e.g you know there is going to be just one field to validate,...

As per your requirement, I blieve you have to update your relation to Polymorphic Relations. and than to access other attributes try one of them method. $user->roles()->attach(1, ['expires' => $expires]); $user->roles()->sync([1 => ['expires' => true]]); User::find(1)->roles()->save($role, ['expires' => $expires]); If you still facing some dificulties to handle that requirement let...

You seem to be doing the Skip(1) in the wrong place: var csvLinesData = csvlines.Skip(1).Select(l => l.Split(',').ToArray()); // IEnumerable<string[]> As it stands you're skipping the first column for each row, not the first row....

You can concat the two DataFrames, interpolate, then reindex on the DataFrame you want. I assume we have a certain number of DataFrames, where the Date is a DateTimeIndex in all of them. I will use two in this example, since you used two in the question, but the code...

IEnumerable<string> values = new List<string>(); values = … Probably not going to be a big deal, but why create a new List<string>() just to throw it away. Replace this with either: IEnumerable<string> values; values = … If you need values defined in a previous scope, or else just: Enumerable<string> values...

The problem here is that re.search returns a match object not the match string and you need to use group attribute to access your desire result. If you wants all the captured groups you can use groups attribute and for a special group you can pass the number of expected...

quotechar only indicates what character the writer should use for quoting. It's quote=csv.QUOTE_ALL that you need. Create your writer like this: a = csv.writer(fp, quoting=csv.QUOTE_ALL) quoting defaults to csv.QUOTE_MINIMAL, meaning that it will only quote fields if they contain the delimiter, which is why it's only quoting "JOHNSON, JOHN J."....

If you need the comments, you still can replace the 6th comma with a semicolon and use your previous solution: gsub("((?:[^,]*,){5}[^,]*),", "\\1;", vec1, perl=TRUE) Regex explanation: ((?:[^,]*,){5}[^,]*) - a capturing group that we will reference to as Group 1 with \\1 in the replacement pattern, matching (?:[^,]*,){5} - 5 sequences...

Pretty fundamentally - CSV is an array based data structure - it's a vaguely enhanced version of join. But the thing you need for this job is print_hr from Text::CSV. First you need to set your header order: $csv->column_names (@names); # Set column names for getline_hr () Then you can...

I believe the problem is with Dir.foreach, not CSV.open. You need to supply a directory to foreach as an argument. That's why you are getting the missing argument error. Try: Dir.foreach('/path/to_my/directory') do |current_file| I think the open that is referenced in the error message is when Dir is trying to...

Something like this may work... the idea is to add an additional select which is 0 or 1 depending on if the date is today. Then you can order by that column first, then the actual date second. public function scopeRestaurantsWithMenusToday($query, $city_uri){ return $query->where('city_uri', '=', $city_uri)->with([ 'restaurants', 'restaurants.menusToday' => function($query)...

Are you using cygwin? You should run the commands inside the Homestead folder which is created after you do homestead init. Then you do the configuration or mapping of folders in your Homestead.yaml. it is located in you home directory. in my case in created a .homestead folder. I'm using...

You could handle this in Laravel app/Exceptions/Hnadler.php NB: I have looked in the option of using DOMException handler which is available in PHP, however the error message you are getting in not really and exception by an I/O Warning. This what PHP native DomException looks like: /** * DOM operations...

In my recent laravel 5 project, I'm used to prepare my logics as Repository method. So here's my current directory structure. For example we have 'Car'. So first I just create directory call it libs under app directory and loaded it to composer.json "autoload": { "classmap": [ "database", "app/libs" //this...